USB host troubles: K60f with custom board

Discussion created by djhoop on May 24, 2013
Latest reply on Aug 4, 2013 by djhoop

Hi all,

I don't tend to ask questions in forums since typically somebody else has had a similar problem and searching can get me close enough to solve my issue. Thus, I post here as an act of desperation. That said, here's the problem:

I have a custom board with MK60FN1M0LQ12 that I would like to use as a USB host. On the board is a permanent Texas Instruments TUSB2046B USB hub (datasheet) with its DP0/DM0 connected to USB0_DP (pin 19) and USB0_DM (pin 20). The TUSB2046B's reset pin (active low) is connected to PTA19 (pin 73). I'm using Codewarrior 10.3 (or 10.4, I have both) with PEx.  The TI chip is a full-speed hub. Naturally, I would like to connect up to 4 devices through the hub, run the appropriate enumeration, and leverage the devices as CDC components. Also, as a side note, I have a 32 mHz crystal connected to pins 45 and 46 (System Oscillator 1 in the PEx component).  If I ground then raise PTA19, I can watch the DP0 channel ground and raise also. If I understand correctly, this means that the hub is correctly announcing itself as a full speed device.

I have tried a few variants on getting the K60 to work as a host:

  1. First, I tried the Freescale USB Stack and running the CDC host demo with tweaks as necessary for my specific clock settings and processor configuration. I can watch the host initialize on debug, and it clears that just fine. However, it never detects an attachment, regardless of what I do to the registers or to the reset pin that outputs to the TUSB2046B. When checking connections, I can see the SOFs being sent (if forced).
  2. Next, I tried using the MQX USB CDC host. Basically the same story as with the bareboard USB stack, except I edited the bsp for the TWR-K60F120M for my configuration. It seems to correctly use the bsp code, the psp code, and the usbh code from MQX to initialize the host.  But again, no attach event.
  3. Lastly, I collected and, after some tweaks again to the processor settings and other variations for my hardware, used the code related to Erich Styger's blog article here.  In this code, I can see that when the second line of the USB_LDD init function is called, I immediately get an attach event (regardless of whether the USB_ISR is enabled). After allowing the attach event to proceed, it pushes the usb reset and the code ever clears past the USB reset to the wait.  I have commented this out and made it progress, but after it detects the hub as a full speed device, it doesn't grab the identifiers correctly.  Two things seem odd to me here: first is the immediate USB attach event when the init code hasn't completed, and second is the freeze up. It doesn't lock up everything, just the attachment and enumeration process. The poll loops still function, though I'm also getting a ton of calls to the USB_ISR.  I'm not sure if this is related, or part of the normal process.


Reading over other posts and through Erich's blog, I see things that indicate that clock settings may be a problem. I've looped through them numerous times and I'm pretty sure they're correct for my hardware.  Also, since I can't physically detach the hub from the K60, is there something I can do in the code to "force" the USB0 initialization aside from the hub? I have tried separately initializing the reset pin and holding that down until the PE_low_level_init completes to no avail.  I have a feeling that I'm just not finding the right knob to turn.