We've been building small batches (10 to 50 at a time) of a CC2541-based device, and I've encountered a problem with reading values from flash on 2 devices after successfully building hundreds of units.
Here's the background: we store a small struct starting at flash address 0x86. It sits on top of the interrupt vector table, and is 44 bytes long. It's used for controlling various intervals and features of the device. These settings get programed along side the firmware code as part of our programming processes. We modify the .hex file before it's flashed with the correct settings.
Here's the problem: one value is not getting read correctly from flash on the 2 problematic devices. All of the other settings (as far as I can tell) are read correctly. But there's a catch. The problematic devices will read the correct value from flash as long as the device stays powered after programming. Cycling power will cause some other (random) value to be used. And it's just the one setting. All of the other settings load correctly. And it takes a power cycle after programming to cause the setting to be corrupted.
This is the struct that gets located at flash address 0x86.
typedef struct
{
uint16_t setting1,
uint16_t setting2,
uint16_t setting3,
uint16_t setting4,
uint16_t setting5,
uint16_t setting6,
uint16_t setting7,
uint32_t setting8,
uint16_t setting9,
uint16_t setting10,
uint16_t setting11,
uint16_t setting12,
uint16_t setting13,
uint16_t setting14,
uint16_t setting15,
uint16_t setting16,
uint32_t setting17,
uint32_t setting18
} SettingsT;
setting8 is the problematic one. It starts at flash address 0x102 and is 4 bytes long. I even read back the flash contents through TI's Flash Programmer, and what's stored in flash matches what was downloaded to the CC2541. It's not a problem with the value stored in flash. I tried disabling caching (setting FCTL = 0x00) , but that did not fix the problem.
To reiterate, we have built hundreds of these devices, all running identical firmware, but 2 do not correctly load values from flash.