cancel
Showing results for 
Search instead for 
Did you mean: 

how to write data into stm32l5 flash memory

sra
Associate II

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();

1 ACCEPTED SOLUTION

Accepted Solutions
Peter BENSCH
ST Employee

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.

View solution in original post

3 REPLIES 3
Peter BENSCH
ST Employee

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
Associate II

yes

Peter BENSCH
ST Employee

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.