Hi guys,
I'm developing a bootloader for an RM42-based board. The flow is inspired by TI's SPI-bootloader application note (spna194), but I have a problem:
After the first firmware upload, the system reboots/resets during the flash erase-step in the bootloader.
I hit a breakpoint at address 0x00000000 (resetEntry) - e.g. the system resets because of an exception/hard fault.
I would like your help with diagnosing the error :)
I have tried looking at the ESM-registers at the time of the reset.
- ESMSR1 is 0x0000 0080 (group1, bit7)
- ESMSSR2 is 0x0001 0000 (group2, bit16)
- ESMEPSR is 0x0000 0000 (error pin driven low)
As far as I can tell from reading the datasheet, it could indicate unrecoverable ECC-error. This seems plausible to me for the following reasons:
- when erasing, I don't think I clear the ECC bits, so when reading back to check if the erase was succesful (ala Fapi_Erase_Check) we will generate a lot of ECC errors.
- before the first erasure, the application area is programmed to 1's (0xFF, 0xFF...) so the ECC bits are correct until I erase them for the first time.
I have tried disabling Flash ECC when erasing/verifying, to make sure the read-backs didn't generate ECC errors, but I am not sure this is the right venue.
When doing the erase, IRQ+FIQ are disabled, the system is in privilege mode and I've built my bootloader from TI example code from Zhaohong (e.g. the program/erase flow follows the instructions in the application note). Also, I'm using CCS 5.5.0 to generate the ECC bits automatically.
How can I diagnose a system reset that occurs during flash erasure?
If you need more information to help me (or code snippets) I'll gladly provide it :)
Kind regards
Mikkel Johnsen