Kinetis FS USB Data error

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

Kinetis FS USB Data error

378 Views
xxxajk
Contributor III

I've been having a USB "data error" supposedly caused by the USB module not being able to access RAM on incoming packets due to latency despite giving USB highest priority for DMA across several Kinetis microcontrollers.However this does not happen all the time. The first several tries of plug cycling work, then it all falls apart and will not operate afterwards, but only on devices that respond on USB very quickly. I set all the correct bits, and delay if there is not enough bit time. The problem becomes worse when a HUB is connected.

Data sheets are not clear on how to handle the "data error" exception, and simply states to retry the operation, which I can do forever and won't succeed after the first time it occurs, and the USB module somehow locks up and dies after a random amount of retries.

Some details:

I'm not using any of the freescale/nxp code libraries, see link below.

I'm not using any RTOS, it is all bare metal, using an ISR for everything, see link below.

My USB analyzer shows no problems with the packets.

There are no problems with my other supported USB chipsets, see link below.

Happens on K20, K22, K64, and MKL26Z64, which is not surprising since all use the same core IP for USB. No doubt it will fail on all that use this IP.

Would a fast (1us) IRQ on a flextimer be a possible culprit? (Yeah, I know I need to look myself, but....)

Would using the 1ms timer on the USB module (USB_OTGISTAT_ONEMSEC) cause the issue? Can't check this, my driver requires it to be running.

I've tried using the WFI instruction to make the MCU sleep, no success.

I've given USB DMA priority, no luck here either.

The actual Kinetis part of the code is located here: UHS30/UHS_KINETIS_FS_HOST_INLINE.h at master · felis/UHS30 · GitHub 

Any insights/answers/collaboration welcomed.

0 Kudos
0 Replies