Skip to main content
Visitor II
May 9, 2024
Question

Memory writing problem of STM32L452RE

  • May 9, 2024
  • 1 reply
  • 1924 views

Hello fellow seniors:
I am still in the learning stage and currently use the part of writing to the memory (Flash Memory). I have encountered a problem and would like to ask for advice:
From the picture (instruction manual) of [[Figure 1]], we can see that the blocks that can be written in the memory are 0x08000000~0x08080000螢幕擷取畫面 2024-05-08 163233.png

For the following questions, please refer to [https://youtu.be/iMChxrvMNG0]

Because I opened the memory to see that some user variables used the previous memory. I was afraid of being overwritten and changed it to 0x8020000 to start writing. However, after writing, I found that the memory will be cleared as long as it is restarted. Have you tried it? I tried to set the Initial break point, but found that it will be cleared as soon as the computer is turned on.
If it is written to 0x0807F800 (the last segment), the memory will not be cleared. However, I looked through the manual and did not see which memory block will be used by the system. I would like to ask why this is?

 

    This topic has been closed for replies.

    1 reply

    Graduate II
    May 9, 2024

    How does that write data to the memory?

    You'd need to select the write tab, and write a .BIN file to a specific address

    Visitor II
    May 9, 2024

    Hello 

    Tesla DeLorean:
    Sorry for my poor english
    Before I test writing memory via CubeProgrammer,I had written memory use
    HAL_FLASH_Unlock();
    HAL_FLASHEx_Erase();
    HAL_FLASH_Lock();

    HAL_FLASH_Program(

    FLASH_TYPEPROGRAM_DOUBLEWORD, 0x08020000 + (sizeof(test_flash_data) * (flash_cnt1/2)),

    test_flash_data);

    ...etc via Stm32CubeIDE,It's all work fine,and i can see the written memory on 0x08020000

    But after soft reset or power reset,the memory that i had written will be returned to 0xFFFFFFFF

     

    So i changed my mind to test write memory via CubeProgrammer,After testing,I figured that if i write memory on

    0x08020000,the memory block will be reset after disconnect and reconnect.

    But if i write memory block at 0x0807F800(the end of memory that can be written),the data that i wrote will

    not be format...

     

    I'm used to be wondered if that problem is about the mode of power on(0x08000000->0x00000000),

    but it's not seems to be this reason.

    20240508_STM32L4記憶體被清除的影片.gif
    Graduate II
    May 9, 2024

    Need to be unlocked to program, so move the lock until afterward

    HAL_FLASH_Program(..);

    HAL_FLASH_Lock();

     

    Your animation shows you edit the PC side memory, it does not illustrate you writing than content on to the STM32 Flash, which is why it disappears after you reconnect.