Skip to main content
YBend.1
Associate III
January 31, 2023
Solved

Facing problems with saving data to flash memory on stm32g030c8t6.

  • January 31, 2023
  • 5 replies
  • 2997 views

I tried implementing a driver by following the Flash example present of the GitHub page and a blog I found online:

How to Program Flash memory in STM32 » ControllersTech

The driver code according to this blog is: STM32/FlASH_PAGE_F1.c at master · controllerstech/STM32 (github.com)

I tried to implement it for my application: Eeprom-Emulation-driver-STM32/FlASH_PAGE_F1.c at main · Yadnik1/Eeprom-Emulation-driver-STM32 (github.com)

However, no data is being stored in the flash memory. I am making a mistake that I am not able to identify it, can someone please guide me with it.

Thank you very much!!

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

Read the section on Flash in the Reference Manual for G0 chips. Unlike in F1, in G0 Flash is written in 64-bit units - two 32-bit words must be written one after another in a single programming operation.

5 replies

gbm
gbmBest answer
Principal
January 31, 2023

Read the section on Flash in the Reference Manual for G0 chips. Unlike in F1, in G0 Flash is written in 64-bit units - two 32-bit words must be written one after another in a single programming operation.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
YBend.1
YBend.1Author
Associate III
January 31, 2023

Thanks @gbm​,

Can you please tell me, how to convert the logic into code.

From my understanding, the change will happen in this part:

while (sofar<numberofwords)
	 {
	 if (HAL_FLASH_Program(FLASH_TYPEPROGRAM_DOUBLEWORD, Address, Data[sofar]) == HAL_OK)
	 {
	 	 Address += 8; // use StartPageAddress += 2 for half word and 8 for double word
	 	 sofar++;
	 }

Thank you very much !!

gbm
Principal
January 31, 2023

I don't use HAL and I have no reason to learn/understand it. I am afraid I cannot help you with any HAL-based stuff.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
YBend.1
YBend.1Author
Associate III
January 31, 2023

Okay @gbm​. Thanks for your help.

YBend.1
YBend.1Author
Associate III
February 1, 2023

Can someone else please help me with this, or should I open up a new thread for this?

Thanks.