Expand description
Reaching a concentrator through the microcontroller on a USB card.
A CoreCell on SPI is wired straight to the host. The USB version of the same card puts an STM32 between them: the host talks to the microcontroller over a serial port, and the microcontroller does the SPI on the host’s behalf, drives the reset and supply pins, and reports its own clock and temperature. Everything the concentrator driver sends still goes out as the same SPI frames; they are carried inside a message to the bridge rather than clocked out by the host.
Every message is a four byte header, an identifier the host picks, a size, and an order,
then that many bytes of payload. The bridge answers with the same shape, the order moved
up by ACK. One order carries many SPI transfers at once: each is an entry naming a
target, a length, and the raw frame, and the answer echoes every entry with a status and
the bytes the chip clocked back, which is where a read finds its value.
This module builds those messages and reads the answers. It opens no port.
Structs§
- Bulk
- SPI transfers gathered into one order to the bridge.
- Header
- The header on every message, either way.
- Identity
- Who a bridge says it is.
- Replies
- Walks the entries of a bulk answer.
- Reply
- One entry of a bulk answer.
- Status
- How a bridge is doing.
Enums§
- Bridge
Error - What the bridge refused, or answered wrongly.
Constants§
- ACK
- What the bridge adds to an order to answer it.
- BAUD
- The nominal speed the port is opened at.
- BULK_
CHUNK - The most bytes of SPI entries one bulk order carries.
- BULK_
ENTRIES - The most SPI entries one bulk order carries.
- ENTRY_
MODIFY - An SPI entry that changes some bits of one register, done on the bridge.
- ENTRY_
TRANSFER - An SPI entry that clocks a frame out and the answer back.
- FIRMWARE_
VERSION - The bridge firmware this crate was written against, as the ping reports it after its first character.
- GPIO_
PORT - The bridge pin port every card pin is on.
- HEADER_
LEN - How long a header is: an identifier, a size, and an order.
- MAX_
MESSAGE - The most bytes one message carries, on either side.
- ORDER_
BOOTLOADER - Drops the bridge into its bootloader, for a firmware update.
- ORDER_
ERROR - The bridge answering that it could not read an order.
- ORDER_
PING - Asks the bridge who it is: a unique identifier and a firmware version.
- ORDER_
RESET - Resets the card.
- ORDER_
SPI - Carries SPI transfers to the concentrator, or the radio beside it.
- ORDER_
STATUS - Asks the bridge for its clock and its temperature.
- ORDER_
WRITE_ GPIO - Drives one of the bridge’s pins.
- PING_
LEN - How many bytes a ping answers with.
- PIN_
POWER - The pin that switches the concentrator’s supply on.
- PIN_
RADIO_ RESET - The pin that resets the radio beside the concentrator, active low.
- PIN_
RESET - The pin that resets the concentrator, active high.
- STATUS_
LEN - How many bytes a status answers with.
- TARGET_
CONCENTRATOR - The concentrator, and the front ends behind it, as an SPI target.
- TARGET_
LISTENER - The radio beside the concentrator that listens before it talks.
Functions§
- reset
- The payload that resets the card.
- took
- Reads the one byte status a pin write or a reset answers with.
- write_
gpio - The payload that drives a pin.