2021-03-21 12:16 AM
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.
Solved! Go to Solution.
2021-03-21 08:08 AM
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
2021-03-21 02:21 AM
Check the function declaration. The last param is a pointer to the source value, not the value itself.
2021-03-21 07:10 AM
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.
2021-03-21 08:08 AM
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
2021-03-21 08:42 AM
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.
2021-03-21 10:26 AM
yes HAL_FLASH_Unlock() serves the purpose.
and erasing is only needed when contents are not 0xFF.
Thanks.
2021-03-21 10:27 AM
Thanks. We can close the ticket.
2021-03-24 01:42 PM
Hello @Vmish.1 ,
Please select the post of user which is "Best Answer".
Imen