Skip to main content
sra
Associate
August 12, 2022
Solved

how to write data into stm32l5 flash memory

  • August 12, 2022
  • 3 replies
  • 1294 views

uint64_t write = 0x1111111122222222;

HAL_FLASH_Unlock();

if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD,0x0807F000,write)==HAL_OK)

{

HAL_GPIO_WritePin(GPIOG,GPIO_PIN_12,GPIO_PIN_RESET);

}

 HAL_FLASH_Lock();

This topic has been closed for replies.
Best answer by Peter BENSCH

It is not entirely clear what exactly your question to answer is. In general, however, it can be said that a number of things must be taken into account when writing values to the Flash:

  • in general, the maximum number of write cycles
  • STM32L5 is based on Cortex-M33, which contains a safe TrustZone area, writing to Flash being part of this area must be allowed
  • there are examples in the firmware repository of the STM32L5 in the folder Projects

Does it answer your question?

Regards

/Peter

3 replies

Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
August 12, 2022

It is not entirely clear what exactly your question to answer is. In general, however, it can be said that a number of things must be taken into account when writing values to the Flash:

  • in general, the maximum number of write cycles
  • STM32L5 is based on Cortex-M33, which contains a safe TrustZone area, writing to Flash being part of this area must be allowed
  • there are examples in the firmware repository of the STM32L5 in the folder Projects

Does it answer your question?

Regards

/Peter

In order 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.
sra
sraAuthor
Associate
August 12, 2022

yes

Peter BENSCH
ST Technical Moderator
August 12, 2022

Great!

If the problem is resolved, please mark this thread as answered by selecting Select as best. This will help other users find that answer faster.

Regards

/Peter

In order 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.