AnsweredAssumed Answered

does dual-bank read-while-write work properly in stm32l071?

Question asked by Maciej Suchinski on Aug 3, 2017
Latest reply on Jan 15, 2018 by Brian TIDAL

I'm trying to reprogram the NVM (flash bank 2) while running code from flash bank 1 in STM32L071CB microcontroller.

As AN4808 and AN4767 stand, "the memory interface is capable of reading both banks in parallel, or reading one bank while writing to the other..." but I'm experiencing some problems:

  1. Debugging shows that FWWERR bit goes high in the flash status register during flash bank 2 half-page write operation. It means that writting flash bank 2 has been stopped because of code fetching.
  2. Erasing bank 2 by code in bank 1 works properly.
  3. Writting by words bank 2 by code in bank 1 seems to work properly (but I'm having doubts if its only coincidence).
  4. Half-page writting ends with FWWERR bit set in FLASH_SR and zeros in the memory I'm trying to write.

I know I'm missing something but I can't find out what it is. Maybe someone had similar problem? I'm starting to think that there's something is wrong with the uC (errata sheet points out some problems with dual-bank switching mechanism, but it shouldn't be a problem in my case, because I'm not switching banks right now).

My function works properly when executed from RAM memory, but I'd rather want it to run from flash bank 1.

 

(you can take a look at the code here: microcontroller - does dual-bank read-while-write work properly in stm32l071? - Electrical Engineering Stack Exchange  )


SYSCLK is 16 MHz, checked on MCO with oscilloscope. PWR is in range 1 (the highest applicable).

Thanks for any help.

Outcomes