SerialUSB: Unterschied zwischen den Versionen

Aus LaborWiki
Wechseln zu: Navigation, Suche
(+more description)
(svn -> github)
 
Zeile 10: Zeile 10:
|platform    = STM32F4xx
|platform    = STM32F4xx
|license    = mixed
|license    = mixed
|download    =  
|download    = [https://github.com/das-labor/SerialUSB]
}} __NOTOC__
}} __NOTOC__


Zeile 20: Zeile 20:
/dev/ttyACM0 can be accessed like any other terminal /dev/tty0 (physical) or /dev/ttyUSB0 (PL2303).<br>
/dev/ttyACM0 can be accessed like any other terminal /dev/tty0 (physical) or /dev/ttyUSB0 (PL2303).<br>


== Download ==
To view the source code use our TRAC:<br>
[https://www.das-labor.org/trac/browser/microcontroller/src-stm32f4xx/serialUSB]<br>
To checkout use Subversion:
svn co https://www.das-labor.org/svn/microcontroller/src-stm32f4xx/serialUSB
To build simply type
make


=== Virtual Com Port ===
=== Virtual Com Port ===

Aktuelle Version vom 25. Mai 2015, 19:25 Uhr

       
SerialUSB

Release status: stable [box doku]

Description Code Example for STM32F4xx
Author(s)  siro (siro)
Platform  STM32F4xx
License  mixed
Download  [1]




Overview[Bearbeiten | Quelltext bearbeiten]

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).


Virtual Com Port[Bearbeiten | Quelltext bearbeiten]

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