AnsweredAssumed Answered

Issue with USB host stack communicating to USB hub

Question asked by Travis Long on May 30, 2014
Latest reply on Jul 10, 2014 by Travis Long

I'm having some strange issues trying to get a k40 to talk to a USB hub controller on a custom board.  The K40 is a MK40DX256ZVLQ10 and the hub controller is a TI TUSB2046B.  The custom board is actually an option card for another family of devices that we make adding USB host capability to this older family of products that we make.  The board adds USB keyboard and USB mass storage capabilities only, and then communicates to the host device via SPI bus.  All of this works for a while, but at some point the k40 loses communication with the TUSB2046B hub contoller.  The hub contoller appears to go into suspend state when this happens and sending the USB resume command does not appear to help.  In fact, from the k40's perspective, everything appears to still be working.  I don't get any events notifying my app of the disconnect or suspend status other than an external pin on the usb hub controller.  The only way I can see when this is happening is when the hub goes into suspend or if I get an MQX error that I can write to a connected flash drive (file system error).  When I detect the error has happened, I first attempt to send the USB resume command using the MQX USB host API, but this never recovers the communication.  After attempting to send the resume command, I then attempt to do a hardware reset of just the TUSB2046B hub.  Resetting the hub controller works to recover from this issue about 20% of the time.  The only 100% sure way I've found to recover is to perform a software reset of the K40.


The drivers for the USB keyboard and MSD that I am using are from the MQX example projects provided with Codewarrior.  I am using Codewarrior 10.5 for this project, along with the latest version of MQX.  I have used an oscilloscope to monitor the communication between the k40 and usb hub and have not noticed anything unusual.  There is never a delay long enough to put the hub into suspend state and the keep alive packet arrives just under 1ms just like clockwork.  I've even gone as far as having my EE cut the traces between the k40 and the TUSB2046B and put a USB-A cable on it so I can plug it into my PC to try and eliminate the USB hub as the culprit.  When I do this, the hub acts just exactly as I would expect and never gets hung up as when the k40 is acting as the host controller.  So I'm pretty sure that I've narrowed this down to something in the MQX USB host stack, but I've yet to find exactly what is causing it.


I really need to find out what is causing this and resolve it because this project has gone to production and I would like to not use the software reset as a workaround to keep this system running.  Any advice or ideas about where to look for the problem, or any info that someone might have regarding similar issues would be very beneficial to me at this point.


Thank you in advance for any help you can give me.


Travis Long