Page 1 of 1

USB-CDC link problem

Posted: Fri Nov 29, 2013 9:05 am
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?

Re: USB-CDC link problem

Posted: Fri Nov 29, 2013 9:16 am
by Giovanni
Hi,

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

Giovanni

Re: USB-CDC link problem

Posted: Fri Nov 29, 2013 9:19 am
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

Re: USB-CDC link problem

Posted: Fri Nov 29, 2013 9:23 am
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

Re: USB-CDC link problem

Posted: Fri Nov 29, 2013 9:30 am
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!