AnsweredAssumed Answered

USB k20_100: no TOKENDNE interrupt. Please help.

Question asked by Yuriy Shevyrov on Feb 2, 2014

I try to build my small home 3d printer, PCB is fully handmade and I use gentoo linux + manually built gnu toolchain + openocd for debugging. (JTAG debugger also is homemade based on FT2232D)

So everything is good and works, but I can't launch USB. I try to utilize USB Stack v 4.1.1. and started from "virtual com" and "printer" examples.

 

The problem is usb is not enumerated by host. (output is below). While it seems all works. USB initialization finishes well, no hangs or something suspicious.

By debugging USB_ISR I found that first SETUP packet (request for device descriptor) doesn't happen. (I see Reset and then Sleep interrupts when plug a cable).

The error can be very simple and stupid...

Appreciate any ideas, ( some subtle bit in some register... anything what should be tuned for the controller). I noticed k20_100 is not on the list of supported controllers (while download the USB stack) but there are neighbor K40_100, K20_72.

 

Additional information and things I've checked:

Exact controller model: MK20DN512VLK10

8 MHZ crystall oscillator, 96 MHz of PLL.

Divided by 2 frequency for USB.

External power supply. I connected USB 5V to VREGIN according to documentation.

Since I'm unable to run examples in "native" environment I just built them with CMake, guessing macro definitions and removing GPIO parts with LEDs.

I use only one interrupt 89 (IRQ 73). Are there any others needed ?

 

output from >cat /proc/kmsg

 

<7>[346621.468490] hub 2-1:1.0: state 7 ports 8 chg 0000 evt 0020

<7>[346621.468686] hub 2-1:1.0: port 5, status 0101, change 0001, 12 Mb/s

<7>[346621.572203] hub 2-1:1.0: debounce: port 5: total 100ms stable 100ms status 0x101

<7>[346621.583063] hub 2-1:1.0: port 5 not reset yet, waiting 10ms

<6>[346621.645204] usb 2-1.5: new full-speed USB device number 109 using ehci-pci

<7>[346621.657255] hub 2-1:1.0: port 5 not reset yet, waiting 10ms

<3>[346621.719205] usb 2-1.5: device descriptor read/64, error -32

<3>[346621.883202] usb 2-1.5: device descriptor read/64, error -32

<7>[346621.995199] hub 2-1:1.0: port 5 not reset yet, waiting 10ms

<6>[346622.057201] usb 2-1.5: new full-speed USB device number 110 using ehci-pci

<3>[346622.120204] usb 2-1.5: device descriptor read/64, error -32

<3>[346622.284204] usb 2-1.5: device descriptor read/64, error -32

<7>[346622.396203] hub 2-1:1.0: port 5 not reset yet, waiting 10ms

<6>[346622.458175] usb 2-1.5: new full-speed USB device number 111 using ehci-pci

<3>[346622.860054] usb 2-1.5: device not accepting address 111, error -32

<7>[346622.871192] hub 2-1:1.0: port 5 not reset yet, waiting 10ms

<6>[346622.933188] usb 2-1.5: new full-speed USB device number 112 using ehci-pci

<3>[346623.335161] usb 2-1.5: device not accepting address 112, error -32

<3>[346623.335342] hub 2-1:1.0: unable to enumerate USB device on port 5

Outcomes