SWCU192 November 2021 CC1312R7 , CC1352P7 , CC2652P7 , CC2652R7
The COMMAND_DOWNLOAD_CRC command is sent to the bootloader to indicate where to program data in flash, how many bytes will be sent by the COMMAND_SEND_DATA commands that follow, and the expected 32-bit CRC value covering the total number of data bytes to be stored in NVM. The command consists of three 32-bit values that are all transferred MSB first. The first 32-bit value is the address to start programming data into, while the second is the 32-bit size of the data that will be sent, and the third is the 32-bit CRC value covering the total number of bytes to program in flash.
This command should be followed by a COMMAND_GET_STATUS to ensure that the program address and program size were valid for the device.
The flash starts at address 0x0000 0000.
The COMMAND_DOWNLOAD_CRC command does not perform any kind of erase operation; it only prepares for following NVM programming performed by the COMMAND_SEND_DATA commands. Required flash erase can be done by the COMMAND_BANK_ERASE and COMMAND_SECTOR_ERASE commands. The final COMMAND_SEND_DATA command that programs the last bytes of the total number of bytes specified by the COMMAND_DOWNLOAD_CRC command, (after the programming) will calculate the CRC32 value covering the flash area specified by the COMMAND_DOWNLOAD_CRC command and check if the calculated CRC32 value equals the specified 32-bit CRC value. If these values are not equal, the complete flash area that has been programmed will be erased before the COMMAND_SEND_DATA command responds with an ACK. In this scenario, a following COMMAND_GET_STATUS command will report a COMMAND_RET_FLASH_FAIL status.
Due to the CRC calculation and possible flash erase operation during execution of the last COMMAND_SEND_DATA command, the COMMAND_DOWNLOAD_CRC command will have a delayed ACK response.
The format of the packet including the command is as follows:
unsigned char ucCommand[15];
ucCommand[0] = <size=15>;
ucCommand[1] = <checksum>;
ucCommand[2] = COMMAND_DOWNLOAD_CRC;
ucCommand[3] = Program Address [31:24];
ucCommand[4] = Program Address [23:16];
ucCommand[5] = Program Address [15:8];
ucCommand[6] = Program Address [7:0];
ucCommand[7] = Program Size [31:24];
ucCommand[8] = Program Size [23:16];
ucCommand[9] = Program Size [15:8];
ucCommand[10] = Program Size [7:0];
ucCommand[11] = Crc [31:24];
ucCommand[12] = Crc [23:16];
ucCommand[13] = Crc [15:8];
ucCommand[14] = Crc [7:0];