Page 1 of 1

USB CDC

Posted: Thu Jul 02, 2020 4:58 pm
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!

Re: USB CDC

Posted: Fri Jul 03, 2020 6:11 am
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

Re: USB CDC

Posted: Wed Jul 08, 2020 5:24 pm
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. :-)