This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
doc:crazyflie:syslink:index [2015-02-25 14:49] arnaud [Radio RSSI] |
doc:crazyflie:syslink:index [2020-05-12 14:14] (current) kimberly |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <WRAP center round important 60%> | ||
+ | This page has deprecated and moved to the new documentation framework of the main Bitcraze website. Please go to [[https:// | ||
+ | </ | ||
+ | |||
+ | ====== Syslink protocol ====== | ||
+ | |||
+ | Syslink is the protocol used between the STM32 and NRF51 in Crazyflie 2.0. It handles low level communication on the serial port. | ||
+ | |||
+ | ===== Physical format ===== | ||
+ | |||
+ | In Crazyflie 2.0 syslink is transmitted on serial port at 1MBaud. It is a packet-based protocol. | ||
+ | |||
+ | < | ||
+ | +-----------+------+-----+=============+-----+-----+ | ||
+ | | | ||
+ | +-----------+------+-----+=============+-----+-----+ | ||
+ | </ | ||
+ | |||
+ | * **START** is 2 bytes constant, 0xBC 0xCF. | ||
+ | * **TYPE** defines the type of packet | ||
+ | * **LENGTH** and type are uint8_t, defines the data length. | ||
+ | * **CKSUM** is 2 bytes Fletcher 8 bit checksum. See [[https:// | ||
+ | |||
+ | **Note**: Unless otherwise specified, all numbers are encoded in low-endian form. | ||
+ | |||
+ | ===== Packet types ===== | ||
+ | |||
+ | Packet types is defined in the syslink.h file (in the [[https:// | ||
+ | |||
+ | Packets are organized in groups to ease routing in firmwares: | ||
+ | ^ Group ^ Name ^ Description ^ | ||
+ | | 0x00 | [[# | ||
+ | | 0x10 | [[# | ||
+ | | 0x20 | [[# | ||
+ | |||
+ | A packet type has its group in the high nibble and the type in the low nibble. In the rest of the page packet type are written with group. | ||
+ | |||
+ | ===== Radio packets ===== | ||
+ | |||
+ | ==== RADIO_RAW ==== | ||
+ | |||
+ | * **Type**: 0x00 | ||
+ | * **Data format**: Raw radio packet as sent in the air | ||
+ | |||
+ | This packet carries the raw radio packet. The NRF51 acts as a radio bridge. Because the NRF51 does not have much memory and the STM32 is capable of bursting a lot of data a flow control rules has been made: The STM32 is allowed to send a RADIO_RAW packet only when one RADIO_RAW packet has been received. | ||
+ | |||
+ | The NRF51 is regularly sending CRTP NULL packet or empty packets to the STM32 to get the communication working both ways. | ||
+ | |||
+ | <WRAP round info > | ||
+ | // | ||
+ | So far RADIO_RAW is the only syslink packet that has flow control constrain, all other packets can be sent full duplex at any moment. | ||
+ | </ | ||
+ | |||
+ | ==== RADIO_CHANNEL ==== | ||
+ | * **Type**: 0x01 | ||
+ | * **Data format**: One uint8_t indicating the radio channel | ||
+ | |||
+ | This packet is used only in ESB mode. | ||
+ | |||
+ | Packet sent to the NRF51 to set the radio channel to use. The NRF51 then send back the same packet to confirm that the setting has been done. | ||
+ | |||
+ | NRF51 radio channel are spaced by 1MHz from 2400MHz to 2525MHz. | ||
+ | |||
+ | ==== RADIO_DATARATE ==== | ||
+ | * **Type**: 0x02 | ||
+ | * **Data format**: One uint8_t indicating the radio datarate. | ||
+ | |||
+ | This packet is used only in ESB mode. | ||
+ | |||
+ | Packet sent to the NRF51 to set the radio datarate to use. The NRF51 then send back the same packet to confirm that the setting has been done. | ||
+ | |||
+ | Possible datarate: | ||
+ | ^ Value ^ Datarate ^ | ||
+ | | 0 | 250Kbps | ||
+ | | 1 | 1Mbps | | ||
+ | | 2 | 2Mbps | | ||
+ | |||
+ | ==== RADIO_CONTWAVE ==== | ||
+ | * **Type**: 0x03 | ||
+ | * **Data format**: One uint8_t at 0 for disable, >0 for enable. | ||
+ | |||
+ | Allows to put the nRF51 in continuous wave mode. If enabled the nRF51 will disable Bluetooth advertising and set its radio to emit a continuous sinus wave at the currently set channel frequency. | ||
+ | |||
+ | <WRAP center round important> | ||
+ | // | ||
+ | Continuous wave is a test mode used, among other thing, during manufacturing test. It will affect other wireless communication like Wifi and should be used with care in a test environment | ||
+ | </ | ||
+ | |||
+ | ==== RADIO_RSSI ==== | ||
+ | * **Type**: 0x03 | ||
+ | * **Data format**: One uint8_t indicating the last received pachet RSSI | ||
+ | |||
+ | This packet is meaningful only in ESB mode. | ||
+ | |||
+ | Packet sent 100 times per seconds to the STM32. Contains the power value of the latest received packet. The value is the same as reported by the NRF51: between 40 and 100 which means measurement of -40dBm to -100dBm. | ||
+ | |||
+ | ===== Power management packets ===== | ||
+ | |||
+ | ==== SYSLINK_PM_ONOFF_SWITCHOFF ==== | ||
+ | * **Type**: 0x11 | ||
+ | * **Format**: No data | ||
+ | |||
+ | When sent by the STM32 to the NRF51, the NRF51 switch OFF the system and goes in deep sleep. | ||
+ | |||
+ | ==== SYSLINK_PM_BATTERY_STATE ==== | ||
+ | <WRAP group> | ||
+ | <WRAP column> | ||
+ | * **Type**: 0x13 | ||
+ | * **Format**: | ||
+ | </ | ||
+ | |||
+ | <WRAP column> | ||
+ | <ditaa noedgesep> | ||
+ | | ||
+ | | Flags | VBAT | ISET | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP column> | ||
+ | * **Flags**: Bit0: Charging. Bit1: USB Powered. | ||
+ | * **VBAT**: IEEE single float. Battery voltage. | ||
+ | * **ISET**: IEEE single float. Charge current in milli-Ampers. | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | The SYSLINK_PM_BATTERY_STATE packet is sent 100 times per seconds to the STM32. | ||
+ | ===== One Wire packets ===== |