USB CDC

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
jomik
Posts: 1
Joined: Tue Jun 30, 2020 8:15 pm

USB CDC

Post by jomik »

Hello. I have a STM32F746ZG nucleo board and I'm trying to set it up as a USB CDC device to recieve a datastream. I started with the USB_RAW test. It works when hooked to Windows: I can see the test data on the virtual com port, streaming at 38400 baud as expected. When connected to a Linux box it enumerates fine, but when I try to open the port it stops responding after a few bytes. Running dd to benchmark the stream works kindof: it never terminates and ctrl-c interrupt occasionally shows some number of bytes were received, sometimes no bytes, sometimes it hangs the terminal. Trying to write to the device gives the same result. I'm not sure where to start debugging this, if it is a Linux problem or if there is something missing in the usb configuration on the device.

I should mention that I also tried the serial-over-usb example and the story is the same: from Windows I can interact ok with the shell, on Linux it just craps out when I try to open the port. Also I'm using the same computer for both operating systems so I'm positive it's not a hardware issue.

Any suggestions appreciated!
User avatar
Giovanni
Site Admin
Posts: 14893
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: USB CDC

Post by Giovanni »

Hi,

That demo does not implement all CDC commands, the application you use probably send one of those, when an unhandled command is received the default reaction is to stop the USB. You need to implement the CDC commands you need, look at request_hook() in usbcfg.c, implemented commands are there, you may put a breakpoint and see which command is sent that is not recognized.

Giovanni
rew
Posts: 383
Joined: Sat Jul 19, 2014 12:59 pm
Has thanked: 2 times
Been thanked: 14 times

Re: USB CDC

Post by rew »

The USB_CDC demo also works on F746. I've been working with that one lately.

If the nucleo has the USB1 connected, then the demo by default uses USB2, so then you have to edit the file in portability to use USB1. Just a few lines of code to change. Easy: I was able to do it. :-)
Post Reply