ST67W611 Async Driver
An async, no_std Rust driver for ST67W611 WiFi modules using the Embassy framework.
Features
- Async/Await: Built on Embassy framework for efficient async I/O
- No-std Compatible: Works without heap allocation using
heaplesscollections - Dual Firmware Support: Works with both T01 and T02 firmware architectures
- WiFi Station Mode: Scan, connect, disconnect, IP configuration
- WiFi AP Mode: Configure and run as access point, DHCP, station management
- TCP/UDP Sockets: Complete socket lifecycle (T01 firmware)
- TLS/SSL Support: Socket-level SSL, SNI, certificate management (T01 firmware)
- HTTP/HTTPS Client: Full request/response handling (T01 firmware)
- MQTT Client: Publish/subscribe with QoS 0/1/2 support (T01 firmware)
- embassy-net Integration: Raw Ethernet frame transport (T02 firmware)
- DNS Resolution: Hostname lookups, custom DNS servers
- SNTP Client: Network time synchronization
- Power Management: Deep sleep mode with timed wake-up
Firmware Architectures
The ST67W611 module supports two firmware architectures:
T01 Firmware (default)
The TCP/IP stack runs on the module. The host communicates via AT commands for socket operations, HTTP, MQTT, etc.
T02 Firmware
The TCP/IP stack runs on the host MCU using embassy-net. The module acts as a WiFi MAC/PHY, passing raw Ethernet frames.
Quick Start (T01 Firmware)
use SpiTransportRdy;
use Signal;
use CriticalSectionRawMutex;
// Static signals for RDY flow control
static TXN_READY: = new;
static HDR_ACK: = new;
async
Quick Start (T02 Firmware with embassy-net)
use ;
use StackResources;
async
See the examples/ directory for complete working examples.
Examples
Diagnostic Examples (work with both T01 and T02)
stm32wba55_spi_diagnostic- SPI frame protocol diagnosticsstm32wba55_diagnostic_wifi_scan- Simple WiFi scan without driverstm32wba55_minimal_test- Basic SPI communication teststm32wba55_debug_rdy- RDY pin debuggingstm32wba55_firmware_programmer- Firmware programming utility
T01 Examples
stm32wba55_t01_wifi_scan- WiFi scan using SpiTransportRdystm32wba55_t01_wifi_test- WiFi test with AT commands
T02 Examples
stm32wba55_t02_embassy_net- Embassy-net integration
Building Examples
# Diagnostic examples (no special features required)
# T01 examples
# T02 examples
Architecture
The driver is organized in layers:
- Bus Layer (
bus/): SPI transport with RDY flow control - AT Command Layer (
at/): Command formatting and parsing - Network Layer (
net/): Socket API (T01) or embassy-net driver (T02) - Protocol Layer: WiFi, TLS, MQTT, HTTP abstractions (T01)
SPI Frame Protocol
Both firmware types use an 8-byte header for SPI communication:
| Offset | Field | Description |
|---|---|---|
| 0-1 | Magic | 0x55AA |
| 2-3 | Length | Payload length (little-endian) |
| 4 | Flags | Version, RX stall indicator |
| 5 | Type | Traffic type (AT=0, STA=1, AP=2) |
| 6-7 | Reserved | Must be 0 |
Memory Usage
The driver is designed for no_std environments without heap allocation:
- Fixed-size collections using
heapless - Static resource pools for sockets and responses
- Configurable buffer sizes
- Typical RAM usage: ~16KB (depends on configuration)
Requirements
- Rust nightly (for Embassy)
- STM32 microcontroller with SPI interface
- ST67W611 WiFi module connected via SPI
- T01 or T02 firmware flashed on the module
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.