Skip to main content
Visitor II
September 4, 2024
Solved

while i am trying to write data in flash memory data isn't being written in memory

  • September 4, 2024
  • 3 replies
  • 1799 views

While I am trying to write data in flash in memory it isn't being updated in the particular memory location while checking in debug session. And memory locations are showing 00000000 by default instead of FFFFFFFF and the image for same is attached hereby.

I have also added one file named FLASH_PAGE.c which is also attached hereby. Kindly provide some solution for this issue.

 

    This topic has been closed for replies.
    Best answer by TDK

    > EraseInitStruct.Page = StartPageAddress;
    It's expecting a page number. You appear to be providing an address.

    Could be other things going on here. When unexpected, all 0's can indicate the debugger cannot read those memory locations.

    3 replies

    Technical Moderator
    September 4, 2024

    Hello,

    This thread is not related to CubeIDE but to the product usage. So in next time please post your thread in the correct forum. Post will be moved to MCU Products forum.

    Also you need always to provide the MCU part number.

    Please refer to our recommendation on how to post a thread in this link.

    Thank you for your understanding.

     

    Super User
    September 4, 2024

    As @mƎALLEm said, you need to state the STM32 part number. Does it have cache?

     

    In your Flash_Write_Data() function, you don't check the return values from HAL_FLASH_Unlock() or HAL_FLASH_Lock(). Are they succeeding? 

    Does HAL_FLASHEx_Erase() return any error?

     

    BTW:


    @aiswarya wrote:

    image for same is attached hereby.


    should be "herewith".

    Or just "is attached" would be fine.

    Graduate II
    September 4, 2024

    STM32U5

    STM32U5G9J-DK2 ??

    TDKAnswer
    Super User
    September 4, 2024

    > EraseInitStruct.Page = StartPageAddress;
    It's expecting a page number. You appear to be providing an address.

    Could be other things going on here. When unexpected, all 0's can indicate the debugger cannot read those memory locations.