Minimal USB event detection

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Minimal USB event detection

1,121件の閲覧回数
ryanlush
Contributor IV

I have a bootloader and application running on a K20. When the processor boots it initializes the USB peripheral as a CDC bulk device and then waits 1500ms to see if it enumerates. If it doesn't enumerate I set a flag to boot the application and forget all about USB until the user cycles power.

This worked great until we buried the device in a vehicles engine compartment and connected it directly to the battery. Now its not so easy to cycle power.

So I'm looking for a minimal way to sense the bus is active from the application and reset the processor. I had hoped that I could...

enable the USB clock in the SCG

enable USB interrupts in the NVIC

enable USB in the USB0_CTL

enable the AVBUSEN interrupt in the USB0_OTGICR

and reset the processor in the ISR. However, I'm not getting any interrupts.

Am I on the right path? Is there a better way to do this? The goal here is to either fix it in software or come up with a good argument for a new board revision. I really think this is doable in software without setting up the USB peripheral as a bulk device

0 件の賞賛
返信
2 返答(返信)

981件の閲覧回数
bobpaddock
Senior Contributor III

Try using the Start of Frame IRQ bit to check for an active connection.

0 件の賞賛
返信

981件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

First of all, sorry for the later reply.

If K20 as USB CDC device will be always connected to PC or not?

How to check if the USB device enumerated successfully or not, which need to check the USB stack state.

If just to check if the USB device attached to PC, customer can use the USB module interrupt.

Thank you for the attention.


Have a great day,
Ma Hui

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

0 件の賞賛
返信