Jump to content

MSP432 SRAM retention and flash waitstates - check your settings

Recommended Posts

TI recently updated the MSP432 Technical Reference Manual to "revision A". Looking at the revision history shows some particularly interesting changes...


First of all, the documented default value of SYS_SRAM_BANKRET has changed from 0x000000FF to 0x00000001. That means that only bank 0 retains its contents in LPM3 and LPM4. I've seen some mention of this here already, but I'm repeating it because it's quite important to know. The program stack lives at the top of SRAM by default; from bank 7 down. If you don't enable retention on the banks containing the stack then bad things will happen when the MCU wakes from LPM3 or LPM4.


The next one is less dangerous to get wrong, but kills performance if you aren't careful. The original release of the TRM said that the flash controller defaults to zero wait state mode on startup (FLCTL_BANKx_RDCTL.WAIT=0). That would make sense because the MCLK speed on startup doesn't require any wait states, and it also matches the MSP430 behaviour. Normally you don't need to even think about wait states unless you set the clock speed above a certain level specified in the datasheet.


Unfortunately the updated TRM now says that the default setting is three wait states (FLCTL_BANKx_RDCTL.WAIT=3)! That's one more than the datasheet says you need for ordinary reads at the maximum MCLK frequency of 48MHz. In other words, to get best performance you need to change that setting irrespective of your chosen MCLK frequency.


For code execution the effect is hidden somewhat by the 128-bit read buffer in the flash controller, meaning that the extra wait states are only applied when crossing a 128b boundary. By default this buffer is only used for instruction fetches, so code reading large blocks of constant data from flash (with the CPU or DMA) will suffer badly by comparison.


Luckily neither issue causes any problems as long as you're aware and set the correct values in your program. I guess it's all part of the fun of using preview silicon ;)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...