SerialUSB

Aus LaborWiki
Wechseln zu: Navigation, Suche
     
SerialUSB

Release status: stable [box doku]

Description Code Example for STM32F4xx
Author(s)  siro (siro)
Platform  STM32F4xx
License  mixed




Overview

serialUSB is a c code-example for STM32F4xx.
It will create a virtual com port VCP using the built in USB device stack. On the host PC the VCP acts like a physical terminal (COM-port).
The default device name is /dev/ttyACM0 .
Make sute to blacklist the device and/or shut down modem-manager as it tries to sent AT-commands to it.
/dev/ttyACM0 can be accessed like any other terminal /dev/tty0 (physical) or /dev/ttyUSB0 (PL2303).

Download

To view the source code use our TRAC:
[1]

To checkout use Subversion:

svn co https://www.das-labor.org/svn/microcontroller/src-stm32f4xx/serialUSB

To build simply type

make

Virtual Com Port

void VCP_send_str(uint8_t* buf)

will sent a string to host
note: too long strings may cause buffer overrun

void VCP_put_char(uint8_t buf)

will sent a single char to host

uint8_t VCP_get_char(uint8_t *buf)

nonblocking:
return 1 on success, 0 otherwise
on success buf contains the read character

uint8_t VCP_get_string(uint8_t *buf)

nonblocking:
return read bytes on success, 0 otherwise
on success buf contains the read characters