USB-CDC link problem

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

Moderator: RoccoMarco

Post Reply
ruddy.rudeman
Posts: 3
Joined: Fri Nov 29, 2013 8:47 am

USB-CDC link problem

Post by ruddy.rudeman »

Hello. I am trying to get serial usb working. I start with opening ARMCM4-STM32F407-DISCOVERY demo Keil project (chibios version 2.6.1). It compiles with no problem.
Then in halconf.h

Code: Select all

#define HAL_USE_SERIAL_USB          TRUE
#define HAL_USE_USB          TRUE

and in mcuconf.h

Code: Select all

#define STM32_USB_USE_OTG1                  TRUE

Now the compiler can't find usb_lld.h, so I add the path to it in C/C++ tab: "..\..\..\os\hal\platforms\STM32\OTGv1"
After this it compiles, but linker throws some errors:

Code: Select all

linking...
.\obj\ch.axf: Error: L6218E: Undefined symbol sduInit (referred from hal.o).
.\obj\ch.axf: Error: L6218E: Undefined symbol usbInit (referred from hal.o).
Not enough information to list image symbols.
Finished: 1 information, 0 warning and 2 error messages.
".\obj\ch.axf" - 2 Error(s), 0 Warning(s).
Target not created

Tried some more ways to overcome it, with no success. Lot of people write that serial usb is working for them right out of box with no trouble. So what could I do wrong and what should I do to fix it?
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB-CDC link problem

Post by Giovanni »

Hi,

You need to enable the high level drivers in halconf.h.

Giovanni
ruddy.rudeman
Posts: 3
Joined: Fri Nov 29, 2013 8:47 am

Re: USB-CDC link problem

Post by ruddy.rudeman »

Yeah, I did this. Both USB and SERIAL_USB is enabled
Then in halconf.h
#define HAL_USE_SERIAL_USB TRUE
#define HAL_USE_USB TRUE
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: USB-CDC link problem

Post by Giovanni »

Hi,

Are usb.c and serial_usb.c included in the project?

Note that there is a Keil-related problem with USB, a fix is planned for next week: viewtopic.php?f=16&t=1468

Giovanni
ruddy.rudeman
Posts: 3
Joined: Fri Nov 29, 2013 8:47 am

Re: USB-CDC link problem

Post by ruddy.rudeman »

Yes, that was the reason. I added usb.c, serial_usb.c and also had to add usb_lld.c from os/hal/platforms/STM32/OTGv1/ and now it works fine.
That was the fastest support I ever got, thanks a lot!
Post Reply