ashv2
Implementation of Silicon Labs' Asynchronous Serial Host protocol v2 (ASHv2), host side.
Specification
Silicon Labs publishes the documentation online:
Current implementation status
The crate currently provides:
- Frame parsing/encoding for
DATA,ACK,NAK,RST,RST-ACK, andERROR. - CRC-16 validation/generation for all supported frame types.
- Byte stuffing/unstuffing and ASH payload randomization (masking/unmasking).
- An async actor runtime (
Actor) with separate transmitter/receiver tasks. - Automatic initial reset handshake (
RST->RST-ACK) before normal traffic. - Automatic handling of inbound
ACK/NAKand retransmission of queuedDATAframes. - Automatic reset/recovery on protocol errors (
ERROR,RST, and selected I/O failures).
Important behavior details:
Proxy::send(payload).awaitconfirms local transmission attempt (I/O success), not the remote ASH response payload.- Incoming
DATApayloads are delivered through the response channel passed toActor::new(...). - Payload type is
heapless::Vec<u8, MAX_PAYLOAD_SIZE>(MAX_PAYLOAD_SIZEdefaults to128).
Compile-time tunables (via const_env):
ASHV2_MAX_PAYLOAD_SIZE(default:128)ASHV2_T_RSTACK_MAX_MILLIS(default:3200)ASHV2_TX_K(default:5)ASHV2_T_RX_ACK_MAX_MILLIS(default:3200)ASHV2_REQUEUE_DELAY_MILLIS(default:100)
Usage
use ;
use channel;
async
Development
The CI workflow currently runs:
cargo +nightly fmt --checkcargo clippy --all-features -- -A clippy::multiple_crate_versions -D warningscargo test --all-featurescargo build --all-features --releasecargo vet check
Legal
This project is free software and is not affiliated with Silicon Labs.
Credits
Special thanks to Simon Farnsworth, Kevin Reid, and the community at https://users.rust-lang.org/.