USB CDC Virtual Com TX lockup

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

USB CDC Virtual Com TX lockup

1,412 Views
guitardenver1
Contributor I

I have an MCUExpresso project and a FRDM K22 board. I have the virtual comm demo running. I edited the virtual_com app to send a full 32 byte packet as fast as possible. 

 

I tried to edit the demo as little as possible and all changes are in the virtual_com.c file. Once the character 'g' is received from the PC, the sending starts. It sends a packet, then waits for a transmit complete flag to be set in the "kUSB_DeviceCdcEventSendResponse" send complete interrupt callback. Once the flag is set, it send another packet and repeats. RealTerm  gets around 679000 characters before all comms stop.

 

The "kUSB_DeviceCdcEventSendResponse" callback is never called again. The g_txComplete flag is false and the callback is never called to set it true again. It's like the USB stack missed something. 

 

I am using RealTerm to capture the serial data. Why is this locking up? I have the project attached.

 

Thanks

0 Kudos
Reply
1 Reply

955 Views
mjbcswitzerland
Specialist V

Hi Matthew

I can't help with the example project in the MCUXpresso package but if you continue having problems you can consider the uTasker USB stack which works on all Kinetis parts. I have attached a binary that you can check on your FRDM-K22F board where I have enabled 3 x CDC interfaces. This means that if you load it to your board it will enumerate as 3 virtual COMs whereby you can connect any of them (one, two or three) to three TeraTerm/RealTerm etc. instances. On the first VCOM interface there is a command line interface (if you hit the enter key) or else it is on the OpenSDA's VCOM port too.

Go into the USB menu (menu 6) and it will show some options:

    USB menu
===================
up           go to main menu
usb_errors   Show USB errors
usb_cnt_rst  Reset USB counters
usb-serial   RS232<->USB mode (disconnect to quit)
usb-load     USB-SW download
usb-tx       Test tx speed (send 10MByte data)
help         Display menu specific help
quit         Leave command mode

If you choose "usb-tx" it will send 10MBytes of data to all of the attached USB-CDC interfaces in parallel (one can attach 1, 2 or 3 VCOMs)

I have also attached an Ellisys analyser recording (the viewer can be downloaded freely on the Ellisys web site) which shows that it achieves maximum throughput (that is, zero NAK operation) on all bulk IN endpoints (showing a case where it is transmitting to 3 VCOM interfaces).
You will also see that it is bullet-proof - it is an industrially proven stack which is used in many products with no issues since 2012 - and also in Coldfire devices (almost identical USB controller) since 2008.

You can also use the "usb-serial" mode if you want to experiment too since it will then do bidirectional USB-UART bridges on up to three VCOM-UARTs; the first USB-CDC interface is paired with the OpenSDA interface VCOM UART. It includes end-to-end flow control and Baud rate control so is also a complete solution for such things.

Don't get worried if you are only allowed to use free firmware because this functionality is also included in the free open source version, as is complete Kinetis USB controller simulation in Visual Studio for making and testing your own modifications in a highly efficient environment. One can configure for 1 to 6 USB-CDC composite interfaces and/or mix with various other classes (HID, MSD, Audio etc.) and also with RNDIS.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Kinetis K22:
- http://www.utasker.com/kinetis/FRDM-K22F.html
- http://www.utasker.com/kinetis/TWR-K22F120M.html
- http://www.utasker.com/kinetis/BLAZE_K22.html

USB User's Guide: http://www.utasker.com/docs/uTasker/USB_User_Guide.PDF
Demos and simulation Guide: http://www.utasker.com/docs/uTasker/uTaskerV1.3_USB_Demo.PDF
USB composites: http://www.utasker.com/kinetis/USB_Device.html
USB-CDC host<->device video: https://www.youtube.com/watch?v=XhISV1czIo4&list=PLWKlVb_MqDQFZAulrUywU30v869JBYi9Q&index=16

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
Build with: CW10.x, KDS, MCUXpresso, IAR, Keil, Greenhills, Crossworks, CooCox, Atollic, S32 Design Studio, GNU Make and Visual Studio

Professional Kinetis support, one-on-one training and complete fast-track project solutions: http://www.utasker.com/support.html

0 Kudos
Reply