User Tools

Site Tools


doc:crazyradio:usb:index

This is an old revision of the document!


Usb and Radio protocol of the Crazyradio dongle

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 acknoledge. Variable size packet, from 1 to 32 bytes, can be send and acknoledged by the copter. The acknoledgement packet can contains a payload from 0 to 32Bytes.

This page document the protocol used in the version 0.40 of the Crazyradio dongle. Future version (up to 1.0) will be kept compatible.

USB protocol

The USB devices have 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

Dongle configuration

Crazyradio vendor requests summary:

bmRequestType bRequest wValue wIndex wLength data
0x40 SET_RADIO_CHANNEL (0x01) channel Zero Zero None
0x40 SET_RADIO_ADDRESS (0x02) Zero Zero 5 Address
0x40 SET_DATA_RATE (0x03) Datarate Zero Zero None
0x40 SET_RADIO_POWER (0x04) Power Zero Zero None
0x40 SET_RADIO_ARD (0x05) ARD Zero Zero None
0x40 SET_RADIO_ARC (0x06) ARC Zero Zero None
0x40 SET_CONT_CARRIER (0x20) Active Zero Zero None
0x40 LAUNCH_BOOTLOADER (0xFF) Zero Zero Zero None

Set radio channel

bmRequestType bRequest wValue wIndex wLength data
0x40 SET_RADIO_CHANNEL (0x01) channel Zero Zero None

The nrf24L chips 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 setup transaction is completed which takes about 1ms. The new frequency is going to be used for the following transfered packets. Default value for the radio channel is 2.

Set radio address

bmRequestType bRequest wValue wIndex wLength data
0x40 SET_RADIO_ADDRESS (0x02) Zero Zero 5 Address

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 the section 6.4.3.2 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.

Set datarate

bmRequestType bRequest wValue wIndex wLength data
0x40 SET_DATA_RATE (0x03) Datarate Zero Zero None

Possible values for the datarate:

Value Radio datarate
0 250Kbps
1 1MBps
2 2Mbps (Default)

Set radio power

bmRequestType bRequest wValue wIndex wLength data
0x40 SET_RADIO_POWER (0x04) Power Zero Zero None

Configure auto retry (ARD/ARC)

bmRequestType bRequest wValue wIndex wLength data
0x40 SET_RADIO_ARD (0x05) ARD Zero Zero None
0x40 SET_RADIO_ARC (0x06) ARC Zero Zero None

After sending a packet the radio automatically waits for an acknowledge. ARD and ARC permits to configure the delay the radio waits for the acknowledge and the number of time the transfer will be retried in case the acknowledge is not received in that delay.

The delay ARD depends of the length, in second, of the ack packed. This depends of the datarate and the Payload length contained in the Ack packet. The ARD can be configured either by step of 250us or by ack payload length. If the ack payload length is configured the time will be recalculated automatically even if the datarate is changed. To set the Ack payload lenght the bit 7 of Ard must be set (length | 0x80)

Possible values for ARD:

Value ARD wait time
0x00 250us
0x01 500us
0x0F 4000us
Value Ack payload length
0x80 0Byte
0x81 1Byte
0xA0 32Bytes

ARC configures the number of time 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.

Continuous carrier mode

Launch bootloader

Data transfer

The radio dongle is configured in PTX mode (in the Nordic terminology) which means that it sends packet to the copter and waits for the acknowledge. The acknowledge can contains a Payload which is the mean to get data from the copter.

The packet is to send is sent to the EP1 and the ack status is then received from the EP1. There are no buffering in the radio dongle, the ACK must be received by the PC before the next packet can be sent.

This protocol permits to transfer about 500 packets per seconds.

Radio protocol

doc/crazyradio/usb/index.1337032987.txt.gz · Last modified: 2015-07-15 16:30 (external edit)