Detecting a USB Disconnection imx1050

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

Detecting a USB Disconnection imx1050

971 Views
nick_j
Contributor III

Hello,

I am trying to detect when a USB is disconnected from my custom board using an imxRT1050. I have seen other forum posts that mention to use the USB_DEVICE_CONFIG_DETACH_ENABLE flag in the USB device config (https://community.nxp.com/t5/i-MX-RT/What-is-the-best-way-to-detect-attaching-and-detaching-of-an-us...).

Looking at the USB_1OTGSC register it does show that the BSVIE (B Session Valid Interrupt Enable) has been set, however the interrupt doesn't seem to trigger. I know this as I will get interrupts when I plug the USB in, but not get one when I pull it out. 

The only way I've managed to detect it is by polling the SUSP (Suspend) bit within the USB_1PORTSC1 register the tells me whether or not the connection is suspended. I should be able to get this to work. but I would rather use the dedicated disconnection interrupt as it doesn't involve polling the register.

Any ideas as to why the B Session End Interrupt may not be triggering?

Thanks,

Nick

Labels (2)
0 Kudos
Reply
3 Replies

925 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @nick_j ,

 

Do you mean you are using the USB stack from the latest SDK with the solution of https://community.nxp.com/t5/i-MX-RT/What-is-the-best-way-to-detect-attaching-and-detaching-of-an-us... , but it doesn't work? Please kindly clarify.

 

Best Regards,

Kan

0 Kudos
Reply

899 Views
nick_j
Contributor III

Hi Kan,

I'm not using the most recent SDK, but I definitely downloaded it after this post was made. I will try the latest however just in case.

What I'm expecting is that I will receive a USB interrupt when the USB is disconnected/unplugged once I have implemented the suggestion in the linked forum post. However this does not happen and I can't understand why as I am receiving interrupts for other USB events.

Thanks,

Nick

0 Kudos
Reply

889 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi @nick_j ,

 

There is wake up on disconnect event for this use case, please kindly refer to the following for details.

Kan_Li_0-1698989332605.png

You may refer to "42.4.3.2 Wake-Up Events" in https://www.nxp.com/webapp/Download?colCode=IMXRT1050RM for more details.

 

Have a great day,
Kan


-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos
Reply