USB CDC

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

Moderators: barthess, RoccoMarco

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

USB CDC

Postby jomik » Thu Jul 02, 2020 4:58 pm

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: 13020
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 748 times
Been thanked: 621 times
Contact:

Re: USB CDC

Postby Giovanni » Fri Jul 03, 2020 6:11 am

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: 334
Joined: Sat Jul 19, 2014 12:59 pm
Been thanked: 9 times

Re: USB CDC

Postby rew » Wed Jul 08, 2020 5:24 pm

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. :-)


Return to “STM32 Support”

Who is online

Users browsing this forum: No registered users and 4 guests