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

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.
    TDK
    TDKBest answer
    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.

    "If you feel a post has answered your question, please click ""Accept as Solution""."

    4 replies

    mƎALLEm
    ST 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.

     

    To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
    Andrew Neil
    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.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    Tesla DeLorean
    Guru
    September 4, 2024

    STM32U5

    STM32U5G9J-DK2 ??

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    TDK
    TDKBest answer
    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.

    "If you feel a post has answered your question, please click ""Accept as Solution""."