I am trying to get my microncontroller to enumerate as CDC class device (virtual com port).
Device enumeration fails, debugging the USB signals with an analyzer revealed that the handshake packet of the GET_DESCRIPTOR Setup Transaction is not sent.
I get RESET, SLEEP, and SOF Interrupts correctly, but no TOKDNE. Things I checked are:
- endpoint 0 configuration register (gets set by software, seems correct)
- clock: 48MHZ on USB_CLKIN pin (crystal is an Abracon ASDMB-48.000MHZ-LC-T)
- USBPLL is bypassed (external)
- USB Voltage regulator is enabled (VREGIN connected to 3.3V, can measure 3.3V on VOUT33)
If I understand the documentation correctly, the TOKDNE should be generated after the handshake packet has been sent back to the host, which suggests some kind of configuration error.
Following things come to mind as a problem, but I don't know how to check them:
- USB clock not stable enough
- transceiver hardware broken
- hardware bug, commenting out source code lines related to http://cache.freescale.com/files/microcontrollers/doc/errata/KINETIS_3N96B.pdf didn't have any effect though
device: MK60FX512(3N96B)
board: custom
Edit: connecting the 48 MHz Clock source to EXTAL1 and using the PLL1 to generate 96MHz, with USB clock divider set to 2 (selected USB Divider output for Module clock) did not help either
Dear Martin,
We have an issue with a Kinetis K60DN512 (no floating point co-processor) USB. it seems to be only processing packets every 10ms, when they arrive every ms. we don't have solution yet, however we are wathcing your progress. Have you had any success with your USB problem yet ?
Bryan
Hi Martin,
I had the exact same problem (or at least the same symptoms) with a K20. It turned out that the USB controller could not access the memory where BDT and buffers are stored. There is an MPU (memory protection unit) that is enabled by default. When I disabled MPU (MPU_CESR = 0), I immediately got the TOKDNE interrupts.
Hope this info helps.
-- Vladimir
Hi Vladimir,
Very good point!
Indeed, the MPU settings were restricting the USB controller from accessing the relevant memory. I did not get a fault though. I will try again with MPU deactivated, and see wether it makes a difference.
Thanks,
Martin
Hi Martin,
Could you please tell me which demo did you run? Then I will test with relate board.
I'm looking forward to your reply.
Have a nice day!
Ping
Hi,
got the same Problem described. Also using the 4.1.1 stack. The board I use is the TWR-K60F120 module combined with the TWR-SER. I also get a SOF but no token done interrupt. I also deactivated the MPU as Vladimir described. Using the CDC stack from mcuoneclipse works, by the way. Is there some more initialization to do which is not described in the example? Something I could have forgotten?
Thank you!
Hi Christian,
I've not found the TWR-K60F120 board released in Freescale USB Stack Hardware Configuration document.
So I guess the K60 demo in USB stack v4.1.1 is not appropriate for TWR-K60F120, however it works fine both with TWR-K60N512 and TWR-K60D100M board.
Have a great day!
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hey Jeremy,
I tried two things with the Freescale Stack:
Neither of the two ways worked. I always stuck ofter the SOF interrupt, with the endpoint 0 initialized, waiting for the token done interrupt, which never comes (for some reason).
If you have a working example for TWR-K60F120 I would be really pleased to find the different.
Thank you very much in advance,
Christian
Hi Christian,
I've run the USB_CDC_DEVICSE_K60F_PEx demo on TWR-K60F120 board and TWR-SER, TWR-ELEV(Fig 1). it enumerates successful(Fig 2).
I've also used the Hyterterm communicate with the board, it still works fine too.
Fig 1
Fig 2
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hey Jeremy,
thank you for trying out! Which Compiler do you use (GCC/Keil?) and which version of the stack/PEx? It would be very helpful if you could sent me your code/project/PEx-project for comparison.
Thank you very much, once again,
Christian
Hi Christian,
I ran the USB_CDC_DEVICSE_K60F_PEx demo in USB Stack V 4.1.1 by CW 10.6, and you can download the USB Stack through the link below.
If you have any further questions about it, please feel free to contact with me.
USB Stack|Freescale
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Just want to let you know. If you use the processor expert generated USB CDC stack with Keil or ARM GCC it does not work because there is an error in the usb_devapi.h:
it still uses #pragma options align=reset which is not supported by by the two compilers. This results in two different memory alignments in two source files and the whole thing does not work. The stack from mcuoneclipse.com corrects this mistake, so just have a look there for more informations.
Hi Christian,
Thanks for your information, I will check it later.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Christian,
I'd like to run the CDC demo on TWR-K60F120 board with the TWR-SER later,
Actually, I've not encountered this issue before, I'll inform you while I get the result.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
no demo, that is a custom board with custom software.
Hi Martin,
I‘d like to suggest that you should figure out the difference of the hardware design between the custom boare and FSL tower board at first,
then modify the CDC demo in USB stack 4.1.1 to fit the custom board and run the CDC demo with this board.
Lastly, use USB analyser to check the device enumeration whether succeed or not.
Hope this advice help.
Have a great day,
Ping
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------