cancel
Showing results for 
Search instead for 
Did you mean: 

Using HAL_FLASH_Program to write a word on a NUCLEO-C031C6

SJC
Associate

Good Day, 

Is it possible to write a Word using HAL_FLASH_Program? If I use the TypeProgram =  FLASH_TYPEPROGRAM_DOUBLEWORD in the function (shown below) it will write to flash. If I use FLASH_TYPEPROGRAM_WORD it will not write to flash and I receive an error.

HAL_FLASH_Program(uint32_t TypeProgram, uint32_t Address, uint64_t Data);

Regards, 

SJC

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Per the reference manual, the STM32C0 series can only program double-words in flash. Writes less than that will fail.

TDK_0-1690822805974.png

 

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

View solution in original post

2 REPLIES 2
TDK
Guru

Per the reference manual, the STM32C0 series can only program double-words in flash. Writes less than that will fail.

TDK_0-1690822805974.png

 

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

Also there is no FLASH_TYPEPROGRAM_WORD defined in HAL:

https://github.com/STMicroelectronics/STM32CubeC0/blob/8731fa98190b337c01e2a4c3d3a725fe6bf3c04a/Drivers/STM32C0xx_HAL_Driver/Inc/stm32c0xx_hal_flash.h#L224

Therefore it's not even clear how the code is compiled in that case.