According to "i.MX 6SoloLite Applications Processor Reference Manual, Rev. 3, 09/2017" it is possible to detect when i.MX6 is connected to USB host. I am referring to section "52.2.4.5 USB Plugged-In Detector" and "52.2.7.2 Data pin contact detector.
On my i.MX6 I have enabled "Data pin contact detector" mode in register USB_ANALOG_USB1_CHRG_DETECTn by setting:
EN_B = 0
CHK_CHRG_B = 1
CHK_CONTACT = 1
But I do not observe any difference while my board is plugged to power bank or USB host. USB_ANALOG_USB1_CHRG_DETECT_STAT value is the same for both cases. Moreover, when connected to PC only PLUG_CONTACT bit is set to 1, but I would expect that DP_STATE and DM_STATE are also set.
Please see log below when i.MX6 is connected either to PC or power bank:
root@imx6:~# ./app 0x20C81B0 <-- USB1_CHRG_DETECT register.
:0x020c81b0 =0x000c0000 <-- EN_B = 0, CHK_CHRG_B = 1, CHK_CONTACT = 1
root@imx6:~# ./app 0x20C81D0 <-- USB1_CHRG_DETECT_STAT register
:0x020c81d0 =0x00000001 <-- DP_STATE = 0, DM_STATE = 0, CHRG_DETECTED = 0, PLUG_CONTACT = 1
Solved! Go to Solution.
Hi Ros
for usb charger detection examples one can look at linux drivers on
usbmisc_imx.c\chipidea\usb\drivers - linux-imx - i.MX Linux kernel
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Ros
for usb charger detection examples one can look at linux drivers on
usbmisc_imx.c\chipidea\usb\drivers - linux-imx - i.MX Linux kernel
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------