cancel
Showing results for 
Search instead for 
Did you mean: 

Facing problems with saving data to flash memory on stm32g030c8t6.

YBend.1
Associate III

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!!

1 ACCEPTED SOLUTION

Accepted Solutions
gbm
Lead II

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.

View solution in original post

5 REPLIES 5
gbm
Lead II

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.

YBend.1
Associate III

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
Lead II

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.

YBend.1
Associate III

Okay @gbm​. Thanks for your help.

YBend.1
Associate III

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

Thanks.