lophtware projects
Report Type: IN / OUT
Report Size: 7 Bytes
Acknowledged By: Command Acknowledgement
Report ID | Enumerated Current Flags | Enumerated Current LSB | Enumerated Current MSB | Charger Current Flags | Charger Current LSB | Charger Current MSB |
---|---|---|---|---|---|---|
00001000 | u 0000000 |
eeeeeeee |
0000000 e |
T C 00000 t |
cccccccc |
00000 ccc |
HID Report ID. Always 0x08
.
Bits | Direction | Meaning |
---|---|---|
u |
OUT | Whether to update the current limit descriptor that is parsed by the Host during enumeration (bMaxPower in the USB specifications); 1 to update it, 0 to leave it alone. For IN Reports this will always be 0 . |
The Least Significant Byte of the current limit that is advertised during the USB enumeration phase. This field is in milliamps and can be in the range [0, 500]
.
Values outside of this range will be rejected with a Negative Command Acknowledgement.
The Most Significant Byte of the current limit that is advertised during the USB enumeration phase. This field is in milliamps and can be in the range [0, 500]
.
Values outside of this range will be rejected with a Negative Command Acknowledgement.
Bits | Direction | Meaning |
---|---|---|
T |
OUT | Whether to update the ‘test for dedicated charger’ flag (see Notes, below); 1 to update it, 0 to leave it alone. For IN Reports this will always be 0 . |
C |
OUT | Whether to update the assumed current limit for dedicated chargers (see Notes, below); 1 to update it, 0 to leave it alone. For IN Reports this will always be 0 . |
t |
IN / OUT | Whether or not the device performs a test at power-on to see if it is connected to a dedicated charger or a Host; 1 to enable the test, 0 to disable it. |
The Least Significant Byte of the assumed current limit for a dedicated charger. This field is in milliamps and can be in the range [0, 1500]
. Values
outside of this range will be rejected with a Negative Command Acknowledgement.
The Most Significant Byte of the assumed current limit for a dedicated charger. This field is in milliamps and can be in the range [0, 1500]
. Values
outside of this range will be rejected with a Negative Command Acknowledgement.
Current limits should not be changed during normal operation and should be treated as part of the configuration tasks for a given setup, preferably without any external circuitry attached (or at least held in a benign reset state). This is because the values presented on any header pins that have been configured for current limit assertions will change when there is a USB event so they may enter a state that causes the attached device to draw more current than it has enumerated with the Host. The enumerated current limit also cannot be changed without re-enumeration, but will be lost unless the Host issues a Store Current Configuration command.
There are several modes that the device can be in that affect its available power - note that ‘Enumerated’ here is used in the sense that a Set_Configuration
command has been issued (technically in an enumerated and configured state):
Enumerated | Connected To | Cables | Limit | Description |
---|---|---|---|---|
No | Host | A-C, C-C | 100mA | A Host that has not enumerated, or attempted enumemration but did not complete (ie. perhaps could not supply the requested current or bandwidth). |
Yes | Host | A-C | Up to 500mA | A Host providing power through a default USB2.0 cable can draw up to 500mA if the descriptors requested it and the Host completed enumeration. |
Yes | Host | C-C | Up to 1.5A | A Host providing power through a USB Type-C cable can advertise current up to 3A without power negotiation, but this device is built for a 1.2A-1.8A current limit, nominal 1.5A. |
No | Charger | ?-C | Up to 1.5A | A dedicated charger (or charging port) can supply a little or a lot. See the notes below. |
Yes | Charger | ?-C | Up to 500mA | A nonsense condition - dedicated chargers do not have data connections, so this smells like a firmware bug or some other craziness. Good luck… |
Decoding the (typically manufacturer-specific) resistances to calculate the charger’s current limit is complicated, and full USB PD negotiation is even more so. Some devices that utilise chargers just try drawing whatever amount of current that they specified for their bundled power supply adapter, or even just whatever they think they can get away with. This ad-hoc state of affairs has arisen because charging solutions weren’t part of the original USB specifications so manufacturers have invented their own solutions.
The approach that this device takes towards dedicated chargers is:
Note the assumptions - this is why the dedicated charger test is off by default, so that we can fall back to the worst-case 100mA limits in unknown situations. If you are happy to work with the assumptions above then you can enable the (rather crude) power-on charger test and set limiting values appropriate to your setup, but keep in mind that it is an ad-hoc solution and you are working outside of any guaranteed specifications. Most of the time you should be able to ‘get away with it’…
The device exposes various USB module flags for external circuitry to utilise. See the Pin Configuration page for the GPIO header interface and the USB Interface Bank page for an I2C register bank.