Hi,
We use MSP430F5437A in our product and observed flash corruption instances happened in field. Below are the details –
Background :
- MSP430F5437A runs on 4MHz MCLK.
- ADC_ISR gets triggered through timer periodically. In order to execute ADC_ISR quickly, MCLK gets updated to 8MHz on entrance of ADC_ISR and restored back to 4MHz before returning from the ISR.
- Flash locations 0x30000 to 0x307FF may get erased or written inside the ADC_ISR. We do not use nested interrupt.
- We have supervisory circuit which ensures to issue a RESET pulse if VCC goes below 2.8 V
Observations :
We have quite few returned units from field where flash got corrupted randomly (we found some instances where info memory was also corrupted)
Following are few points, we are not sure the MSP’s behavior during those situations –
1. Is it OK to perform flash erase/write operation from ADC_ISR (or any ISR) context?
2. Our flash routines are guarded through following logic -
unsigned int gieState = __get_SR_register() & GIE;
__disable_interrupt();
/*** Flash erase/write operations *********/
__bis_SR_register(gieState); // restore the GIE status
Since we erase/write flash inside the ADC_ISR, _disable_interrupt() and __bis_SR_register() gets called from ADC_ISR context. Is it OK to do so ?
3. Code uses ‘Long-word write’ mode for flash write operation. It uses memcpy() lib function to write into flash instead of running for loop…Is it OK to use memcpy() lib function instead of conventional for loop, after unlocking the flash ?
4. What if flash erase or write operation is still in-progress and supervisory IC issues a RESET pules? Will the flash memory (or info) which are not targeted for erasing/writing see any corruption?
5. The switching of MCLK between 4 MHz to 8 MHz and ice-versa through ISR context cause any harm?
Thanks,
Pradeep