Send/expect scripts for serial ports and AT commands

Script a serial dialogue: send, expect text, regular expressions or bytes with timeouts, capture values and check them, fail on ERROR; pass/fail results and a JUnit report. Examples for AT modems, ESP-AT, HC-05 and the STM32 bootloader.

How to use it

  1. Connect to the port, then write a script or load an example: AT modem, ESP-AT Wi-Fi, HC-05, the STM32 bootloader or the demo console.
  2. Each line sends text or bytes, or waits for text, a regular expression or bytes, with a timeout; capture values and check them.
  3. Run it: every expect and check gets a pass or fail with its timing; save the result as JUnit XML for CI.

Questions

What happens when a reply does not come?

A missed expect stops the script and shows what was received last. Use expect? for replies that may not come, and fail-on "ERROR" to stop as soon as the device reports an error.

Why does each send forget what came before?

So that an old reply cannot answer a new command: after AT+CSQ, an OK left over from the previous AT would otherwise match at once.

Can it toggle reset lines?

Yes: dtr on/off, rts on/off and break drive the adapter’s modem lines, for boards that wire them to reset and boot pins.

Is my data uploaded?

No. Data goes between the serial port and this tab only; there is no server that could receive it.

Related tools

Also useful for: at command script, chat script, modem test, serial automation, tera term macro, send expect, esp-at, sim800, quectel, hc-05.