This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541: OTA how to calculate CRC?

Part Number: CC2541


Thank you for your help. On the OAD PDF file it says "If the OAD Target determines that the image available for OAD is better than its own, the OAD Target will initiate the OAD process by notifying the Image Block Transfer characteristic to the OAD Manager. ". How does it determine that it is better?

1. How does it determine that it is better?

2. What message exactly should the OAD Manager send to Image Identify? It says "The message data will be the image header of the image that is available for OAD"  so is it going to be a 16 byte message?

typedef struct {
uint16 crc0;
uint16 crc1;
uint16 ver;
uint16 len;
uint8 uid[4];
uint8 res[4];
} img_hdr_t;

3. How do I check if the notification? In the document, it says "The OAD Target will initiate the OAD process by notifying the Image Block Transfer characteristic to the OAD Manager".

4. How can I set the CRC value "the 2-byte CRC matches the 2-byte CRC shadow, then the image is commissioned to run immediately." but it also says that CRC shadow must be 0xFFFF and crc0 cannot be 0x0000 or 0xFFFF.

5. How does the cc2541 know which image I am trying to overwrite/update?

  • Hello,

    1. The target device is responsible for determining if the OAD is to proceed. It does checks on the candidate image at the image identify stage. To see exactly what checks are performed, inspect the code in oadImgIdentifyWrite() in oad_target.c.

    2. It will send a GATT_notification requesting the first block. See oadImgIdentifyReq

    3. See #2 above.

    4. crc0 is the crc of the image. crc shadow or crc1 is a reserved location in flash that the device uses to write the crc of the incoming image. Then the BIM will not run the image with the corrupted crc.

    5. An A/B system is employed. There are two images and the running image cannot update itself. So if image A is running, image B will be updated.
  • But how do I know which image is running at a given time?