2014-09-26 17:29:48 +02:00
# Serial
2014-09-16 00:40:17 +02:00
2015-01-04 00:53:24 +01:00
Cleanflight has enhanced serial port flexibility but configuration is slightly more complex as a result.
2014-09-16 00:40:17 +02:00
2014-09-26 17:29:48 +02:00
Cleanflight has the concept of a function (MSP, GPS, Serial RX, etc) and a port (VCP, UARTx, SoftSerial x).
2015-01-04 00:53:24 +01:00
Not all functions can be used on all ports due to hardware pin mapping, conflicting features, hardware, and software
2014-09-26 17:29:48 +02:00
constraints.
## Serial port types
* USB Virtual Com Port (VCP) - USB pins on a USB port connected directly to the processor without requiring
a dedicated USB to UART adapter. VCP does not 'use' a physical UART port.
* UART - A pair of dedicated hardware transmit and receive pins with signal detection and generation done in hardware.
* SoftSerial - A pair of hardware transmit and receive pins with signal detection and generation done in software.
2015-05-28 15:06:37 +02:00
UART is the most efficient in terms of CPU usage.
SoftSerial is the least efficient and slowest, SoftSerial should only be used for low-bandwidth usages, such as telemetry transmission.
2014-09-26 17:29:48 +02:00
UART ports are sometimes exposed via on-board USB to UART converters, such as the CP2102 as found on the Naze and Flip32 boards.
2015-05-28 15:06:37 +02:00
If the flight controller does not have an on-board USB to UART converter and doesn't support VCP then an external USB to UART board is required.
2015-01-04 00:53:24 +01:00
These are sometimes referred to as FTDI boards. FTDI is just a common manufacturer of a chip (the FT232RL) used on USB to UART boards.
2014-09-26 17:29:48 +02:00
When selecting a USB to UART converter choose one that has DTR exposed as well as a selector for 3.3v and 5v since they are more useful.
Examples:
2014-11-14 13:48:39 +01:00
* [FT232RL FTDI USB To TTL Serial Converter Adapter ](http://www.banggood.com/FT232RL-FTDI-USB-To-TTL-Serial-Converter-Adapter-Module-For-Arduino-p-917226.html )
* [USB To TTL / COM Converter Module buildin-in CP2102 ](http://www.banggood.com/Wholesale-USB-To-TTL-Or-COM-Converter-Module-Buildin-in-CP2102-New-p-27989.html )
2014-09-26 17:29:48 +02:00
Both SoftSerial and UART ports can be connected to your computer via USB to UART converter boards.
## Serial Configuration
2014-09-16 00:40:17 +02:00
2015-03-05 12:14:10 +01:00
Serial port configuration is best done via the configurator. You can use the CLI too but the commands are reserved for developers and advanced users.
2015-05-28 15:06:37 +02:00
Configure serial ports first, then enable/disable features that use the ports. To configure SoftSerial ports the SOFTSERIAL feature must be also be enabled.
2014-09-16 00:40:17 +02:00
2014-11-13 21:32:10 +01:00
### Constraints
2014-09-16 00:40:17 +02:00
2015-01-04 00:53:24 +01:00
If the configuration is invalid the serial port configuration will reset to its defaults and features may be disabled.
2015-01-03 22:54:07 +01:00
2015-03-03 23:52:56 +01:00
* There must always be a port available to use for MSP/CLI.
2015-01-03 22:54:07 +01:00
* There is a maximum of 2 MSP ports.
* To use a port for a function, the function's corresponding feature must be also be enabled.
e.g. after configuring a port for GPS enable the GPS feature.
2015-01-04 00:53:24 +01:00
* If SoftSerial is used, then all SoftSerial ports must use the same baudrate.
2015-03-03 23:52:56 +01:00
* Softserial is limited to 19200 buad.
* All telemetry systems except MSP will ignore any attempts to override the baudrate.
* MSP/CLI can be shared with EITHER Blackbox OR telemetry. In shared mode blackbox or telemetry will be output only when armed.
* Smartport telemetry cannot be shared with MSP.
* No other serial port sharing combinations are valid.
2015-03-31 14:40:28 +02:00
* You can use as many different telemetry systems as you like at the same time.
* You can only use each telemetry system once. e.g. FrSky telemetry cannot be used on two port, but MSP Telemetry + FrSky on different ports is fine.
2015-01-03 22:54:07 +01:00
2015-03-05 12:14:10 +01:00
### Baud Rates
Each baud rate is assigned an identifier, they are as follows:
2014-09-16 00:40:17 +02:00
2015-03-05 12:14:10 +01:00
| Identifier | Baud rate |
| ---------- | --------- |
| 0 | Auto |
| 1 | 9600 |
| 2 | 19200 |
| 3 | 38400 |
| 4 | 57600 |
| 5 | 115200 |
2015-03-06 14:01:44 +01:00
| 6 | 230400 |
| 7 | 250000 |