mjl blog
January 18th 2016

Terminals and unix tools

Had a minor frustration today. One that I’ve had before.

I wanted to connect a LoraWAN dev kit board to my MacOSX laptop. It has a serial-over-USB interface. That means you don’t need any extra cables or stuff to get started. Great! But you still need software to connect.

Well, MacOSX is unix, so it must have some tools to connect over a serial line for sure? Yes! We have cu(1), and I also have screen(1). The dev kit docs explain how to configure the serial line. Okay, no problem. So you run these commands with the right arguments.

Unfortunately, I got nothing out of the board. I don’t use these tools very often to connect over serial lines, so I wasn’t sure I was doing it right. After repeated attempts, attempted baud rate autoreconfigurations, and dev board resets, the problem revealed itself. I wasn’t sending carriage return+newline at the end of commands, but probably just newlines. So the dev kit never saw a command, and never did anything.

After realising this (it took me the use of a Windows laptop with Tera Term with the right option), I wanted to use the usual tools to connect. But I still haven’t been able to make it work. There is a “stty onlcr” command (from memory) to set this mode on the serial line, but screen resets it when starting (or the act of opening it resets it). And cu doesn’t work with it either, maybe for still other reasons. In the end I downloaded an “app” from the Mac App Store called SerialTools that got me connected.

Two things bothered me:

  1. It is too hard to connect to a serial device from a MacOSX.
  2. This dev kit is makes it harder than necessary to use it.

In a more positive note, once the commands started flowing, I quite quickly managed to send messages from the LoraWAN mote (the dev kit) to our LoraWAN gateway, and the data made it into the internets, and I got it forwarded to my local machine.