Page 1 of 1

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

Posted: Wed Jun 04, 2014 9:19 am
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.

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

Posted: Wed Jun 04, 2014 9:23 am
by Giovanni
Not sure, it works here but I am testing on Win7, probably it is something related to your Linux setup.

Giovanni

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

Posted: Wed Jun 04, 2014 10:04 am
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

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

Posted: Wed Jun 04, 2014 10:09 am
by alex31
does sudo lsusb shows the device ?

on my box :

>sudo lsusb
.
.
ID 0483:5740 STMicroelectronics STM32F407
.
.
.

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

Posted: Wed Jun 04, 2014 4:53 pm
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

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

Posted: Wed Jun 04, 2014 5:17 pm
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.

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

Posted: Wed Jun 04, 2014 8:06 pm
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

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

Posted: Wed Jun 04, 2014 8:56 pm
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

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

Posted: Wed Jun 04, 2014 9:00 pm
by Giovanni
If I remember well the F3 discovery has no control on the pullup so connect/disconnect have no effect.

Giovanni

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

Posted: Wed Jun 04, 2014 11:34 pm
by lesto
F3 after resetseems fine, F4 is the problem, maybe on them it has effect