cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-STM32L452REP Internal Flash Write Data

Vmish.1
Associate II

Hi St,

I am using NUCLEO-STM32L452REP board.

I am trying to write a DOUBLE WORD inside the internal flash.

I am writting to address 0x807D000 which is 8byte alligned.

The address i am trying to write, its contents are 0xFF.

I am calling below function:

HAL_Flash_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, 0x807D000, 0x01);

I am getting an error 0xa0 which equals programming allignment error.

Please help.

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

You're right with HAL_FLASH_Program (capital FLASH), I mixed it up. 0xa0 is a combination of two errors. One is PGSERR - Programming sequence error. Did you do HAL_FLASH_Unlock() and erase beforehand?

hth

KnarfB

View solution in original post

7 REPLIES 7
KnarfB
Principal III

Check the function declaration. The last param is a pointer to the source value, not the value itself.

Vmish.1
Associate II

Hi KnarfB,

I am using STM32Cube FW_L4 V1.16.0 Hal driver version. In that, function HAL_Flash_Program() has the last parameter unsigned 64 bit integer( uint64_t Data ) variable. i.e. the programming granularity is 8 byte.

KnarfB
Principal III

You're right with HAL_FLASH_Program (capital FLASH), I mixed it up. 0xa0 is a combination of two errors. One is PGSERR - Programming sequence error. Did you do HAL_FLASH_Unlock() and erase beforehand?

hth

KnarfB

Going to have make sure the flash is unlocked and erased. Make sure any pending errors are cleared.

Pay attention to the error/status messages you get, and perhaps instrument the code so you can follow/understand the flow without single stepping in a debugger.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

yes HAL_FLASH_Unlock() serves the purpose.

and erasing is only needed when contents are not 0xFF.

Thanks.

Vmish.1
Associate II

Thanks. We can close the ticket.

Hello @Vmish.1​ ,

Please select the post of user which is "Best Answer".

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen