This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
doc:crazyradio:usb:index [2012-05-17 13:53] arnaud |
doc:crazyradio:usb:index [2013-07-11 17:54] arnaud [Radio protocol] |
||
---|---|---|---|
Line 12: | Line 12: | ||
| EP1IN/OUT | Bulk | Data endpoints. Used to send and receive radio packets | | | EP1IN/OUT | Bulk | Data endpoints. Used to send and receive radio packets | | ||
- | ==== Dongle configuration ==== | + | ==== Data transfer ==== |
+ | |||
+ | The radio dongle being configured in PTX (emmiter) mode it sends packet to the copter and waits for the acknowledge. The acknowledge can contains a Payload which is the mean to receive data. If the auto acknowledge is disable there is no IN transaction. | ||
+ | |||
+ | To send a packet the following sequence must be followes: | ||
+ | * Send the packet to EP1_OUT. Its length should be between 1 to 32Bytes | ||
+ | * Read the ACK from EP1_IN. The first byte is the transfers status and the following bytes are the content of the ACK payload, if any. | ||
+ | |||
+ | < | ||
+ | | ||
+ | < | ||
+ | +-------------------------+ | ||
+ | To EP1_OUT: | ||
+ | +-------------------------+ | ||
+ | | ||
+ | < | ||
+ | +--------+----------------------+ | ||
+ | From EP1_IN: | ||
+ | +--------+----------------------+ | ||
+ | </ | ||
+ | |||
+ | The status byte contains flags indicating the quality of the link: | ||
+ | |||
+ | ^ Status | ||
+ | | 4..7 | Number of retransmition | | ||
+ | | 2..3 | Reserved | ||
+ | | 1 | Power detector | ||
+ | | 0 | Ack received | ||
+ | |||
+ | ==== Dongle configuration | ||
Crazyradio vendor requests summary: | Crazyradio vendor requests summary: | ||
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
- | | 0x40 | SET_RADIO_CHANNEL (0x01) | channel | + | | 0x40 | SET_RADIO_CHANNEL (0x01) |
- | | 0x40 | SET_RADIO_ADDRESS (0x02) | Zero | Zero | 5 | Address | | + | | 0x40 | SET_RADIO_ADDRESS (0x02) |
- | | 0x40 | SET_DATA_RATE (0x03) | + | | 0x40 | SET_DATA_RATE (0x03) |
- | | 0x40 | SET_RADIO_POWER (0x04) | + | | 0x40 | SET_RADIO_POWER (0x04) |
- | | 0x40 | SET_RADIO_ARD (0x05) | + | | 0x40 | SET_RADIO_ARD (0x05) |
- | | 0x40 | SET_RADIO_ARC (0x06) | + | | 0x40 | SET_RADIO_ARC (0x06) |
- | | 0x40 | ACK_ENABLE (0x10) | + | | 0x40 | ACK_ENABLE (0x10) |
- | | 0x40 | SET_CONT_CARRIER (0x20) | + | | 0x40 | SET_CONT_CARRIER (0x20) |
- | | 0x40 | LAUNCH_BOOTLOADER (0xFF) | Zero | Zero | Zero | None | | + | | 0x40 | START_SCAN_CHANNELS (0x21) | Start | Stop | Length |
+ | | 0xC0 | GET_SCAN_CHANNELS (0x21) | ||
+ | | 0x40 | LAUNCH_BOOTLOADER (0xFF) | ||
- | === Set radio channel === | + | ==== Set radio channel |
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
Line 34: | Line 65: | ||
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 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. | + | 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 transfered packets. Default value for the radio channel is 2. |
- | === Set radio address === | + | ==== Set radio address |
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
Line 53: | Line 84: | ||
The default address is 0xE7E7E7E7E7. | The default address is 0xE7E7E7E7E7. | ||
- | === Set datarate === | + | ==== Set datarate |
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
Line 65: | Line 96: | ||
- | === Set radio power === | + | ==== Set radio power ==== |
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
| 0x40 | SET_RADIO_POWER (0x04) | | 0x40 | SET_RADIO_POWER (0x04) | ||
+ | Sets the radio amplifier output power. Possible values: | ||
- | === Configure auto retry (ARD/ARC) === | + | ^ Value ^ Power ^ |
+ | | 0 | -18dBm | ||
+ | | 1 | -12dBm | ||
+ | | 2 | -6dBm | | ||
+ | | 3 | 0dBm | | ||
+ | |||
+ | ==== Configure auto retry (ARD/ | ||
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
Line 88: | Line 126: | ||
| ... | ... | | | ... | ... | | ||
| 0x0F | 4000us | | 0x0F | 4000us | ||
- | |||
^ Value ^ Ack payload length ^ | ^ Value ^ Ack payload length ^ | ||
| 0x80 | 0Byte | | | 0x80 | 0Byte | | ||
Line 99: | Line 136: | ||
By default ARD=32Bytes (0xA0) and ARC=3. | By default ARD=32Bytes (0xA0) and ARC=3. | ||
- | === Continuous carrier mode === | + | ==== Auto ACK configuration ==== |
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
Line 110: | Line 147: | ||
| Not 0 | Auto ack enable (default) | | | Not 0 | Auto ack enable (default) | | ||
- | === Continuous carrier mode === | + | ==== Continuous carrier mode ==== |
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
Line 123: | Line 160: | ||
| Not 0 | Dongle in continuous carrier mode | | | Not 0 | Dongle in continuous carrier mode | | ||
- | === Launch bootloader | + | ==== Channels scanning |
+ | |||
+ | This function is implemented in Crazyradio version 0.5 and over. | ||
^ bmRequestType ^ bRequest | ^ bmRequestType ^ bRequest | ||
- | | 0x40 | LAUNCH_BOOTLOADER | + | | 0x40 | START_SCAN_CHANNELS |
+ | | 0xC0 | GET_SCAN_CHANNELS (0x21) | ||
- | This command is used to launch the Nordic semiconductor USB bootloader. After sending this command | + | Scan a range of channels and compile a list of channel from which an ack has been received. The command |
- | 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 following by a USB reset is executed. The bootloader will appear at VID/ | + | All parameters, except |
- | A PC client for the bootloader is part of the Crazyflie ground station program. | + | Note. After scanning |
- | ==== Data transfer | + | ==== Launch bootloader |
- | 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. | + | ^ bmRequestType ^ bRequest |
+ | | 0x40 | LAUNCH_BOOTLOADER | ||
- | The packet | + | This command |
- | < | + | 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 following by a USB reset is executed. The bootloader will appear at VID/PID of 0x1915/ |
- | 1..32Bytes | + | |
- | < | + | A PC client for the bootloader is part of the Crazyflie ground station program. |
- | +-------------------------+ | + | |
- | To EP1_OUT: | + | |
- | +-------------------------+ | + | |
- | 1..32 Bytes | + | |
- | 1Byte < | + | |
- | | + | |
- | From EP1_IN: | + | |
- | +-----+----------------------+ | + | |
- | </ | + | |
- | This protocol permits to transfer about 500 packets per seconds. | ||
===== Radio protocol ===== | ===== Radio protocol ===== | ||
+ | The Crazyradio dongle is currently only operating in PTX mode. To get 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 [[projects: |