back to index

Picocom enhancements

      Command syntax
      Code notes


Picocom is a lightweight, simple terminal software for working with serial ports. It is good, almost perfect for most tasks dealing with embedded electronics. However, some features are missing in the stock version. When bad data come to the port, they are echoed in binary form and the random control characters then can break the terminal setting and result in weird character mapping and other oddities; this was a problem especially with the ESP8266 chip, which sends garbage on reset. There was also missing control of the RTS pin.


Several functions were added in the form of a patch:

Command syntax

Example: run picocom on /dev/ttyUSB0, at 115200 bps, with local echo and colors, with DSR high and RTS low:

 picocom -b 115200 -c -C --dtr 1 --rts 0 /dev/ttyUSB0


picocom v1.8-Shad-150626-2320
Usage is: picocom [options] <tty device>
Options are:
  --<b>aud <baudrate>
  --<f>low s (=soft) | h (=hard) | n (=none)
  --<p>arity o (=odd) | e (=even) | n (=none)
  --<d>atabits 5 | 6 | 7 | 8
  --<e>scape <char>
  --<s>end-cmd <command>
  --recei<v>e-cmd <command>
  --nohex, --hexall
  --color (-C), --colorbright (-B)
  --dtr <1|0>
  --rts <1|0>
  --baudadd <list_of_baudrates|set_name>
  --baudlist <list_of_baudrates|set_name>
  --imap <map> (input mappings)
  --omap <map> (output mappings)
  --emap <map> (local-echo mappings)
<map> is a comma-separated list of one or more of:
  crlf : map CR --> LF
  crcrlf : map CR --> CR + LF
  igncr : ignore CR
  lfcr : map LF --> CR
  lfcrlf : map LF --> CR + LF
  ignlf : ignore LF
  bsdel : map BS --> DEL
  delbs : map DEL --> BS
<?> indicates the equivalent short option.
Short options are prefixed by "-" instead of by "--".


Version compiled at Sat Mar 3 10:27:57 CET 2018

The binary is compiled for PC Linux, using gcc-4.9.2.

Compiling for Raspberry Pi (armhf architecture) was uneventful; make did the job smoothly. Binaries of the version of code compiled at Sat Mar 3 10:24:27 CET 2018:


A fault was found in the select() call, where the timeout for checking modem flags was specified in microseconds instead of in nanoseconds (some odd specs shenanigans). The changes were therefore read 10,000 times per second instead of 10 times. This was very noticeably slowing the code on slower machines, namely raspberry pi.

The term_get_modem_flags was unnecessarily calling term_find, iterating through the term structure without need to.

250000 and 500000 were added to list of default baudrates.

Code notes

No warranty, it's software and so it has more bugs than an anthill. Original code is GPLv2, this naturally follows.

Custom baud rates are implemented by using term.c from jmesmon's fork, here. The files are:


If you have any comments or questions about the topic, please let me know here:
Your name:
Your email:
Leave this empty!
Only spambots enter stuff here.