Skip to main content
gw_it
Associate III
October 19, 2012
Question

Single Library for USB on all STM32 devices?

  • October 19, 2012
  • 7 replies
  • 1571 views
Posted on October 19, 2012 at 13:18

I'm developing some software for multiple STM32 devices. One of the features it needs is a USB Virtual COM port.

I've developed a version that works with USB VCP on the STM32F103 using this library:

stm32_usb-fs-device_lib.zip

And I expected that I could recompile it for STM32F4 devices (such as the F4 Discovery board) with a relatively minor set of changes. But it seems not?

It looks like I have to rewrite with the completely different library:

stm32_f105-07_f2_f4_usb-host-device_lib.zip

Is this the case, or is there a single library that presents a single API for using any USB-capable STM32 part as a simple USB device? (without the OTG support)

#stm32f103-vcp #stm32-usb-vcom-library-f1-f4
This topic has been closed for replies.

7 replies

Tesla DeLorean
Guru
October 19, 2012
Posted on October 19, 2012 at 17:32

Doesn't the 103 have a different USB hw implementation to all the other parts? Including the 105/107? The 103 is an orphan in this regard, I don't see a unification of the library at this juncture.

You could try asking third party stack vendors.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
emalund
Associate III
October 19, 2012
Posted on October 19, 2012 at 17:39

possibly an interesting project.

I have, on several occasions, been tasked with ''unification of code''.

you put a b8nch of 'if's' and 'elses' into the code where the processors diverge and after much sweat and a few ''debugging horrors'' end up with code that works everywhere.

Erik

gw_it
gw_itAuthor
Associate III
October 19, 2012
Posted on October 19, 2012 at 17:49

Thanks for the quick response...

So the STMF103 and STML1XX parts are pretty much on their own then as far as USB goes.

Do we know if all new devices are going to use the USB OTG Library mentioned above? is that likely to remain stable?

Tesla DeLorean
Guru
October 19, 2012
Posted on October 19, 2012 at 17:53

possibly an interesting project.

Or a very tedious one.

I think you'd need to find a common abstraction point, and separate the work the library is doing from the functionality you want to add. For a VCP this might be done with some ring buffers.

I just don't expect a cadres of ST coding ninjas to show up and fix it for free. Adjust your expectations accordingly.
Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
tsuneo
Associate II
October 20, 2012
Posted on October 20, 2012 at 10:18

> you'd need to find a common abstraction point

Keil has already done it for their RL-USB library

I believe you'll take more or less similar interface as Keil's.

MDK-ARM provides these source files for device-specific implementation.

Lite/evaluation versions ( http://www.keil.com/download/product/ ) also have these files.

STM32F103

C:\Keil\ARM\Boards\Keil\MCBSTM32\RL\USB\Device\HID\usbd_STM32F103.c

OTG-FS on STM32F4

C:\Keil\ARM\Boards\Keil\MCBSTM32F400\RL\USB\Device\HID\usbd_STM32F4xx_FS.c

OTG-HS on STM32F4

C:\Keil\ARM\Boards\Keil\MCBSTM32F400\RL\USB\Device\HID\usbd_STM32F4xx_HS.c

Take a loop on these files.

Tsuneo

root
Associate III
October 22, 2012
Posted on October 22, 2012 at 13:55

ST coding ninjas ? Looking at their USB stack and the way the periph lib is written :

0690X00000602mQQAQ.jpg

eldad
Visitor II
March 25, 2015
Posted on March 25, 2015 at 09:06

Hi,

I am searching for some code example how to communicate between my PC and STM32F103C8 developing board via the MINI USB socket as VCP, Can you advice where I can get this example ?

Eldad