lophtware

Logo

lophtware projects

GitHub Profile

Core - Pin Configuration (B2)

Report Type: IN / OUT
Report Size: 19 Bytes
Acknowledged By: Command Acknowledgement

Report ID Unlock Key Suspend Behaviour Interface ID Function ID Function Arguments
01 01 0010 8 bytes ss r 00 o wp 0000 iiii ffffffff 7 bytes

THIS COMMAND HAS THE POTENTIAL TO DESTROY THE DEVICE AND / OR CONNECTED CIRCUITRY, IE. BY SHORT-CIRCUITING TWO OUTPUTS TOGETHER.

Report ID

HID Report ID. Always 0x52.

The Pin Configuration report IDs all follow this encoding scheme:

Bits Direction Meaning
01    
bb IN / OUT Bank number; 00 for A, 01 for B, 10 for C and 11 is reserved.
pppp IN / OUT The pin’s index into the bank.

For example, pin B0 is 01 0000, C9 is 10 1001, etc. Thus B2 is 01 0010. Undefined pins give invalid report IDs and so will result in a Negative Command Acknowledgement response. No changes will be made in this instance.

Unlock Key

An 8-byte key that is compared against a previously stored value. This mechanism prevents accidental in-circuit re-configuration of a pin, which could adversely affect the device or connected circuit.

If the given key does not match the one stored against the configuration then the command will have no effect and a Negative Command Acknowledgement will be returned.

For an IN Report this will be all zeroes.

Suspend Behaviour

The behaviour of the pin when the device enters Suspend.

Bits Direction Meaning
ss IN / OUT Suspend behaviour; 00 for unchanged, 01 to switch to input, 10 to output low, 11 to output high.
r IN / OUT Remote Wake-Up; 0 to disable, 1 to wake from Suspend when a transition occurs on the pin.
00    
o IN / OUT Output type; 0 for push-pull, 1 for open-drain.
wp IN / OUT Weak Pulls; 00 for none, 01 for pull-down, 10 for pull-up, 11 is reserved but will enable the pull-up.

Interface ID

Out-of-range Interface IDs, ie. those not listed below, will cause a Negative Command Acknowledgement.

0x00 - Core (Pin)

Any pin can be assigned to this interface.

GPIO

The pin is assigned to the GPIO function. Any pin can be assigned to this function.

Function ID Pin Behaviour Interrupt Behaviour Flags Reserved
000000dd 0000 l o wp 00000 p n m 0000 iiii 00000000 00000000 00000000 00000000
Bits Direction Meaning
000000    
dd IN / OUT Pin direction; 00 for input, 01 for output, 10 and 11 are reserved but will default to input and output, respectively.
Bits Direction Meaning
0000    
l IN / OUT The initial value of the output latch after power-on.
o IN / OUT Output type; 0 for push-pull, 1 for open-drain.
wp IN / OUT Weak Pulls; 00 for none, 01 for pull-down, 10 for pull-up, 11 is reserved but will enable the pull-up.
Bits Direction Meaning
00000    
p IN / OUT Interrupt on positive edges if set to 1.
n IN / OUT Interrupt on negative edges if set to 1.
m IN / OUT Interrupt mode; 0 for one-shot, 1 for continuous.
Bits Direction Meaning
0000    
iiii IN / OUT An ID for the pin, in the range [0, 10]. This is useful for assigning application-specific weights to the pins, for example during parallel value outputs.

It is not possible to assign the same ID to multiple pins - the pin assigned last ‘wins’. The default mapping is:

A2 A3 A4 B0 B1 B2 B3 B4 B5 B7 C9
0 1 2 3 4 5 6 7 8 9 10

0x03 - USB (Universal Serial Bus)

Any pin can be assigned to this interface.

Status Flags

The pin is assigned to the Status Flags function which provides information on the state of the USB cable, connector and protocol. Any pin can be assigned to this function. Multiple pins can be assigned to this function, each with independent parameters.

Multiple flags can be combined together into a single output pin using either an AND or an OR operation. Flags can also be inverted prior to the combining operation. This scheme provides a very flexible method of signalling USB state to connected circuitry. For example, it is possible to have a pin indicating the condition of NOT attached to a dedicated charger AND the device can source a current of at least 100mA.

