I'm experimenting with native USB in STM32. I've not found any "step by step", or a little more well structured tutorial, how to implement CDC or mass storage for example. I've found some examples, but would be better some explanation too.

Could you recommend me some nice descriptions about these stuffs?

  • \$\begingroup\$ What's your MCU (exatly) and compiler and do you use any USB Stack? please provide us What have you found, so far? \$\endgroup\$
    – Roh
    Aug 9 '14 at 13:38
  • \$\begingroup\$ I'm using the STM32F3 discovery board, with STM32F303VCT6 uC. And I've found examples @ coocox's site for example. \$\endgroup\$
    – erbal
    Aug 9 '14 at 13:41
  • \$\begingroup\$ Your comment was not all things that I expected! look at my comment and answer me again. \$\endgroup\$
    – Roh
    Aug 9 '14 at 13:53
  • \$\begingroup\$ I am using the coide, with the standard arm none eabi gcc. And I haven't started to write any code, I'm just doing some research now. \$\endgroup\$
    – erbal
    Aug 9 '14 at 13:56
  • \$\begingroup\$ Ok, now it's better. Do you just want to use the USB or you want to know What's going on when you use it? are you a newbie in stm32, compeletly or you have some experience with it? \$\endgroup\$
    – Roh
    Aug 9 '14 at 14:13

Alright, at first, you have to know that we cannot to explain to you that how the USB works or how you can use it (because that's too broad) but we can give you some clue until yourself understand it.

This serial bus is organized in a star topology with host and device roles, host organizing the traffic.


Several device classes are specified, in order to ease communication in different application cases. you can see them here. they are:

  • OTG : On-The-Go: An OTG peripheral can switch host and device role on the fly
  • HUB : Defines what protocols to implement to build a hub application
  • MS : Mass storage: Protocols to interact with storage block devices (for files)
  • HID : Human interface device: Protocols for peripherals interacting with human body (mouse, keyboard, etc.)
  • CDC : Communication device class: Protocols for serial communications, different sub-classes define details, for instance ACM for a standard COM port, or ECM for modems
  • Printer : Defines what protocols to implement to build a printer application
  • Audio : Defines what protocols to implement to build an audio application (microphone, headset, etc.)
  • DFU : Device firmware upgrade: Protocols to implement firmware upgrade ability

For using the USB you can use some middleware stack. for example: CMX, EUROS, Express Logic, HCC, Keil/ARM, Micrium and etc

I just can see one of them that is free. take a look in this link and downlaod the ST USB stack (USB FS device library, USB FS&HS Host&Device lib, Continua USB certified stack). by this Stack and it's documentations, you can use it easily and if you want to know what's going on when you use it, you can see to the source and header files.

I hope this quick consultation will help you.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.