Part Number:MSP430F5437A
We use the micro-controller MSP430F5437A in our circuit breaker application. What we did observe is that we when write to the internal flash using 8MHz clock it takes about 64ms and during this time if an over current which lasted only for 30ms appeared the microcontroller misses the event. Why does the micro take such long time to write to the flash? is this typical. Also it appears that the micro doesn't take interrupts while writing to flash. Is there a way we can stop writing an event when an interrupt occurs. Also what are the possible ways to reduce flash writing time to few millisec.
Below is the existing code for writing to flash
WDTCTL = WDTPW + WDTHOLD; /* Stop watch dog timer */
BIC( SFRIFG1, WDTIFG );
while( BIT( FCTL3,BUSY) ); // Wait while flash busy
FCTL3 = FWKEY; // Unlock memory segment
FCTL1 = FWKEY+ERASE_L; // Set Erase bit
*flashPtr = 0; // Dummy write to erase Flash seg
while( BIT( FCTL3,BUSY) ); // Wait while flash busy
FCTL1 = FWKEY+WRT_L; // Set WRT bit for write operation
// copy event data to flash
memcpy(flashPtr, flashBuffer, 512);
while( BIT( FCTL3,BUSY) ); /* Wait till flash busy */
// lock flash memory after write operation
FCTL1 = FWKEY;
FCTL3 = FWKEY+LOCK_L;