Skip to main content

Module rx

Module rx 

Source
Expand description

Reading packets out of the concentrator.

Received packets arrive in one buffer, back to back, each wrapped in metadata the chip writes around it: a sync word and nine bytes saying how long the payload is and how it was demodulated, then the payload, then fourteen more bytes of what the receiver made of it.

The metadata is in two halves and they are addressed differently. Everything before the payload is counted from the start of the packet; everything after it is counted from the start plus the payload length, which is why a reader has to know how long the payload is before it can find the signal levels or the timestamp.

A packet can also carry fine timestamp metrics after all of that, two bytes each, and the count lives in the tail. A reader that ignores them finds the next packet in the wrong place, so packet_len takes them into account and the walk in packets stays aligned.

Nothing here reads a register. A buffer is bytes, and this turns those bytes into packets, so a capture from a working gateway can be replayed and checked without hardware.

Structs§

Packet
A packet as the concentrator wrote it into the buffer.
Quality
What the receiver made of a packet it heard.

Enums§

Modem
Which demodulator heard a packet.
RxError
Why a buffer did not read as a packet.

Constants§

BUFFER_LEN
How many bytes the receive buffer holds in all.
FSK_MODEM
The identifier of the frequency shift keying demodulator.
HEAD_METADATA
How many bytes of metadata come before the payload, the sync word included.
LORA_MULTI_MODEM_MAX
The highest identifier belonging to a multi-spreading-factor LoRa demodulator.
LORA_STD_MODEM
The identifier of the single-spreading-factor LoRa demodulator.
MAX_PAYLOAD
The largest payload a packet carries.
METRIC_LEN
How many bytes each fine timestamp metric takes.
SYNC_BYTE_0
The first byte of the word that marks the start of a packet.
SYNC_BYTE_1
The second byte of that word.
TAIL_METADATA
How many bytes of metadata come after it, before any timestamp metrics.

Functions§

packet_len
How many bytes a packet takes in the buffer.
packets
Walks every packet the buffer holds, in the order the chip wrote them.
parse
Reads the one packet that starts at the front of these bytes.