Replace custom UDP RGB with DDP on 4048, fix picotool -f ordering for v1.1.2, and chunk test frames under MTU so the W5500 receives them. Co-authored-by: Cursor <cursoragent@cursor.com>
86 lines
2.0 KiB
Markdown
86 lines
2.0 KiB
Markdown
# Portal panel firmware (Pico + W5500 + WS2812)
|
||
|
||
DDP RGB panel adapter for the [portal](https://git.technical.kiwi/technicalkiwi/portal.git) project.
|
||
Host renders patterns; this firmware receives frames on **UDP 4048** (DDP).
|
||
|
||
## Layout
|
||
|
||
```text
|
||
led-driver-8/
|
||
├── firmware/ # Pico SDK C + W5500
|
||
├── examples/test_strips.py
|
||
├── .env.example
|
||
└── README.md
|
||
```
|
||
|
||
## Hardware
|
||
|
||
| Signal | GPIO |
|
||
|--------|------|
|
||
| W5500 CS | GP9 |
|
||
| SPI1 SCK | GP10 |
|
||
| SPI1 MOSI | GP11 |
|
||
| SPI1 MISO | GP12 |
|
||
| W5500 RST | GP13 |
|
||
| Status LED | GP25 |
|
||
| WS2812 strip 0–7 | GP18, 19, 20, 21, 22, 26, 27, 28 |
|
||
|
||
Eight strips (one PIO SM each). Pixel output uses **DMA → PIO**. One DDP packet carries all strips (equal LED count each). `MAX_LEDS` (512) is per-strip capacity only.
|
||
|
||
## Build / flash
|
||
|
||
```bash
|
||
cd firmware
|
||
make deploy PANEL_ID=0
|
||
make reset && make monitor
|
||
```
|
||
|
||
Network options live in `.env` (see `.env.example`):
|
||
|
||
```env
|
||
PANEL_ID=0
|
||
NETWORK=static
|
||
IP=10.1.1.10
|
||
NETMASK=255.255.255.0
|
||
GATEWAY=10.1.1.1
|
||
DNS=10.1.1.1
|
||
```
|
||
|
||
| Panel | IP | MAC last byte |
|
||
|-------|-----|---------------|
|
||
| 0 | 10.1.1.10 | `00` |
|
||
| … | … | … |
|
||
| 4 | 10.1.1.14 | `04` |
|
||
| 255 (bench) | 10.1.1.19 | `FF` |
|
||
|
||
## Test
|
||
|
||
Self-contained (stdlib only):
|
||
|
||
```bash
|
||
python3 examples/test_strips.py
|
||
python3 examples/test_strips.py --host 10.1.1.10 --leds 64
|
||
```
|
||
|
||
Lights each strip alone with a unique colour, then flashes all strips R/G/B/white.
|
||
|
||
## DDP protocol (port 4048)
|
||
|
||
[Distributed Display Protocol](http://www.3waylabs.com/ddp/) — WLED-compatible.
|
||
|
||
| Field | Value |
|
||
|-------|--------|
|
||
| Port | UDP **4048** |
|
||
| Destination ID | **1** (or 255) |
|
||
| Header | 10 bytes (14 if timecode flag set) |
|
||
| Data type | RGB888 (`0x0B`) |
|
||
| PUSH | split frame onto strips and show |
|
||
|
||
**Payload layout** (one packet for the whole panel):
|
||
|
||
```text
|
||
strip0 RGB | strip1 RGB | … | strip7 RGB
|
||
```
|
||
|
||
LED count per strip is `total_pixels / 8` (must divide evenly). `offset` / `length` address that linear buffer if a frame is split across packets.
|