R01UH0823EJ0100 Rev.1.00
Page 957 of 1823
Jul 31, 2019
RX23W Group
32. USB 2.0 Host/Function Module (USBc)
32.5
Battery Charging Detection Processing
It is possible to control the processing for data contact detection (D+ line contact check), primary detection (charger
detection), and secondary detection (charger verification), which are defined in the battery charging specification.
The following describes required operations for a function device and a host device, individually.
32.5.1
Processing When Function Controller is Selected
The following processing is required when operating the USB module as a portable device for battery charging.
(1) Detect when the data lines (D+ and D–) have made contact and start the processing for primary detection.
(2) After primary detection starts, wait 40 ms for masking, and then check the D– voltage level to confirm the primary
detection result.
(3) If the charger is detected during primary detection, also start secondary detection.
(4) After secondary detection starts, wait 40 ms for masking, and then check the D+ voltage level to confirm the
secondary detection result.
For step (1), after VBUS is detected using the VBIT interrupt and the VBSTS flag, wait for 300 to 900 ms by software,
and then set the VDPSRCE0 and IDMSINKE0 bits in the USBBCCTRL0 register to 1. Or set the IDPSRCE0 bit to 1,
and after a change from high to low on the D+ line is detected using the LNST[1:0] flags, set the IDPSRCE0 bit to 0 and
set the VDPSRCE0 and IDMSINKE0 bits to 1. Set the VDPSRCE0 and IDMSINKE0 bits to 0 at the same time.
For step (2), set the VDPSRCE0 and IDMSINKE0 bits to 1 and wait 40 ms by software, and then use the CHGDETSTS0
flag to verify the primary detection result.
For step (3), if the CHGDETSTS0 flag is set to 1 in step (2), verify that the charger is detected, and then set the
VDPSRCE0 and IDMSINKE0 bits to 0 and set the VDMSRCE0 and IDPSINKE0 bits to 1.
For step (4), set the VDMSRCE0 and IDPSINKE0 bits to 1 and wait for 40 ms by software, and then use the
PDDETSTS0 flag to verify the secondary detection result.
The following shows the process flow.
Note 1. The battery charging specification describes two implementation methods of the process flow for data contact
detection (D+/D– line contact check). One of the methods is to detect a change to logic low due to the pull-down
resistor of the host device when the D+ and D– lines have made contact with the target while the D+ line is held
at logic high by applying a current of 7 to 13 µA on the D+ line. The other method is to wait for 300 to 900 ms after
VBUS is detected.
Note 2. During primary detection, when the voltage on the D– line is detected to be 0.25 to 0.4 V or above and 0.8 to
2.0 V or below, the target device is recognized as the host device for battery charging (charging downstream
port). When using a PHY in which the CHGDETSTS0 flag only indicates that the voltage on the D– line is 0.25 to
0.4 V or above, add the processing to check that the voltage on D– line is 0.8 V to 2.0 V or below using the
LNST[1:0] flags, as necessary.