Flashing Firmware On Older Hardware

Overview

Sometimes on hardware, one has to reinstall its firmware. This is a process of connecting the device via an Ethernet cable, USB cable, or to the serial port. I recently had to do this via a serial port and then to software capable of talking to the serial port. A small but big problem is old fashioned serial ports and cables are a little harder to come by these days! Fortunately, USB to serial port cables are available, however getting software that will cooperate with the hardware's quirks to upload the firmware turned out to be a big issue.

Firmware Flashing Issues

The hardware that I had to reinstall the firmware to requires one to type in confirmations using two characters. If any extra characters are added or those two characters are incorrect it fails. Worse, to upload the firmware, one has to:

  1. start the firmware upload,
  2. initiate an ASCII upload (without any character translations) of the firmware that dumps, character-by-character data to the serial port,
  3. when done the user must confirm such, and,
  4. hardware flow control must be used.

As I discovered, item (2) was an issue with many programs (e.g., minicom, cutecom, etc.) under Linux. Some programs like cutecom would only send one line at a time and this causes carriage returns to be send as well –causing the failure of any firmware upload because of extra characters (i.e., the ENTER key / ASCII CR). Under Windows, there is no serial port program anymore and ones I sought out on the Internet crashed. After some more searching, I found a suitable program called picocom that worked under Linux!

picocom: Simple Software That Works

The program picocom is very simple, but, effective as there are no high-level "features" to get in the way of any of the required steps above. The program provides ability to interact with the serial port, to send and receive files, and to update a number of settings (e.g., baud) either while running the program or via command line options. It does this using an escape keystroke (i.e., Ctrl-A) when followed by a specific keystroke will invoke operations. For example, to send a file one would key in Ctrl-A Ctrl-S.

Normally most programs decide how to send and receive files, but, picocom requires such to be passed in as command line arguments. For example, to connect to /dev/ttyUSB0 at 19200 bps and to use an ASCII transfer protocol to send files, this is the picocom command line required:

picocom -b 19200 --send-cmd "ascii-xfr -sv" /dev/ttyUSB0

There is little to no feedback when Ctrl-A features are invoked and it is absolutely necessary to read the man page for the keystrokes required to invoke certain features as picocom is very minimal with respect to its user interface.

In the end, this program did everything I could ask for: I could key in commands required to initiate the firmware upload, confirm that it is to be installed once it has been uploaded, and it properly uploaded the firmware as-is. So if you are looking for a simple, bare bones program to upload something like firmware to a device, try picocom!

P.S. To quit the program use the keystrokes: Ctrl-A Ctrl-Q.

Leave a Reply

Your email address will not be published. Required fields are marked *