nrf52

Module ieee802154_radio

Source
Expand description

IEEE 802.15.4 radio driver for nRF52

This driver implements a subset of 802.15.4 sending and receiving for the nRF52840 chip per the nRF52840_PS_v1.0 spec. Upon calling the initialization function, the chip is powered on and configured to the fields of the Radio struct. This driver maintains a state machine between receiving, transmitting, and sending acknowledgements. Because the nRF52840 15.4 radio chip does not possess hardware support for ACK, this driver implements software support for sending ACK when a received packet requests to be acknowledged. The driver currently lacks support to listen for requested ACK on packets the radio has sent. As of 8/14/23, the driver is able to send and receive 15.4 packets as used in the basic 15.4 libtock-c apps.

§Driver State Machine

To aid in future implementations, this describes a simplified and concise version of the nrf52840 radio state machine specification and the state machine this driver separately maintains.

To interact with the radio, tasks are issued to the radio which in turn trigger interrupt events. To receive, the radio must first “ramp up”. The RXRU state is entered by issuing a RXEN task. Once the radio has ramped up successfully, it is now in the RXIDLE state and triggers a READY interrupt event. To optimize the radio’s operation, this driver enables hardware shortcuts such that upon receiving the READY event, the radio chip immediately triggers a START task. The START task notifies the radio to begin officially “listening for packets” (RX state). Upon completing receiving the packet, the radio issues an END event. The driver then determines if the received packet has requested to be acknowledged (bit flag) and sends an ACK accordingly. Finally, the received packet buffer and accompanying fields are passed to the registered radio client. This marks the end of a receive cycle and a new READY event is issued to once again begin listening for packets.

When a registered radio client wishes to send a packet. The transmit(…) method is called. To transmit a packet, the radio must first ramp up for receiving and then perform a clear channel assessment by listening for a specified period of time to determine if there is “traffic”. If traffic is detected, the radio sets an alarm and waits to perform another CCA after this backoff. If the channel is determined to be clear, the radio then begins a TX ramp up, enters a TX state and then sends the packet. To progress through these states, hardware shortcuts are once again enabled in this driver. The driver first issues a DISABLE task. A hardware shortcut is enabled so that upon receipt of the disable task, the radio automatically issues a RXEN task to enter the RXRU state. Additionally, a shortcut is enabled such that when the RXREADY event is received, the radio automatically issues a CCA_START task. Finally, a shortcut is also enabled such that upon receiving a CCAIDLE event the radio automatically issues a TXEN event to ramp up the radio. The driver then handles receiving the READY interrupt event and triggers the START task to begin sending the packet. Upon completing the sending of the packet, the radio issues an END event, to which the driver then returns the radio to a receiving mode as described above. (For a more complete explanation of the radio’s operation, refer to nRF52840_PS_v1.0)

This radio state machine provides nine possible states the radio can exist in. For ease of implementation and clarity, this driver also maintains a simplified state machine. These states consist of the radio being off (OFF), receiving (RX), transmitting (TX), or acknowledging (ACK).

Structs§

Constants§