-
Notifications
You must be signed in to change notification settings - Fork 0
Bluetooth Transport
The Glead ZYM-BI201 (TI CC2540) is connected directly to the F411. Rewair uses it as a transparent UART-to-GATT bridge. The physical pinout is documented in Hardware Architecture.
USART1 runs at 115200 8N1 and is dedicated to the BI201; WICED stdio is
disabled. On startup Rewair resets the module, sends AT#RS, then selects
transparent mode with AT#WM=0.
Service UUID:
2f2dfff0-2e85-649d-3545-3586428f5da3
| Direction | Characteristic | Operation |
|---|---|---|
| F411 → central | 2f2dfff4-2e85-649d-3545-3586428f5da3 |
Notify |
| Central → F411 | 2f2dfff5-2e85-649d-3545-3586428f5da3 |
Write with response |
The tested ATT MTU is 23, leaving 20 bytes per GATT value. GATT boundaries are stream chunks and do not align with Rewair frames.
Protocol version 1 COBS-encodes each record, appends a little-endian CRC32, and
uses 0x00 as the frame delimiter.
| Field | Size | Notes |
|---|---|---|
| Version | 1 | 1 |
| Type | 1 | Request 1, response 2, event 3, ACK 4
|
| Flags | 1 |
FIRST=0x01, MORE=0x02
|
| Operation | 1 | Stable API operation ID |
| Request ID | 2 | Little-endian |
| Sequence | 2 | Fragment number, starting at zero |
| Status | 2 | HTTP-compatible; zero in requests and ACKs |
| Payload length | 2 | At most 32 bytes |
| Payload | 0–32 | UTF-8 JSON bytes |
| CRC32 | 4 | Header and payload |
Complete requests are limited to 1024 bytes and responses to 2048 bytes.
The CC2540 bridge has no UART flow control. Rewair uses 32-byte logical
fragments and stop-and-wait response delivery: the central ACKs each fragment
with MORE, the F411 waits 150 ms before the next fragment, and an ACK times
out after five seconds. The F411 also waits 200 ms before its first response so
the incoming UART request can drain.
The transport uses the shared rewair_api operation IDs:
| ID | Operation | Bluetooth status |
|---|---|---|
| 1 | Capabilities | Enabled |
| 2 | Status | Enabled |
| 3 | Scan | Enabled |
| 4 | Saved networks | Enabled |
| 5–12 | Join, forget, priority, settings, time, display, reset, update | Locked |
Capabilities reports "mutations":false. Bench testing showed that the BI201
service accepted connections and writes without an authorization prompt, so
mutations remain disabled pending an authenticated Rewair session. OTA remains
Wi-Fi-only.
The HTTPS-hosted UI provides the normal Web Bluetooth client; see Web UI and API. For protocol diagnostics on macOS:
uv run --with bleak==3.0.1 python \
tools/bi201/ble_api_probe.py --read-all --quiet-framestools/bi201/ble_gatt_probe.py works below the framed API. The standalone
wiced/apps/rewair/bi201_probe firmware and its build/flash/read scripts are
retained for module-level UART and GATT investigation.