Part Number: CC2340R5
Other Parts Discussed in Thread: CC2538, CC2650, UNIFLASH
Hi,
I am trying to reprogram a CC2340R5 via UART with the ROM bootloader. I am writting the APP correctly (download with crc and send data with all the status correct), but when I try to program the CCFG part I am getting an error CMD_RET_FLASH_FAIL when I write the first block of data of CCFG. I am following the steps described in SWCU193 8.5.4 Page 469.
My firmware is 180704 bytes and CCFG 2048bytes.
I have three questions here:
1.- Which is the meaning of CMD_RET_FLASH_FAIL ?
2.- I am calculating the CRC of 180704Bytes using the following algorithm:
// Calculate crc32 checksum the way CC2538 and CC2650 does it.
int calcCrcLikeChip(const unsigned char *pData, unsigned long ulByteCount)
{
unsigned long d, ind;
unsigned long acc = 0xFFFFFFFF;
const unsigned long ulCrcRand32Lut[] =
{
0x00000000, 0x1DB71064, 0x3B6E20C8, 0x26D930AC,
0x76DC4190, 0x6B6B51F4, 0x4DB26158, 0x5005713C,
0xEDB88320, 0xF00F9344, 0xD6D6A3E8, 0xCB61B38C,
0x9B64C2B0, 0x86D3D2D4, 0xA00AE278, 0xBDBDF21C
};
while ( ulByteCount-- )
{
d = *pData++;
ind = (acc & 0x0F) ^ (d & 0x0F);
acc = (acc >> 4) ^ ulCrcRand32Lut[ind];
ind = (acc & 0x0F) ^ (d >> 4);
acc = (acc >> 4) ^ ulCrcRand32Lut[ind];
}
return (acc ^ 0xFFFFFFFF);
}
Is there any change? Do I have to take any additional consideration? (Memory alignment etc?)
3.- When I generate the firmware, do I have to fill it with additional zeros and do some kind of alignment? Please tell me if I need to consider additional requirements.
Thanks for the support