21.08.2019

Chibios Usb Cdc Example

Example for stm32f3 discovery board + ChibiOS implementing a composite usb device with CDC and MSD interfaces.

ChibiOS Homepage. Welcome to the ChibiOS project page. ChibiOS is a complete development environment for embedded applications including RTOS, an HAL, peripheral drivers, support files and tools. ChibiOS also integrates external Open Source components in order to offer a complete solution for embedded devices.

This builds a composite USB device with both a serial CLI (USB CDC) and a fat file system (USB MSC) using the ChibiOS operating system.
The core support for CDC virtual serial ports is provided by ChibiOS. The core support for mass storage is provided by the ChibiOS userrepository ChibiOS-Contrib. It was necessary to make a small change to one MSC support file which is included in this repository.

Chibios Usb Cdc Example 2

Chibios Usb Cdc ExampleChibios

The example can be built two ways. make -f Makefile will build a file system as a statically defined image which is loaded into RAM atruntime and can be both read and written. This image is built using mtools to create a 16KB image containing the files in thedirectory ./testfiles. As a convenience for those without mtools, a precompiled image is provided.

The second method, make -f Makefile.vfs builds a table driven 'virtual disk' also containing the contents of ./testfiles. Thisvirtual disk is generated dynamically at runtime. In contrast to the first method, this virtual disk is read only; however, italso admits 'virtual files' for which the content is generated at runtime. see https://github.com/geoffreymbrown/fat16gen for anexplanation of how this works.

As mentioned above, the image generated by this project has both a CLI and an MSC fat drive. On Linux and OS X, the cli can be accessedusing the program screen as in:

screen /dev/tty.usbmodem402

where the path to the correct virtual com port must be determined at run time.

On OS X and Linux, the MSC device should 'just work'.

Chibios Usb Cdc Example For Kids

Chibios usb cdc example template

Chibios Usb Cdc Example

Additional work is needed to make this work on Windows. I believe that a .INF file should be all that is needed, but I haven't tried anddon't have an inclination to try. I would welcome pull requests to fix this (add the .INF file to ./testfiles, if that is needed).