Part Number: TMS320F280039C
Other Parts Discussed in Thread: UNIFLASH
Problem :
MCU is stuck in a continuous NMI reset loop on every boot.
Findings after debugging :
When the memcpy() call that reads from Flash is commented out, the MCU boots and runs normally without any resets. This strongly suggests the Flash sector being read is corrupted and triggering an uncorrectable ECC error on every memcpy() access. Also the corrupted sector works fine with memcpy() if i flash the code again by erasing the whole flash using CCS / Uniflash / C2prog Tools
The code line used is as below :
2. mcal_flash_init();
mcal_flash_sector_erase(0x000AF000);
mcal_flash_program_autoecc_sector(0x000AF000, (uint32_t *)buffer, sizeof(struct mdata_t));
3. void app_meta_data_flash_write(struct mdata_t *buffer) is used based on requirement of application
I have gone through all the documents/datasheets required to work with Flash API..
This is happening randomly on the application that we are using and no sequence of occurence is found. Currently I am not able to recreate Flash corruption. Please help in ways of recreating flash corruption
struct mdata_t{
uint16_t image_present;
uint16_t reset_cause;
uint32_t battery_unique_key;
};
void app_meta_data_flash_write(struct mdata_t *buffer)
{
mcal_flash_sector_erase(0x000AF000);
mcal_flash_program_autoecc_sector(0x000AF000, (uint32_t *)buffer, sizeof(struct mdata_t)); // size is 8 words
}
void app_meta_data_flash_read()
{
memcpy(&mdata, (uint16_t *)0xAF000, sizeof(struct mdata_t));
}
void app_meta_data_flash_init()
{
mcal_flash_init();
app_meta_data_flash_read();
}