How to reset the USB peripheral on Coldfire MCF52254

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

How to reset the USB peripheral on Coldfire MCF52254

1,374 Views
ARQuattr
Contributor IV

We have a MCF52254-based board connected to a tablet OTG port, and generally it works fine, but we have been able to reproduce cases where the USB gets in a state that we can't recover from without perform a power cycle.  When in this state, the tablet (OTG) host can no longer connect to the MCF52254.

 

We tried restarting the task as well as deinitializing the USB stack (we are using the MQX USB device stack and CDC class), but this isn't sufficient.  We can see that when it is in this state, even unplugging the USB cable doesn't let it recover.  The peripheral on the MCU seems to be in state that we can't get out of by just restarting the stack.  Deinit on the stack appears as though it's supposed to reset the hardware but it doesn't seem to do that. 

 

We tried to reset the USB_EN bit (bit 0 of the CTL register, from 20.4.1.14 of the ref manual).  That did something as we weren't able to properly get the stack working again after doing it, but nevertheless, it still didn't cause the disconnection we are trying to achieve.

 

What registers or bits should I try to perform a hardware shut down of the USB peripheral?  Or is there some other MQX function that handles this for me?

 

Thanks,

Angelo

Labels (1)
Tags (3)
0 Kudos
Reply
2 Replies

1,084 Views
TomE
Specialist II

> We have a MCF52254-based board connected to a tablet OTG port

The MCF52254 also supports OTG mode. So in your use, which end is acting as the Host and which end is the Peripheral?

If the MCF52254 is acting as the Host, can you plug a keyboard, mouse or Memory Stick into it? Do these work when it is "locked up"?

If the MCF52254 is acting as the Peripheral, can you get any sense out of it from a Computer?

> What registers or bits should I try to perform a hardware shut down of the USB peripheral?

It doesn't seem to have a "reset everything" control bit. I'd suggest writing all  the writeable registers (out of the 43 or so there) back to the "Default Values" listed in the Reference manual, making sure you disable all interrupts.

The MQX Driver may be keeping some "internal state" that means it can't be initialized a second time. I don't know anything about MQX. I'd suggest reading the sources.

I'd suggest you search these forums for "USB" or "OTG", especially in the MQX "place":

https://community.freescale.com/message/435935#435935

Tom

1,084 Views
ARQuattr
Contributor IV

Thanks Tom, I think you are right about the registers - we'll try resetting more of them.  We'll also review that other thread you linked.

We are using the MCF52254 in peripheral (device) mode, and the tablet is in OTG mode.  When it is in this state, the host doesn't see it any more.

0 Kudos
Reply