AnsweredAssumed Answered

With FRDM KL46Z, how to turn off outputs when USB becomes disconnected?

Question asked by Hillbilly Injunear on Nov 5, 2013
Latest reply on Nov 8, 2013 by Hillbilly Injunear

I have an Android tablet connected via USB to a FRDM KL46Z. How do I determine in the KL46Z when it loses the USB connection? I want to turn all outputs off at that point.

 

I tried using the USB1_OnError method in the Events.c file. I put an “extern” variable in a header file and I set the variable in the USB1_OnError method. I can then read the variable in my ProcessorExpert.c file and turn off the outputs accordingly, BUT, I don't know under what conditions USB1_OnError is called by the internal MCU programming. It does not appear to be called when the USB cable is disconnected.

 

When the USB cable is unplugged, my MCU program appears to hang. I don't know if an error is being generated at that point, or if the program is just waiting for a read or write function to complete.

 

Does anyone have any suggestions about how I can turn off the outputs when the USB cable is disconnected, or when there are any other USB disconnect issues?

 

If not, where I might find find the answers to these questions?

 

I am using the Processor Expert USB component in CW 10.5.

 

Thank you for you kind assistance.

Outcomes