This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
doc:crazyflie:crtp:mem [2014-11-10 10:19] macke |
doc:crazyflie:crtp:mem [2020-05-12 14:22] (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:// | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | ====== Memory access ====== | ||
+ | Memory access is not used for the [[projects: | ||
+ | * Get information about which memories are available | ||
+ | * Read/ | ||
+ | |||
+ | Currently the following memories are supported: | ||
+ | * Crazyflie 2.0 onboard EEPROM | ||
+ | * Crazyflie 2.0 expansion board 1-wire memories | ||
+ | |||
+ | There' | ||
+ | |||
+ | ====== Logical flow ====== | ||
+ | Getting information and reading/ | ||
+ | |||
+ | < | ||
+ | / | ||
+ | --> | Get number of memories |----->| Fetch memory info |---->| More memories? |--------> | ||
+ | \------------------------/ | ||
+ | ^ | | ||
+ | | | | ||
+ | \------------------------/ | ||
+ | Yes | ||
+ | </ | ||
+ | ====== Communication protocol ====== | ||
+ | The memory port uses 3 different channels: | ||
+ | ^ **Port** | ||
+ | | | ||
+ | | | ||
+ | | | ||
+ | |||
+ | ===== Channel 0: Info/ | ||
+ | This channel is used to get the number of memories present, information about the memories and the possibility to mass erase memories. The first byte of every packet is a command byte: | ||
+ | |||
+ | ^ Command byte ^ Command | ||
+ | | 1 | GET_NBR_OF_MEMS | Get the number of memories | | ||
+ | | 2 | GET_MEM_INFO | ||
+ | | 3 | SET_MEM_ERASE | ||
+ | |||
+ | ==== GET_NBR_OF_MEMS ==== | ||
+ | This command is used to get the number of memories present. | ||
+ | |||
+ | The request from host to Crazyflie: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | |||
+ | Reply from Crazyflie to host: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | |||
+ | Example where there are 3 memories present on the Crazyflie: | ||
+ | < | ||
+ | Host-to-Crazyflie: | ||
+ | Crazyflie-to-Host: | ||
+ | </ | ||
+ | |||
+ | ==== GET_MEM_INFO ==== | ||
+ | This command is used to get information about a memory give it's id. The id of memories is sequential and is from 0 to one less than the returned number of memories from GET_NUMBER_OF_MEMS. | ||
+ | |||
+ | The request from host to Crazyflie: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | |||
+ | Reply from Crazyflie to host if the id is valid: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | | 2 | ||
+ | | 3 | ||
+ | | 7 | ||
+ | |||
+ | Where the MEM_TYPE field is: | ||
+ | ^ MEM_TYPE ^ Memory type ^ Comment | ||
+ | | 0 | ||
+ | | 1 | ||
+ | |||
+ | Reply from Crazyflie to host if the id is not valid: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | |||
+ | Example of requesting the information for a 1-wire memory with MEM_ID=1, MEM_SIZE=112bytes, | ||
+ | < | ||
+ | Host-to-Crazyflie: | ||
+ | Crazyflie-to-Host: | ||
+ | </ | ||
+ | |||
+ | Example of requesting the information for a memory index that is not valid | ||
+ | < | ||
+ | Host-to-Crazyflie: | ||
+ | Crazyflie-to-Host: | ||
+ | </ | ||
+ | |||
+ | ==== SET_MEM_ERASE ==== | ||
+ | This command is used to mass erase a memory with a given id. The id of memories is sequential and is from 0 to one less than the returned number of memories from GET_NUMBER_OF_MEMS. | ||
+ | |||
+ | The request from host to Crazyflie: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | |||
+ | Reply from Crazyflie to host: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | | 2 | ||
+ | |||
+ | |||
+ | Example of requesting a mass erase for a memory with MEM_ID=2 | ||
+ | < | ||
+ | Host-to-Crazyflie: | ||
+ | Crazyflie-to-Host: | ||
+ | </ | ||
+ | |||
+ | Example of | ||
+ | < | ||
+ | Host-to-Crazyflie: | ||
+ | Crazyflie-to-Host: | ||
+ | </ | ||
+ | |||
+ | ===== Channel 1: Memory read ===== | ||
+ | This channel is only used to read memories and therefore the messages do not contain any command byte. | ||
+ | |||
+ | The request from host to Crazyflie: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | | 5 | ||
+ | |||
+ | Reply from Crazyflie to host if memory id is valid and the address and length to be read is valid: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | | 5 | ||
+ | | 6 | ||
+ | |||
+ | Where the STATUS field is: | ||
+ | ^ STATUS | ||
+ | | 0 | ||
+ | | 1 | ||
+ | |||
+ | Example of reading LEN=0x0F bytes from MEM_ID=0x01 MEM_ADDR=0x0A | ||
+ | < | ||
+ | Host-to-Crazyflie: | ||
+ | Crazyflie-to-Host: | ||
+ | </ | ||
+ | |||
+ | ===== Channel 2: Memory write ===== | ||
+ | This channel is only used to write memories and therefore the messages do not contain any command byte. | ||
+ | |||
+ | The request from host to Crazyflie: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | | 5 | ||
+ | |||
+ | Reply from Crazyflie to host if memory id is valid and the address and length to be written is valid: | ||
+ | ^ Byte ^ | ||
+ | | 0 | ||
+ | | 1 | ||
+ | | 4 | ||
+ | |||
+ | Where the STATUS field is: | ||
+ | ^ STATUS | ||
+ | | 0 | ||
+ | | 1 | ||
+ | |||
+ | Example | ||
+ | < | ||
+ | |||
+ | </ | ||