back to index

Picocom enhancements

Problem

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.

Solution

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

Options:

picocom v1.8-Shad-150626-1947
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>
  --e<c>ho
  --no<i>nit
  --no<r>eset
  --no<l>ock
  --<s>end-cmd <command>
  --recei<v>e-cmd <command>
  --nohex, --hexall
  --color (-C), --colorbright (-B)
  --dtr <1|0>
  --rts <1|0>
  --nomodem
  --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)
  --<h>elp
<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 "--".

Downloads

Version compiled at Fri Jun 26 23:20:13 CEST 2015

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

Compiling for Raspberry Pi (armhf architecture) was uneventful; make did the job smoothly. Binaries of the version of code compiled at Fri Jun 26 23:20:13 CEST 2015:

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:

TODO


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