npressfetimg-7432.png

tio is a serial device I/O tool for Linux targeted at embedded developers – CNX Software

There are already several serial terminal programs such as Putty and minicom, and in recent times, I’ve been using Bootterm myself. But that does not mean there isn’t room for more and Martin Lund has developed tio serial device I/O tool for Linux.

Martin found out many of the existing tools are very modem focused or a bit cumbersome to use, so he developed tio as the simpler alternative which puts less focus on classic terminal/modem features and more focus on the needs of embedded developers and hackers.

While it’s possible to build tio from source…

$ git clone https://github.com/tio/tio

$ meson build

$ meson compile C build

$ sudo meson install C build

it’s much easier to install as a snap (and you should get updates automatically):

$ snap install tio classic

Let’s see the options offered with the “help” parameter:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

tio help

Usage: /snap/tio/438/usr/bin/tio [<options>] <ttydevice|config>

 

Options:

  b, baudrate <bps>             Baud rate (default: 115200)

  d, databits 5|6|7|8           Data bits (default: 8)

  f, flow hard|soft|none        Flow control (default: none)

  s, stopbits 1|2               Stop bits (default: 1)

  p, parity odd|even|none       Parity (default: none)

  o, outputdelay <ms>          Output delay (default: 0)

  n, noautoconnect             Disable automatic connect

  e, localecho                 Enable local echo

  t, timestamp                  Enable line timestamp

      timestampformat <format>  Set timestamp format (default: 24hour)

  L, listdevices               List available serial devices

  l, log                        Enable log to file

      logfile <filename>        Set log filename

      logstrip                  Strip control characters and escape sequences

  m, map <flags>                Map special characters

  c, color 0..255|none|list     Colorize tio text (default: 15)

  S, socket <socket>            Redirect I/O to socket

  x, hexmode                   Enable hexadecimal mode

  v, version                    Display version

  h, help                       Display help

 

Options may be set via configuration file.

 

In session, press ctrlt q to quit.

 

See the man page for more details.

I’ve connected a USB to TTL board to check it out:

$ tio L

/dev/serial/byid/usb1a86_USB2.0Serialif00port0

It’s detected properly, but not exactly in the usual way since the board is attached to /dev/ttyUSB0:

[10490.292941] usb 11: new fullspeed USB device number 4 using xhci_hcd

[10490.458456] usb 11: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.54

[10490.458466] usb 11: New USB device strings: Mfr=0, Product=2, SerialNumber=0

[10490.458470] usb 11: Product: USB2.0Serial

[10490.542269] usbcore: registered new interface driver usbserial_generic

[10490.542284] usbserial: USB Serial support registered for generic

[10490.544859] usbcore: registered new interface driver ch341

[10490.544919] usbserial: USB Serial support registered for ch341uart

[10490.544948] ch341 11:1.0: ch341uart converter detected

[10490.557605] usb 11: ch341uart converter now attached to ttyUSB0

Anyway, I was still able to use it with Khadas VIM4 board after setting the baud rate to 921600:

$ tio /dev/serial/byid/usb1a86_USB2.0Serialif00port0 b 921600

[11:59:32.534] tio v1.40

[11:59:32.534] Press ctrlt q to quit

[11:59:32.544] Connected

���T7:BL:055c20;ID:9056601109811D08;FEAT:30F:1FFF0000:B002F:1;POC:CF;RCY:0;OVD:0;DFU:0;SD:2002;eMMC:0;RD0:0;CHK:0;SCS:0;

 

Bl2_early_platform_setup: indicates bl2ex flow!

 

OTP_LIC00 : 0f0300000000ff1f2f000b0000000000

OTP_LIC10 : 008207000001fc000c00001000000300

I could launch the program before booting the board to get the full log. It’s actually fairly similar to bootterm, including the options for timestamps:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

$ tio /dev/serial/byid/usb1a86_USB2.0Serialif00port0 b 921600 t

[14:09:55.213] tio v1.40

[14:09:55.213] Press ctrlt q to quit

[14:09:55.223] Connected

[14:09:56.976] T7:BL:055c20;ID:9056601109811D08;FEAT:30F:1FFF0000:B002F:1;POC:CF;RCY:0;OVD:0;DFU:0;SD:2002;eMMC:0;RD0:0;CHK:0;SCS:0;

 

[14:09:57.533] Bl2_early_platform_setup: indicates bl2ex flow!

 

[14:09:57.550] OTP_LIC00 : 0f0300000000ff1f2f000b0000000000

[14:09:57.550] OTP_LIC10 : 008207000001fc000c00001000000300

[14:09:57.551] OTP_LIC20 : ffffffbfffff0700ff80008003000003

[14:09:57.551] OTP_LIC30 : 00000002010000008f03000203000000

 

[14:09:57.552] TE: 380759

 

[14:09:57.552] BL2 Built : 09:58:05, Nov 19 2021. t7 griscurereviewsc2bl2102720202102g199647c jenkins@walle02sh

 

[14:09:57.553] Board ID = 5

[14:09:57.553] Set sys clock to 24Mhz

[14:09:57.554] syspll is 1512Mhz. Locked

[14:09:57.554] sys1pll is 1608Mhz. Locked

[14:09:57.554] Set sys clock to 167Mhz

[14:09:57.555] gp0pll is 0Mhz. Locked

[14:09:57.555] bl2_platform_setup

[14:09:57.555] boot area list:

[14:09:57.555] 1STBLOB 00000200 00040000

[14:09:57.556] BL2E 00040200 00013000

[14:09:57.556] BL2X 00053200 00011000

[14:09:57.556] DDRFIP 00064200 00040000

[14:09:57.556] DEVFIP 000a4200 00300000

[14:09:57.557] s_setup from rom:00010081

tio does however offer redirection of I/O to sockets for scripting or TTY sharing, hex mode, and changing the text color.

It’s also possible to change the default configuration via $XDG_CONFIG_HOME/tio/tiorc, $HOME/.config/tio/tiorc, or $HOME/.tiorc file.

You’ll find all details about tio serial device I/O tool on the project page on Github. As a side note, it’s not the first time we’ve written about Martin’s open-source tools, as we previously covered LXI Tools made for “LAN eXtensions for Instrumentation” compliant test instruments.

Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.

Source: https://www.cnx-software.com/2022/06/30/tio-is-a-serial-device-i-o-tool-for-linux-targeted-at-embedded-developers/

Related Posts