Serial Port Communication on Linksys AC Series with OpenWRT

Wiki.TerraBase.info
Revision as of 20:24, 2 October 2021 by Root (talk | contribs)
Jump to navigation Jump to search

...no, this article is not about communicating with the router via the Serial / TTL port on the system board of the router. This article is about communicating to a device external to the router through a USB to Serial adapter / cable (example: Dell PowerConnect Ethernet Switch, APC MasterSwitch, etc.)

Physical USB to Serial Adapter

  • FTDI Chipset:Contemporary chipset, currently supported by Windows 10, etc. Tested and it works great with OpenWRT
  • PL2303 Chipset (Prolific):Devices based on this chipset are old. Windows 10, Server 2016, 2019, etc. doesn't support this chipset (but with a bit of effort, one can make it work). But OpenWRT does support it, so this is a good choice on where to use all of those old adapters that don't work with Windows anymore.

Recommendation: If one doesn't own a USB to Serial Adapter, then definately the FTDI Chipset. If one has a bunch of PL2303 Adapters sitting around that can't be used by Windows, then use these.

Software Installation

  • For the FTDI Chipset
    • opkg update
    • opkg install kmod-usb-serial-ftdi
  • For the PL2030 Chipset
    • opkg update
    • opkg install kmod-usb-serial-pl2303

All dependencies will be installed automatically

Serial Communication Software (Telnet without the IP Capability)

There are several choices with picocom (opkg install picocom) and minicom (opkg install minicom) being the top two choices.

After plugging in the device of choice, check the /dev directory for: ttyUSBX (ttyUSB0, ttyUSB1, etc.) This will be needed to let the serial software know which device to connect to.

Picocom

  • picocom -b 9600 /dev/ttyUSB (All of the other defaults (data bits 8, no parity, stop bit 1, no flow control) picocom will typically match most standard devices from Dell, APC, etc., adjust as needed)

Command control of Picocom is a bit odd. It involves starting every command with CTRL A, the CTRL WhatEverOtherCommand (Picocom refers to CTRL as just C)

Type [C-a] [C-h] to see available commands
Terminal ready

*** Picocom commands (all prefixed by [C-a])

*** [C-x] : Exit picocom
*** [C-q] : Exit without reseting serial port
*** [C-b] : Set baudrate
*** [C-u] : Increase baudrate (baud-up)
*** [C-d] : Decrease baudrate (baud-down)
*** [C-i] : Change number of databits
*** [C-j] : Change number of stopbits
*** [C-f] : Change flow-control mode
*** [C-y] : Change parity mode
*** [C-p] : Pulse DTR
*** [C-t] : Toggle DTR
*** [C-g] : Toggle RTS
*** [C-|] : Send break
*** [C-c] : Toggle local echo
*** [C-w] : Write hex
*** [C-s] : Send file
*** [C-r] : Receive file
*** [C-v] : Show port settings
*** [C-h] : Show this message

Minicom

  • minicom -b 9600 --device /dev/ttyUSB0 (data bits 8, no parity, stop bit 1, no flow control) picocom will typically match most standard devices from Dell, APC, etc., adjust as needed)

Minicom can also configure its own startup parameters where just this command needs to be entered: minicom --device /dev/ttyUSB0

Configure this way;

  • CTRL A, 0
  • Serial Port Setup
  • ...follow prompts

OR, edit the /etc/minirc.dfl manually.