- Breakout boards
The Crazyradio dongle is based on a Nordic semiconductor nRF24LU1 chip. The radio communication is done using the Nordic “Enhanced ShockBurst™” packet protocol in PTX mode with acknowledge. Variable sized packet, from 1 to 32 bytes, can be send and acknowledged by the copter. The acknowledgement packet can contain a payload from 0 to 32 Bytes.
This page documents the protocol used in version 0.52 of the Crazyradio dongle. Future version (up to 1.0) will be kept compatible.
Crazyradio is configured in PTX mode. It can communicate with Nordic chips compatible with the nrf24L family (at least nrf24L01p, nRF51 and nRF52 tested). In order to communicate with the Crazyradio the target has to be configure correctly:
The Crazyflie is already configured that way. The relevant source code can be seen in radiolink.c.
The USB devices has the VID/PID couple 0x1915/0x7777.
|EP0||Control||Control endpoint. Used to configure the dongle|
|EP1IN/OUT||Bulk||Data endpoints. Used to send and receive radio packets|
When the radio dongle is configured to use PTX (emitter) mode it sends a packet to the copter and waits for the acknowledge. The acknowledge can contain a payload which is the mean to receive data. If the auto acknowledge is disabled there is no IN transaction.
To send a packet, the following sequence must be followed:
The status byte contains flags indicating the quality of the link:
|4..7||Number of retransmission|
Crazyradio vendor requests summary:
|0x40||SET_DATA_RATE (0x03)||Data rate||Zero||Zero||None|
The nRF24LU1 chip provides 126 Channels of 1MHz from 2400MHz to 2525MHz. The channel parameter shall be between 0 and 125 (if not, the command will be ignored).
The radio channel is set as soon as the USB setup transaction is completed, which takes about 1ms. The new frequency is going to be used for the following transferred packets. The default value for the radio channel is 2.
The packet sent by the radio contains a 5 bytes address. The same address must be configured in the receiver for the communication to work.
The address must follow the requirement of section 188.8.131.52 of the nRF24LU1 documentation:
Addresses where the level shifts only one time (that is, 000FFFFFFF) can often be detected in noise and can give a false detection, which may give a raised Packet-Error-Rate. Addresses as a continuation of the preamble (hi-low toggling) raises the Packet-Error-Rate.
The default address is 0xE7E7E7E7E7.
|0x40||SET_DATA_RATE (0x03)||Data rate||Zero||Zero||None|
Possible values for the data rate:
|Value||Radio data rate|
Sets the radio amplifier output power. Possible values:
After sending a packet the radio automatically waits for an acknowledge. ARD and ARC permit to configure the delay the radio waits for the acknowledge and the number of times the transfer will be retried in case the acknowledge is not received in that delay.
The delay ARD depends on the length, in seconds, of the ACK packet. This depends on the data rate and the payload length contained in the ACK packet. The ARD can be configured either by steps of 250us or by ACK payload length. If the ACK payload length is configured, the time will be recalculated automatically even if the data rate is changed. To set the ACK payload length the bit 7 of ARD must be set (length | 0x80).
Possible values for ARD:
|Value||ARD wait time|
|Value||ACK payload length|
ARC configures the number of times the radio will retry a transfer if the ACK has not been received, it can be set from 0 to 15.
By default ARD=32Bytes (0xA0) and ARC=3.
By default, the Crazyradio is configured with auto ACK enabled. This means that after transmitting a packet, the radio waits for an acknowledge from the receiver. This setting permits to deactivate waiting for the ACK packet so that the packet will be sent only one time and there is no guarantee that it has been correctly received.
|0||Auto ACK deactivated|
|Not 0||Auto ACK enable (default)|
The nRF24L radio chip provides a test mode in which a continuous non-modulated sine wave is emitted. This permits, among other things, to test the quality of the RF elements of the board. When this mode is activated the radio dongle does not transmit any packets.
While the continuous carrier mode is active, it is possible to set channel and power to change the frequency and power of the emitted wave.
|0||Dongle working normally (default)|
|Not 0||Dongle in continuous carrier mode|
This function is implemented in Crazyradio version 0.5 and over.
Scan a range of channels and compile a list of channel from which an ACK has been received. The command START_SCAN_CHANNELS should be executed first with start being the first scanned channel and stop the last one. Those should be within 0 to 125. The data is the packet payload sent on each channel, it should be at least one byte long.
All parameters, except the channel, are used unmodified during the scan. If the data rate is set to 2MBPs the scan is done every second channel. To get the list of channels that answered, GET_SCANN_CHANNELS should be called just after a scan. Up to 63 bytes are returned corresponding to up to 63 channels on which the packet was acknowledged.
Note After scanning, the channel will be set to the last scanned channel.
Warning On some platform, an empty scan will return a buffer of 64 bytes. This is though to be a USB host implementation bug, see ticket #9 in the Crazyradio firmware project. If a buffer of more than 63 bytes is returned, it means that no channel have been received.
This command is used to launch the Nordic semiconductor USB bootloader. After sending this command, a USB reset shall be emitted which will trigger the dongle to start the bootloader. After sending this command, the Dongle is only waiting for a USB reset which means that any other commands or data will be ignored.
The bootloader is pre-loaded by Nordic Semi. in the nRF24LU1 chip at the address 0x7800. The Crazyradio firmware will jump to it when the sequence LAUCH_BOOTLOADER followed by a USB reset is executed. The bootloader will appear at VID/PID of 0x1915/0x0101. See nRF24LU1 datasheet for the bootloader documentation.
A PC client for the bootloader is part of the Crazyflie ground station program.
The Crazyradio dongle is currently only operating in PTX mode. To get a downlink from the copter the ACK payload is used, which means that data are received only when data are sent. In the case of Crazyflie, to have bidirectional communication even when no data is send, a null packet (0xff) is sent periodically to pull the downlink data stream.
For Crazyflie the communication protocol is described in Communication protocol Overview.