Skip to main content
AMott.1
Associate
July 26, 2022
Solved

Writing a NULL byte into the STM32L15xC6T6 Data EEPROM. Data sheet says it is not allowed. In practice, in some devices work in others resets the processor. Please clarify

  • July 26, 2022
  • 10 replies
  • 2903 views

I have some projects that were left inadvertently with some function calls that write 0x00 bytes into the data EEPROM. They work properly. I have tested it.

I detected the problem on a prototype board with an old sample of STM32L152C6T6 and this made me realize the mistake.

This topic has been closed for replies.
Best answer by KDJEM.1

Hi @Community member​ ,

Thank you  for bringing this issue to our attention.

For Cat.1 (no suffix) devices, the Byte write can be used only to write a NON NULL byte.

In contrast to Cat.1 devices, in Cat.2 (suffix A) devices the Byte write can be used to write a NULL byte.

This difference between the two categories will be added in the new TN1176 update.

Kaouthar

10 replies

waclawek.jan
Super User
July 26, 2022

> Data sheet says it is not allowed

Where does it say so?

JW​

Tesla DeLorean
Guru
July 26, 2022

Can't say it's an issue I was aware of.

How does it fail? Hard Fault?

Most of the STM32 parts don't allow for multiple writes to FLASH, or knock-down of bits to low states. This is typically due to ECC bits you can't see or adjust. Hard Faults can occur on unwritten FLASH lines, or those where the ECC fails.

Which page of the Data Sheet are you referencing?

https://www.st.com/resource/en/datasheet/stm32l152c6.pdf

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
July 27, 2022

Please post directly to the forum, not via email response. Those don't carry images or attachments, and leak a lot of information.​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
AMott.1
AMott.1Author
Associate
July 27, 2022

0693W00000QMGh9QAH.jpgGood morning

Thank you for replying.

This is the page of the RM I’m talking about:

The device I’m using is a CAT.1 (STM32L151C6T6 or STM32L152C6T6)

AMott.1
AMott.1Author
Associate
July 27, 2022

In the following code:

void write_stm32_eeprom(dword addr, byte dato) {

byte *p;

 if ((addr < START_EEPROM) || (addr > END_EEPROM))

   return;

 p = (byte *)addr;

 if ((*p) != dato) {

   //Enable write access to EEPROM

   FLASH->PEKEYR = FLASH_PEKEY1;

   FLASH->PEKEYR = FLASH_PEKEY2;

   while ((FLASH->PECR & FLASH_PECR_PELOCK) != 0);

   (*p) = dato; <-- IN THIS INSTRUCTION IF dato==0 CPU FAULTS AND RESETS

   while ((FLASH->SR & FLASH_SR_BSY) != 0);

   //Set write prtection

   FLASH->PECR |= FLASH_PECR_PELOCK;

   }

 }

AMott.1
AMott.1Author
Associate
July 27, 2022

NOT ALL PARTS ARE DOING THE SAME..... FORTUNATELY!!!!

I HAVE PRODUCTS SELLING IN THOUSANDS AND "APPARENTLY" RUNNING WELL WITH THIS HIDDEN PROBLEM ON BOARD...

waclawek.jan
Super User
July 27, 2022

​I didn't know about this detail either.

Note, that i the 'L1 family, there are A-suffixed parts, which may behave differently in some details than their non-suffixed counterparts​.

Post photos of "good" and "bad" chips.

JW​

AMott.1
AMott.1Author
Associate
July 28, 2022

Indeed it seems that the "A" parts don't suffer of this problem. But it is not documented in the manual... Can we trust that "A" parts don't show this problem?

Thanks0693W00000QMMqqQAH.jpg0693W00000QMMqlQAH.jpg

waclawek.jan
Super User
July 28, 2022

> Indeed it seems that the "A" parts don't suffer of this problem. But it is not documented in the manual...

It is:0693W00000QMNMrQAP.png@Amel NASRI​ ,

can this difference between the non-suffixed and -A 'L151x6/8 please be documented in TN1176 ?

Thanks,

JW

KDJEM.1
KDJEM.1Best answer
Technical Moderator
September 15, 2022

Hi @Community member​ ,

Thank you  for bringing this issue to our attention.

For Cat.1 (no suffix) devices, the Byte write can be used only to write a NON NULL byte.

In contrast to Cat.1 devices, in Cat.2 (suffix A) devices the Byte write can be used to write a NULL byte.

This difference between the two categories will be added in the new TN1176 update.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
waclawek.jan
Super User
September 18, 2022

Thanks, Kaouthar.

JW​

AMott.1
AMott.1Author
Associate
July 28, 2022

OK. Thanks a lot