Chibios-master/ testhal/Stm32f30x/USB-CDC not working

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

Moderator: RoccoMarco

Post Reply
manish2789
Posts: 1
Joined: Wed Jun 04, 2014 8:48 am

Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by manish2789 »

Hello I am Manish Baing just started to learn ChibiOS .I am working on virtual COM port for STm32f3 discovery under linux platform using arm-none-eabi toolchain.I have tried ST-USB library ,compiled it but /dev/ttyACM0 device not generated .I have compiled Chibios project on the path chibios-master/testhal/STM32F30x/USB_CDC I suceesfully loaded the code into STM32f3 and red led blinks after few seconds.But /dev/ttyACM0 device not created .so what all things I need to change in above project..? or please give link of virtual com port for USB CDC with chibios for stm32f3 dicovery verified code.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by Giovanni »

Not sure, it works here but I am testing on Win7, probably it is something related to your Linux setup.

Giovanni
lesto
Posts: 55
Joined: Thu May 22, 2014 11:27 am

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by lesto »

i'm on arch linux wth latest 3.14 kernel and everything work just fine.
Stupid question: did you connected the "user" USB port? What if you step into code? what lsusb and dmesg say?

here the code i use (please note sensor may not work due misconfgured register, solved yesterday but forgot to pull): https://github.com/MauroMombelli/testChibiOsStm32F3
User avatar
alex31
Posts: 445
Joined: Fri May 25, 2012 10:23 am
Has thanked: 57 times
Been thanked: 88 times

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by alex31 »

does sudo lsusb shows the device ?

on my box :

>sudo lsusb
.
.
ID 0483:5740 STMicroelectronics STM32F407
.
.
.
User avatar
Vic20
Posts: 15
Joined: Fri Apr 25, 2014 7:45 pm

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by Vic20 »

USB-CDC works ok for me using the STM32F3 Discovery board.

I used it succesfully on the F3 Gizmo
http://r6500.blogspot.com.es/2014/04/presenting-f3-gizmo.html

You can check my code if you please at GitHub:
https://github.com/R6500/STM32F3_Gizmo

This is not directly the test-hal program but it should be similar.

I have just connected the Gizmo to a Linux computer and it works ok using screen on ttyACM0

In any case running the the CDC is sometimes tricky.

When developing with the debugger I usually disconnect the USB cable and connect it only when the program has started.
If the cable is connected when the program starts sometimes I have USB initialization problems.

If the board is connected out using the CDC connection (before the develompement phase) I usually get no problem.

Best regards

Vicente
lesto
Posts: 55
Joined: Thu May 22, 2014 11:27 am

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by lesto »

@vincente, try with a usb_disconnect, a delay of some second(s), and then the code to connect. That shoud solve the board reset issue.
User avatar
Vic20
Posts: 15
Joined: Fri Apr 25, 2014 7:45 pm

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by Vic20 »

Thank's lesto.

I used to use the disconnect and delay method but was only one or two seconds and I could not get a reliable enough start on the STM32F4 Discovery board. On the other hand, the STM32F3 Discovery seems to be more reliable restarting the USB CDC while debugging.
I would try again with longer delays to see if it helps.

Another problem I face debugging while using USB-CDC is that every time you restart you need to open a new connection with the serial terminal. It's quite a pain as I need to close the connection, restart the program and open again from the terminal.

That's why when developing for serial communication I use a normal TTL serial channel and a FTDI cable that keeps the connection open between restarts. That makes the debugging easier.

Best regards

Vicente
lesto
Posts: 55
Joined: Thu May 22, 2014 11:27 am

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by lesto »

and if you keep the tty* (or COM*) open it will spawn with the next free number.. i think that this cannot be easily done, if you are not a "usb driver insider".

sorry you should usbDisconnectBus() and usbStop(),if that still does not work i have no idea
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by Giovanni »

If I remember well the F3 discovery has no control on the pullup so connect/disconnect have no effect.

Giovanni
lesto
Posts: 55
Joined: Thu May 22, 2014 11:27 am

Re: Chibios-master/ testhal/Stm32f30x/USB-CDC not working

Post by lesto »

F3 after resetseems fine, F4 is the problem, maybe on them it has effect
Post Reply