SWCU194 March 2023 CC1314R10 , CC1354P10 , CC1354R10 , CC2674P10 , CC2674R10
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 Flash. 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 0x00000000.
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 ID is as follows:
unsigned char ucPacket[15];
ucPacket[0] = <size=15>;
ucPacket[1] = <checksum>;
ucPacket[2] = COMMAND_DOWNLOAD_CRC;
ucPacket[3] = <image address [31:24]>;
ucPacket[4] = <image address [23:16]>;
ucPacket[5] = <image address [15:8]>;
ucPacket[6] = <image address [7:0]>;
ucPacket[7] = <image size [31:24]>;
ucPacket[8] = <image size [23:16]>;
ucPacket[9] = <image size [15:8]>;
ucPacket[10] = <image size [7:0]>;
ucPacket[11] = <image crc [31:24]>;
ucPacket[12] = <image crc [23:16]>;
ucPacket[13] = <image crc [15:8]>;
ucPacket[14] = <image crc [7:0]>;