Skip to main content
Visitor II
July 31, 2023
Solved

Using HAL_FLASH_Program to write a word on a NUCLEO-C031C6

  • July 31, 2023
  • 2 replies
  • 2121 views

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

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

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

    TDK_0-1690822805974.png

     

    2 replies

    TDK
    TDKBest answer
    Super User
    July 31, 2023

    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
    Principal III
    August 7, 2023

    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.