Sample: the M5Stamp-C3, the shell over WiFi, and the control lines wired

overlay-wifi.conf puts the shell on telnet on any ESP32. At boot it joins
the network stored in flash with `wifi cred add`, and rejoins it after a
drop, for a board out under the sky with no USB.

The M5Stamp-C3 (ESP32-C3, RISC-V) has an overlay: the modem on uart1,
GPIO4 and GPIO5, with P_EN, I_EN and I_BTD on GPIO10, 6 and 7. Its RGB
LED, driven by spi2 on GPIO2, shows the modem's state, and its button
begins, asks for the signal and ends. docs/boards/stamp_c3.md has the
pins, the WiFi commands and the LED's colours. So far it has run WiFi
and telnet, not yet the modem.

The ESP32-S3-DevKitC, ESP32 DevKitC and NUCLEO-U575ZI-Q overlays now
wire the three control lines as well; the table is in docs/TESTING.md.

The README gives the Gitea home and the GitHub mirror, and the boards
as a table of CPU and what each has run.
This commit is contained in:
scottp committed 2026-10-25 13:54:09 +11:00
1 parent f97fcab74b
commit d08364ce58
16 files changed
+759 -10

No files matched your search

+65 -2
View File
@@ -82,6 +82,68 @@ round:
The ESP32-S3 sits in its ROM loader after `west flash` until it is reset;
toggle RTS on its USB port, or press reset, before the tests.
## Out of doors: the shell over WiFi
A real modem needs the sky, and the sky is rarely where the USB cable
reaches. `samples/shell/overlay-wifi.conf` puts the same shell on telnet,
on any ESP32 board, so the board needs only power:
```sh
west build -b stamp_c3 samples/shell -- -DEXTRA_CONF_FILE=overlay-wifi.conf
west flash
```
Once, on the USB console, store the network; it is kept in flash:
```
wifi cred add -s "<SSID>" -k 1 -p "<password>"
```
At every boot after, the board joins it, logs `address 192.168.1.50:
telnet 192.168.1.50`, and rejoins after a drop. A network added after boot
is joined within 30 s. `wifi cred list` and `wifi cred delete <SSID>` look
after the stored list; `net iface` shows the address again.
```sh
telnet 192.168.1.50
rb9704 begin
rb9704 spy on
rb9704 info
```
Telnet has no password and no encryption, and `rb9704 send` costs
airtime: use it on a network you trust.
The Linux `telnet` client stays in line mode, where the up arrow and line
editing do nothing: `Ctrl-]` then `mode character` fixes it, or connect
with `socat -,rawer,escape=0x1d TCP:<address>:23`.
On the M5Stamp-C3 the board's RGB LED shows the modem's state and its
button begins and ends it; `boards/stamp_c3.md` has the table, the pins
and the WiFi commands.
### Wiring
The board overlays for the M5Stamp-C3, ESP32-S3-DevKitC, ESP32 DevKitC
and NUCLEO-U575ZI-Q wire all three control lines, so `rb9704 begin`
powers the modem up in order and waits for it to say it has booted.
| 9704 | M5Stamp-C3 | ESP32-S3-DevKitC | ESP32 DevKitC | NUCLEO-U575ZI-Q |
| --- | --- | --- | --- | --- |
| RX (board TX) | GPIO4 | GPIO17 | GPIO17 | PD8 |
| TX (board RX) | GPIO5 | GPIO18 | GPIO16 | PD9 |
| P_EN | GPIO10 | GPIO6 | GPIO27 | PF15 (D2) |
| I_EN | GPIO6 | GPIO4 | GPIO25 | PF14 (D4) |
| I_BTD | GPIO7 | GPIO5 | GPIO26 | PF13 (D7) |
| GND | GND | GND | GND | GND |
The modem's supply is its own, at the voltage and peak current Ground
Control's manual gives, not the board's 3.3 V regulator. With `booted-gpios` in the overlay,
`rb9704 begin` waits up to 30 s for I_BTD. A fake modem on a USB-serial
adapter in place of the 9704 has no I_BTD, so tie the board's I_BTD pin
to 3.3 V for those runs, or build with the rig overlays, which have no
control lines.
## What has passed
On 2026-10-09, Zephyr v4.4.0, Ground Control's library v1.0.1, the
@@ -96,5 +158,6 @@ binding 1.0.2:
| a real 9704 (firmware v1.5.14), binding and native_sim, free checks | 2 | all pass |
Not yet: a message through a real modem and satellite, which costs
airtime and needs the sky (`CLOUDLOOP.md`, "The order to test in"), and
the power pins on a board that has them wired.
airtime and needs the sky (`CLOUDLOOP.md`, "The order to test in"), the
power pins on a board that has them wired, and the shell over WiFi on a
board.
+147
View File
@@ -0,0 +1,147 @@
# 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 | |
| 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). The modem's supply is its own, at the voltage
and peak current Ground Control's manual gives, not the Stamp's 3.3 V.
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.
- 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:
```sh
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.
## 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
```sh
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:
```sh
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) |
| the LED and button | built, not yet run |
| a real 9704 on this board | not yet |