Files
rockblock9704-zephyr/docs/boards/stamp_c3.md
T
scottp 4f5834a467 0.2.0: USB-C and the header share a port, and a real 9704 on the Stamp-C3
The 9704's USB-C goes through an FTDI chip to the modem's UART, on the
same lines as the header. With the cable plugged in, that chip drives
the modem's RX: a board on the header hears the modem but cannot reach
it, and the computer on USB gets no answer either. Unplug the USB-C and
power the 9704 from the header. The README says so beside the overlay
example, and docs/CLOUDLOOP.md lists it under "When begin fails".

The M5Stamp-C3 is the first microcontroller to run against a real 9704:
TX and RX only, the modem powered from the Stamp's 5 V pin. begin, info
and signal all answer, with nothing dropped. docs/boards/stamp_c3.md
has the power section and what has run.

no-control-pins.overlay takes P_EN, I_EN and I_BTD out of any board's
overlay at build time, for a modem on four wires. The modem node is
labelled rb9704 in every overlay so it can.

The module, the sample and the Python tools are 0.2.0.
2026-10-25 16:02:45 +11:00

6.0 KiB

M5Stamp-C3

M5Stack's Stamp-C3: an ESP32-C3, a single RISC-V core with WiFi and 400 kB of RAM, on a small board with a USB-C serial bridge, an RGB LED and a button. Zephyr's name for it is stamp_c3, and it is in Zephyr upstream. It is the board for taking the modem outside: powered from a battery or a supply, reached over WiFi, and showing on its LED how things stand.

The overlay is samples/shell/boards/stamp_c3.overlay, with stamp_c3.conf beside it for the LED and button.

Pins

Stamp-C3 Signal Notes
GPIO4 uart1 TX → 9704 RX 230400 8N1
GPIO5 uart1 RX ← 9704 TX
GPIO10 P_EN the supply; without it the module drives none of the three
GPIO6 I_EN the modem enable, 10 ms after P_EN
GPIO7 I_BTD rb9704 begin waits up to 30 s for it to go high
GND GND
5V the 9704's supply in the Stamp's USB-C supply, passed through
GPIO2 the RGB LED, an SK6812 on the board
GPIO3 the button on the board
GPIO20, GPIO21 uart0, the console through the USB-C bridge

Kept clear: GPIO8 and GPIO9 (strapping pins, and the board's I2C) and GPIO18 and GPIO19 (USB).

Power: the Stamp's 5V, and the 9704's USB-C unplugged

The 9704's header UART and its USB-C port are the same serial lines. With USB-C plugged in, the 9704's FTDI chip is powered and drives the modem's RX, and a board on the header cannot talk over it: the modem answers nobody, the computer on USB included. Its TX still reaches the header, so a board can listen alongside USB, but not send.

So the 9704 is powered from the header with its USB-C unplugged. The Stamp's 5V pin does it: the modem draws a few hundred mA, and its supercapacitor charges slowly, about 40 s to the green RDY LED. Both boards then run from the Stamp's USB-C; on a laptop's 500 mA port a Stamp that resets by itself while the 9704 charges is the supply sagging, and a charger or a powered hub gives the margin.

The control lines are optional. With fewer wired, take the matching lines out of the overlay's rockblock node, or rb9704 begin waits on a pin that is not there:

  • None: four wires, and the modem is taken to be powered. No edit needed: -DEXTRA_DTC_OVERLAY_FILE=no-control-pins.overlay takes all three out at build time (below).
  • P_EN only: rb9704 power off and power on over telnet restart a modem that has hung, with nobody walking out to it. The one most worth wiring.
  • I_BTD as well: a slow or failed boot is a clear timeout, not JSPR errors after a fixed 4 s (boot-delay-ms).
  • I_EN adds little here. The ESP32-C3's ROM prints at reset on GPIO21, the console, so nothing reaches the modem's pins before Zephyr runs.

Build and flash

From a west workspace that has this module:

west build -b stamp_c3 samples/shell -- -DEXTRA_CONF_FILE=overlay-wifi.conf
west flash

Without -DEXTRA_CONF_FILE=overlay-wifi.conf the shell is on the USB console only, and the LED and button work the same.

TX and RX only, no control lines:

west build -b stamp_c3 samples/shell -- -DEXTRA_CONF_FILE=overlay-wifi.conf \
    -DEXTRA_DTC_OVERLAY_FILE=no-control-pins.overlay

With no P_EN, the long press on the button ends without turning anything off, and rb9704 power answers -ENOTSUP.

WiFi

Once, on the USB console (115200), store the network. It is kept in flash across reboots and reflashing:

wifi cred add -s "<SSID>" -k 1 -p "<password>"

-k 1 is WPA2-PSK; -k 0 is an open network. The board joins at every boot after, tries again every 30 s while the network is away, and logs:

address 192.168.1.50: telnet 192.168.1.50
Command
wifi cred list the stored networks
wifi cred delete <SSID> forget one
wifi cred auto_connect join a stored network now
wifi status the network joined, the channel, the signal
wifi scan the networks in range
net iface the address, again

Telnet

telnet 192.168.1.50

Zephyr's telnet server does not offer character mode, so the client stays in line mode, and the up arrow, Tab and line editing do nothing. Ask for it: Ctrl-], then mode character. For every session, ~/.telnetrc:

192.168.1.50
    mode character

Or raw, with every key going to the shell and Ctrl-] to leave:

socat -,rawer,escape=0x1d TCP:192.168.1.50:23

Telnet has no password and no encryption, and rb9704 send costs airtime: use it on a network you trust.

The LED and button

samples/shell/src/indicator.c.

LED Meaning
blue not begun
red / yellow / green begun: no signal or no satellite / 1-2 bars / 3-5 bars
magenta a message is with the modem, on its way
green flash, 1 s a message went
red flash, 2 s a message, or a button action, failed
cyan flash, 2 s a message arrived
white, fast blink a button action is running
slow blink of any of the above no WiFi: telnet will not reach it
Button
short press not begun: rb9704 begin. Begun: ask for the signal
2 s or more end, and the supply off when P_EN is wired

Nothing on the button costs airtime. The LED runs at 24 of 255 (LEVEL in indicator.c).

First power-up

  1. Without the modem: the LED blinks blue until WiFi joins, then stays blue. A short press runs begin with nothing there: white, then a red flash.
  2. With the modem wired: a short press goes white, then red, yellow or green with the signal.
  3. Over telnet: rb9704 spy on, rb9704 info, rb9704 signal. All free.

A fake modem (rb9704-fake) on a USB-serial adapter in the modem's place has no I_BTD: tie GPIO7 to 3.3 V for those runs.

What has run

WiFi, the stored network, telnet works (2026-10-24)
a real 9704 on TX and RX, powered from the Stamp's 5V: begin, info, signal works (2026-10-25)
the same with the 9704's USB-C plugged in fails: the FTDI holds the modem's RX
the LED and button built, not yet run
P_EN, I_EN, I_BTD not yet wired