How to read and write variables into Flash memory in STM32C092CCT6 (STM32C0 series)
I am working with an STM32C092CCT6 (STM32C0 series) and I need help with reading and writing variables into Flash memory.
I want to store a few configuration values (like integers or structures) that should persist after reset or power cycle.
From what I understand, I need to erase a Flash page first and then program data at a specific address.
I am not sure about the correct sequence for the C0 series (unlocking Flash, erasing, programming, and locking again).
I would like to know the best practice for data alignment (word/halfword).
Should I use HAL functions like HAL_FLASH_Program() or is direct register access recommended for reliability?
If anyone has a working example code snippet or reference for reading/writing user variables into Flash on STM32C0, it would be really helpful.
Thanks in advance!