Function ID Pin Behaviour Mask LSB Mask MSB Mask Inversion LSB Mask Inversion MSB Current LSB Current MSB
0000100 m 0000 l o wp h g f e d c b a s r q p k j i H G F E D C B A S R Q P K J I cccccccc 000000 cc
Bits Direction Meaning
0000100    
m IN / OUT The flag mode; 0 to trigger on any flag in the mask (‘OR’), 1 to trigger on all flags (‘AND’).
Bits Direction Meaning
0000    
l IN / OUT The active-state; 0 for active-low, 1 for active-high.
o IN / OUT Output type; 0 for push-pull, 1 for open-drain.
wp IN / OUT Weak Pulls; 00 for none, 01 for pull-down, 10 for pull-up, 11 is reserved but will enable the pull-up.
Bits Direction Meaning
a IN / OUT Attached to a device (ie. a Source (Host) will be on the other end of the cable).
b IN / OUT Attached as a Debug (Sink) Accessory.
c IN / OUT Attached to an Audio (Sink / Source) Accessory - THE ELECTRICAL SPECIFICATIONS FOR AUDIO ACCESSORIES ARE NOT SUPPORTED AND WILL DAMAGE THE DEVICE; THIS FLAG IS FOR INFORMATION ONLY.
d IN / OUT The cable is an active cable.
e IN / OUT The VBUS (+5V) voltage is within USB specifications.
f IN / OUT The voltage on the CC pins is within USB specifications.
g IN / OUT The CC1 pin (USB connector pin A5) is connected.
h IN / OUT The CC2 pin (USB connector pin B5) is connected.
i IN / OUT No faults have occurred when examining the CC pin(s).
j IN / OUT The D+ / D- lines were checked for short on power-up.
k IN / OUT The D+ / D- lines were shorted on power-up, a crude indication of being connected to a dedicated charger.
p IN / OUT Source has suspended the device.
q IN / OUT USB enumeration has completed.
r IN / OUT USB protocol error has occurred (one or more endpoints are in the HALTED state).
s IN / OUT Source device’s current capability is at least (cc cccccccc * 2)mA.
Bits Direction Meaning
A IN / OUT Value to be XOR’d with flag a; if 1 then flag a will be inverted before evaluation (ie. 1 if a device is NOT attached and 0 otherwise).
IN / OUT
S IN / OUT Value to be XOR’d with flag s; if 1 then flag s will be inverted before evaluation (ie. 1 if the Source CANNOT provide the requested current, 0 if it can).
Bits Direction Meaning
cccccccc IN / OUT Least significant bits of a value representing a current, in units of 2mA. This is used during evaluation of the s flag.
000000 IN / OUT Reserved for future expansion; set to all zeroes.
cc IN / OUT The two most significant bits of the current.

0x04 - I2C (Inter-Integrated Circuit)

Only pins B2 and B3 can be assigned to this interface, and they cannot be configured individually. If the I2C module has been enabled then any configuration of the B2 and B3 pins is overridden.

0x06 - SPI (Serial Peripheral Interface)

Any pin can be assigned to this interface.

Clock

The pin is assigned to the SPI Clock function. Any pin can be assigned to this function.

Function ID Pin Behaviour Reserved
00000001 0000 l o wp 6 bytes (should be all zeroes)
Bits Direction Meaning
0000    
l IN / OUT The latch state when no slaves are selected; 0 for low, 1 for high.
o IN / OUT Output type; 0 for push-pull, 1 for open-drain.
wp IN / OUT Weak Pulls; 00 for none, 01 for pull-down, 10 for pull-up, 11 is reserved but will enable the pull-up.

MISO (Master-In, Slave-Out)

The pin is assigned to the SPI MISO function. Any pin can be assigned to this function.

Function ID Pin Behaviour Reserved
00000010 000000 wp 6 bytes (should be all zeroes)
Bits Direction Meaning
000000    
wp IN / OUT Weak Pulls; 00 for none, 01 for pull-down, 10 for pull-up, 11 is reserved but will enable the pull-up.

MOSI (Master-Out, Slave-In)

The pin is assigned to the SPI MOSI function. Any pin can be assigned to this function.

Function ID Pin Behaviour Reserved
00000011 0000 l o wp 6 bytes (should be all zeroes)
Bits Direction Meaning
0000    
l IN / OUT The latch state when no slaves are selected; 0 for low, 1 for high.
o IN / OUT Output type; 0 for push-pull, 1 for open-drain.
wp IN / OUT Weak Pulls; 00 for none, 01 for pull-down, 10 for pull-up, 11 is reserved but will enable the pull-up.

Frame Select

The pin is assigned to the SPI Frame Select function. Any pin can be assigned to this function.

Function ID Pin Behaviour Reserved
00000100 0000 l o wp 6 bytes (should be all zeroes)
Bits Direction Meaning
0000    
l IN / OUT The latch state when no slaves are selected; 0 for low, 1 for high.
o IN / OUT Output type; 0 for push-pull, 1 for open-drain.
wp IN / OUT Weak Pulls; 00 for none, 01 for pull-down, 10 for pull-up, 11 is reserved but will enable the pull-up.

Slave Select

The pin is assigned to the SPI Slave Select function. Any pin can be assigned to this function.

Function ID Pin Behaviour Reserved
00001 nnn 0000 l o wp 6 bytes (should be all zeroes)
Bits Direction Meaning
00001    
nnn IN / OUT Slave number, in the range [0, 7].
Bits Direction Meaning
0000    
l IN / OUT The active-state; 0 for active-low, 1 for active-high.
o IN / OUT Output type; 0 for push-pull, 1 for open-drain.
wp IN / OUT Weak Pulls; 00 for none, 01 for pull-down, 10 for pull-up, 11 is reserved but will enable the pull-up.

THIS COMMAND HAS THE POTENTIAL TO DESTROY THE DEVICE AND / OR CONNECTED CIRCUITRY, IE. BY SHORT-CIRCUITING TWO OUTPUTS TOGETHER.