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 126.96.36.199 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?