[−][src]Module rubble_nrf52810::radio
Integrated 2.4 GHz radio with BLE support.
The radio can be used with Nordic's own proprietary protocol, which I don't really care about, so this will focus on Bluetooth Low-Energy (BLE).
The radio can calculate the CRC, perform data whitening, automatically send the right preamble, and match addresses.
In order to be able to receive packet at all, the length of the currently received packet must be known.
CRC
To be able to correctly compute the CRC, the position and length of the transmitted PDU must be known. The radio works with a flexible frame layout that looks like this on air:
(B = Byte = Octet; b = bit = symbol)
If field length is specified in B
, only whole Bytes are allowed. If the length is specified
in b
, any number of bits in the given range is allowed.
+----------+---------+--------+---------+----------+----------+--------------+---------+
| Preamble | Base | Prefix | S0 | Length | S1 | Payload | CRC |
| (1 B) | (2-4 B) | (1 B) | (0-1 B) | (0-15 b) | (0-15 b) | (`Length` B) | (0-3 B) |
+----------+---------+--------+---------+----------+----------+--------------+---------+
\ / \ /
\------+-------/ \---------------------+--------------------/
| |
Address PDU
If S0, Length, and S1 are present (= length > 0 bits), their sizes are always rounded up to
whole Bytes in RAM. The least significant bits of the in-RAM Bytes will be sent/received over
the air. This poses a problem, since the packet isn't actually sent as it is in memory. The
stack works around this by only filling the Payload
by itself and passing a Header
struct to
the Transmitter
, which can then do whatever is necessary to encode the header so that it's
sent correctly.
In our case, this involves "splitting" the header into the S0
field (everything preceding the
length), the Length
field, and the S1
field (which just contains 2 unused bits, but they
must still be sent, of course).
Structs
BleRadio | An interface to the nRF radio in BLE mode. |
Type Definitions
PacketBuffer | A packet buffer that can hold header and payload of any advertising or data channel packet. |