What program do you use to connect to (USB) serial

Hey guys,

This is a question for people using Linux to develop for RIOT-OS.

What program do you use to connect to the (USB) serial? picocom? minicom? miniterm? grabserial? something else?

I'm looking for a program that can automatically reconnect to the USB serial after the RIOT board does a restart. So far I only found that minicom will do that, but not automatically.

I like the three others much better because I can more easily log the output. However, when the board resets, it loses the connection.

This is a question for people using Linux to develop for RIOT-OS.

    > What program do you use to connect to the (USB) serial? picocom?     > minicom? miniterm? grabserial? something else?

I sometimes use minicom, because it's generally available and can send BREAK, but I usually wind up using screen, because then I can run it on my serial console server, and connect to it from multiple places.

I also use rtty, but it isn't as useable because USB serial devices don't number consistently.

    > I'm looking for a program that can automatically reconnect to the USB     > serial after the RIOT board does a restart. So far I only found that     > minicom will do that, but not automatically.

    > I like the three others much better because I can more easily log the     > output. However, when the board resets, it loses the connection.

Which board? Are you using a board with an FTDI chip attached to a serial console? Or one with a built-in USB? There is also the interaction with the flashing process, which sometimes needsd the USB connection. I'd like to convince the minicom and screen guys to do some kind of back-off when the flasher asks. (This is also kinda a call for dual TTY devices that showed up in SunOS 4,AIX,etc. back in the 1990s that let UUCP run well before we had mgetty.)

    > This is a question for people using Linux to develop for RIOT-OS.

    > What program do you use to connect to the (USB) serial? picocom?     > minicom? miniterm? grabserial? something else?

I sometimes use minicom, because it's generally available and can send BREAK, but I usually wind up using screen, because then I can run it on my serial console server, and connect to it from multiple places.

I also use rtty, but it isn't as useable because USB serial devices don't number consistently.

    > I'm looking for a program that can automatically reconnect to the USB     > serial after the RIOT board does a restart. So far I only found that     > minicom will do that, but not automatically.

    > I like the three others much better because I can more easily log the     > output. However, when the board resets, it loses the connection.

Which board? Are you using a board with an FTDI chip attached to a serial console? Or one with a built-in USB?

It's a SODAQ board (basically an Arduino Zero compatible board) with a SAMD21 that has onchip USB.

    There is also the interaction with the flashing process, which sometimes needsd the USB connection. I'd like to convince the minicom and screen guys to do some kind of back-off when the flasher asks. (This is also kinda a call for dual TTY devices that showed up in SunOS 4,AIX,etc. back in the 1990s that let UUCP run well before we had mgetty.)

Well, minicom is kinda old, from the modem era. The thing I don't like about it that it really tries to emulate a terminal. With a curses-style popup when the tty device is gone. You can hit enter and it reconnects.

Picocom, miniterm (Python pyserial) and grabserial is what I like. I can pipe (or tee) the output in a file.

But like I said, if my program hits a watchdog reset, it reboots, and my USB connection is gone. In my startup I want to print the reset cause to know what was going on.

In the past I was using one of the UARTs of the SAMD21. In a sense that was much easier.

I hate to say it, but it seems on Windows there is a solution (they tell me). That, by itself, bothers me too :slight_smile:

Which board? Are you using a board with an FTDI chip attached to a

    >> serial console? Or one with a built-in USB?

    > It's a SODAQ board (basically an Arduino Zero compatible board) with a     > SAMD21 that has onchip USB.

So you lose your USB device each time it reboots.

    >> There is also the interaction with the flashing process, which     >> sometimes needsd the USB connection. I'd like to convince the minicom     >> and screen guys to do some kind of back-off when the flasher asks.     >> (This is also kinda a call for dual TTY devices that showed up in     >> SunOS 4,AIX,etc. back in the 1990s that let UUCP run well before we     >> had mgetty.)

    > Well, minicom is kinda old, from the modem era. The thing I don't like     > about it that it really tries to emulate a terminal. With a     > curses-style popup when the tty device is gone. You can hit enter and     > it reconnects.

Yes, it reconnects. The rest don't. Either fix the rest to reconnect ... Getting the USB to enumerate consistently is what bugs me. It requires a unique ID in the USB, which most of the devices haven't bothered to provision :frowning:

    > But like I said, if my program hits a watchdog reset, it reboots, and     > my USB connection is gone. In my startup I want to print the reset     > cause to know what was going on.

Sounds like ten lines of python.

    > I hate to say it, but it seems on Windows there is a solution (they     > tell me). That, by itself, bothers me too :slight_smile:

Windows GUI programs mostly can't pipe stuff. The ones that can, are usually just using the Linux ABI now.

pyterm [1] will do that. It's the default when you run

    make term

in RIOT's build system. It will output to the console and keep logs in ~/.pyterm, so it's pretty handy.

[1] https://github.com/RIOT-OS/RIOT/tree/master/dist/tools/pyterm

Wow, I never knew it was there. Great. It even has timing. Impressive.

Minor twit. It's missing the first 45 characters or so.

2020-05-18 20:41:02,547 # Connect to serial port /dev/ttyACM0 Welcome to pyterm! Type '/exit' to exit. 2020-05-18 20:41:03,550 # -602-g39227-add-sodaq-sff) 2020-05-18 20:41:03,551 # Hello World! 2020-05-18 20:41:03,552 # You are running RIOT on a(n) sodaq-sara-sff board. 2020-05-18 20:41:03,553 # This board features a(n) samd21 MCU. 2020-05-18 20:46:06,269 # Serial port disconnected, waiting to get reconnected... 2020-05-18 20:46:07,276 # Serial port disconnected, waiting to get reconnected... 2020-05-18 20:46:08,277 # Try to reconnect to /dev/ttyACM0 again... 2020-05-18 20:46:08,278 # Reconnected to serial port /dev/ttyACM0 2020-05-18 20:46:08,279 # -602-g39227-add-sodaq-sff) 2020-05-18 20:46:08,280 # Hello World! 2020-05-18 20:46:08,281 # You are running RIOT on a(n) sodaq-sara-sff board. 2020-05-18 20:46:08,281 # This board features a(n) samd21 MCU.

Even so, I'm quite happy.