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: OAD troubles

Part Number: CC2541


1. When I send my image header to the cc2541 board it returns 0100 007C 42424242. What specifically is this indicating? I would assume one is CRC one is the LENGTH and one is VERSION and one is the UID. But which is which and one of them is missing right?

2. I am not sure if I produced my bin file correctly my length is 58542 does it sound about right? I did some minor changes to the SimplePeripheral Image B.

3. Am I calculating my CRC correctly?

// Compute the MODBUS RTU CRC
private static int ModRTU_CRC(byte[] buf, int len) {
int crc = 0xFFFF;

for (int pos = 0; pos < len; pos++) {
crc ^= (int)buf[pos] & 0xFF; // XOR byte into least sig. byte of crc

for (int i = 8; i != 0; i--) { // Loop over each bit
if ((crc & 0x0001) != 0) { // If the LSB is set
crc >>= 1; // Shift right and XOR 0xA001
crc ^= 0xA001;
}
else // Else LSB is not set
crc >>= 1; // Just shift right
}
}
// Note, this number has low and high bytes swapped, so use it accordingly (or swap bytes)
return crc;
}

  • Hi,

    You can look at oad_target.c for the image header placement:

    #pragma location="IMAGE_HEADER"
    const __code img_hdr_t _imgHdr = {
    #if defined FEATURE_OAD_SECURE
    2012, // CRC must not be 0x0000 or 0xFFFF.
    #endif
    #if defined (BOOTP_E_IMAGE_A)
    #warning "Forcing a CRC-shadow match with the BOOTP_E_IMAGE_A flag - is this bootstrap code?"
    2012, // CRC-shadow forced to match CRC for a bootstrap Encrypted Image-A
    #else
    0xFFFF, // CRC-shadow must be 0xFFFF for everything else
    #endif
    OAD_IMG_VER( OAD_IMAGE_VERSION ), // 15-bit Version #, left-shifted 1; OR with Image-B/Not-A bit.
    OAD_IMG_R_AREA * OAD_FLASH_PAGE_MULT,
    #if defined HAL_IMAGE_A
    OAD_IMAGE_A_USER_ID, // User-Id
    #else
    OAD_IMAGE_B_USER_ID, // User-Id
    #endif
    { 0xFF, 0xFF, 0xFF, 0xFF } // Reserved
    };
    #pragma required=_imgHdr


    Best wishes