i.MX6 USB host detection

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6 USB host detection

Jump to solution
991 Views
rspolyak
Contributor II

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

Labels (1)
0 Kudos
1 Solution
810 Views
igorpadykov
NXP Employee
NXP Employee

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 

https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/usb/gadget/imx_usb_charger.c?h=imx...

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
1 Reply
811 Views
igorpadykov
NXP Employee
NXP Employee

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 

https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/usb/gadget/imx_usb_charger.c?h=imx...

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos