This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F5437A: Flash write time

Part Number: MSP430F5437A
Other Parts Discussed in Thread: MSP430F5438A, MSP430FR5969

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;

  • Hello Archana,

    Please see section 5.43 Flash Memory in the device datasheet for typical flash write and erase times. These times are the same regardless of Mclk frequency. Erasing a segment of Flash is what takes the longest here which has a max value of 32ms. I imagine you are erasing two separate segments then writing to them as writing is in the microsecond range. Of course, you need to erase Flash before you write to it. Some things to watch out for is if you are writing over a segment boundary which could cause additional delay. Aligning your writes to the segment boundaries could help you there.

    There is an emergency exit bit you can enable during flashing that will exit the flash writing process. The resulting contents in memory can be unpredictable if the exit does take place during a flash write/erase. Please see the Flash Controller Section of the User Guide for more information on this and information on how the write/erase times are calculated.

    If your application is of a datalogging nature, or you need more performance in order to store data, please see our MSP430 FRAM portfolio that has FRAM memory instead of Flash. FRAM memory can be written to like RAM, retains data after a power cycle like Flash. It also does not require an erase before writing to it and has endurance similar to RAM. Something like the MSP430FR5969 would be similar to the MSP430F5438A. For more information about FRAM please see the following. www.ti.com/.../what_is_fram.page
  • Archana Sadhanala said:
    Also what are the possible ways to reduce flash writing time to few millisec.

    Copy write function to RAM end execute it from there. Block write with smart bit enabled, on 8 MHz MCLK, can go over 200 KByte/sec.

**Attention** This is a public forum