The Digital Cave

Primitive Life in a Technological World

 

Serial Communications

Serial Console

Frequently I find myself in need of a serial console which I can use to troubleshoot / interact with various embedded hardware devices. I recently found a hint on how to use the program 'screen' to do this.

All you need to do is start screen with the arguments . For example, to interact with an Arduino device configured to run at 9600 baud, you could use the following: screen /dev/tty.usbserial-A200294u 9600 Once you are finished, type Ctrl+A followed by Ctrl+\ (confirm exit with 'y').

Serial Dump

To dump the data to file, add the -L flag to the command: screen -L /dev/tty.usbserial-A200294u 9600 This will write all output from the serial port to screen.0 in the current directory.

Serial Upload

I have not yet figured out a generic way to send a sequence of bytes as found in an arbitrary file over a serial link. While I have seen some programs such as kermit or xmodem, they seem to assume certain file transfer protocols are being used, and I can't see how to just send the generic bytes. If you are aware of how to do this, please let me know.