USB Charge Source Detection w/ nRF52840

I was hoping someone could clarify what support the nRF52840 has for USB power source detection. Our design uses a 150mAh LiPo battery, with a dedicated PMIC. We have the capability to set the charge current to 100mA, 150mA, or off. From what I've gathered from this Maxim USB charging brief, we can draw 100mAh after we enumerate, and draw up to 1.5A if we confirm the charging device is a dumb charger (data lines shorted together). To be completely compliant, it's necessary to support USB suspend mode, which has a max draw of 2.5mA.

Alternatively, a safe non-compliant method would be just to limit the current to 100mA forever, ignoring the suspend mode

Can this state detection be accomplished in software? How about detecting the shorted data lines, indicating a 1.5A USB charger? We don't have the option to add external USB power detection hardware.

Thanks for your time.

  • Hi, I forwarded this question to the HW designers. I will come back with an answer later.

  • Answer from HW engineers:

    The USBD is USB 2.0 compliant, but does not have built-in support for the Battery Charging Specification rev 1.1. This implies that if it's connected to a Charging Downstream Port (CDP) or a Dedicated Charging Port (DCP), it will not recognize them as such. It might be possible to implement power source detection under software control, but this is not tested.

    It could be possible to use the USBRESET event to decide whether the device is connected to dumb charger or not. When connected to a SDP or CDP, a USBRESET event should be generated within a certain time after USBPULLUP is enabled. But when connected to a dumb charger (DCP), it is not possible to have the USBRESET event, since it requires both D+ and D- to be pulled low for a specified amount of time. The dumb charger does not have any pull-down resistors on the data lines, and with the pull-up resistor on D+ enabled from the nRF52840 side, it is not possible for D+ to go low. (I believe there are some dumb chargers that do not have D+ and D- shorted together. In that case D- will float, but the reset state still cannot occur because D+ is pulled high by the resistor.)