Hi, I am working on imx6sx m4 USB host function to try to connect with a CDC class device. By now I can see my project can attach the device successfully. But I didn't see the port change interrupt occur when I plug-out the device.
Below is what I've done to initialize the USB PHY.
/*Regulator*/
Solved! Go to Solution.
Hi,
You could take a look to “ENHOSTDISCONDETECT bit” and/or “Host disconnect detector: DISCONADJ” of application note AN4589 “Configuring USB on i.MX 6 Series Processors”, available at the following link:
http://www.nxp.com/assets/documents/data/en/application-notes/AN4589.pdf
Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Finally I realized that the “ENHOSTDISCONDETECT bit” should be cleared in case of SUSPEND happened as mentioned in the application note. After clear this bit, the device can work well the next time when plugging in.
Is there any reference code for the USB PHY initialization?
Anyone can help on this issue, or where can I get the reference code to initialize the USB host on imx6sx m4 properly?
Hi,
You could take a look to “ENHOSTDISCONDETECT bit” and/or “Host disconnect detector: DISCONADJ” of application note AN4589 “Configuring USB on i.MX 6 Series Processors”, available at the following link:
http://www.nxp.com/assets/documents/data/en/application-notes/AN4589.pdf
Hope this will be useful for you.
Best regards!
/Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Carlos,
Thanks for your help!
The host can detect the disconnection event with the USBPHY_CTRL_ENHOSTDISCONDETECT_MASK bit setting to 1 in USB_PHY_CTRL. There are port change interrupts whenever I plug out or plug in the device. But the host can NOT finish the enumeration when I re-plugin the device.
I found some differences for USB_nPORTSC1 register among plug in, plug out and re-plugin. Below is the value of USB_nPORTSC1 which is logging from the beginning of USB_HostEhciPortChange().
1) Plug in. This is the first time to plug in the device. It can get enumerated successfully and work as expected.
USB_nPORTSC1 : 0x10001803
USB_nPORTSC1 : 0x1c001002
USB_nPORTSC1 : 0x18001205
2) Plug out. The port change interrupt occurs.
USB_nPORTSC1 : 0x1c00100a
USB_nPORTSC1 : 0x1c001008
3) Re-plugin. This time the value of USB_nPORTSC1 differs from the one when plugging in in step 1. And the host failed to finish the enumeration.
USB_nPORTSC1: 0x1000180b
USB_nPORTSC1: 0x1c00100a
USB_nPORTSC1: 0x1000180b
Is there anything I am missing when re-plugin the device? Any help would be appreciated:)
Is there any clue on the value of USB_nPORTSC1? Anyone can help me on this issue?