cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L475 Internal Flash driver write issue

Ashwin malaviya
Associate II
Posted on May 09, 2017 at 15:02

We are working on STM32L475 Internal Flash driver and we are facing one issue and to solve that issue i need below clarification.

Is it possible to program any Flash location twice without erase?. lets say there is one page which is currently erased. so the content of all the double word location of that page after erase is 0xFFFFFFFFFFFFFFFF. and now i program one double word location of this erased page with value 0xFFFFFFFFFFFFFFFF. so my question is 'will it be possible to program this same location with value 0xAAAAAAAAAAAAAAAA or again i have to erase this location to program? any inputs are welcomed.

Thanks in advance,

Ashwin  

#stm32l475 #stm32l4-flash
8 REPLIES 8
Max
ST Employee
Posted on May 10, 2017 at 09:46

This is an interesting question!

Intuitively, writing 

0xFFFFFFFFFFFFFFFF should let the memory in its erased state and allow further programming, but this is not the case.

The STM32L4 devices have an additional 8-bit of embedded ECC (Error Code Correction) for each 64-bit word of data.

In the erase state, the ECC bits are set to 0xFF.

Once you wrote the word 0xFFFFFFFFFFFFFFFF at a given address, the visible bits remains unchanged, but the ECC bits get modified, to a value different from

0x

FF due to the implemented ECC algorithm. 

This will prevent any further programming at this address as the hidden ECC data is likely to need some bits to change from 0->1for the new data .

In order to program something else at the same address, you will need to perform a complete page erase...

see

http://www.st.com/resource/en/reference_manual/dm00151945.pdf

3.3.2 for details
Posted on May 10, 2017 at 13:21

Hello Max,

Thanks for your reply...!!!

i got your point. so is this the same case with STM32's other series also? like STM32L1 and STM32F4.

and also  do you have any idea whether Internal Flash in STM32l475 is NOR flash or NAND Flash?.

as far as i know NOR flash is byte addressable. but here in stm32l475 it is not the case.it is double word addressable.

thanks once again,

Ashwin.

Posted on May 11, 2017 at 04:41

STM32 series are based on several NVM technologies.

As a consequence there are a lot of differences regarding:

- the word size (from 16-bit to 256-bit)

- ECC implementation or not

- memory point technology

Most are based on NOR flash technology, but not all of them: the STM32L1 for example use EEPROM memory.

The NOR flash is word addressable. It is byte addressable in the specific case of a byte wide memory matrix (I mean the hardware matrix implementation on silicon, not the access signals) .

In STM32 the word size varies between series in order to adapt the memory linear read access throughput (for linear code execution) to match the maximum CPU frequency.

I recommend you have look into the specific series documentation... their FLASH memory are very different.

Of all STM32, STM32L4 and STM32H7 use the most recent technologies.

Posted on May 12, 2017 at 09:10

Hello Max,

thanks for your reply.

just one more thing i want to know is is there any possibility that we can disable ECC with some register settings.

i have gone through STM32L475 reference manual but could not find anything.

but still just want to confirm.

Thanks,

Ashwin 

Posted on May 12, 2017 at 10:50

No, it is not possible to:

- disable ECC

- read the ECC bits

- read the raw data in case there is an ECC correction  

damh
Associate II
Posted on June 06, 2017 at 15:05

It is possible to write a position twice (but not with your suggested values)

  1. You shouldn't write 0xFFFFFFFFFFFFFFFF (you can check this before writing)
  2. You can write any value
  3. You can overwrite the value with 0x0000000000000000

[tested with STM32L471, L476 and L486] - perhaps L475 behaves differently, but i don't think so!

Max
ST Employee
Posted on June 07, 2017 at 04:08

This is a specific value that works.

There are probably many other combinations that works, the condition is that the new data ECC code must have more '0' than the previous data ECC code. 

With the right chain of values, you may be able to do a few write before you need to erase...

damh
Associate II
Posted on June 07, 2017 at 09:16

Are you sure? (If yes, what algorithm is used?)

Zero is a special value, that have worked since STM32F1. Writing i.e. 0xFFFE, 0xFFFC, 0xFFF8, 0xFFF0, ... haven't worked with any STM32 yet. If this feature is implemented in L4, it would be very welcomed ;) Until now the flash controller blocks this type of rewriting. I would be very surprised, if it works for L4.