cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G0 READ AND WRITE ISSUE

RKuma.12.300
Associate II

Hello,

I am using STM32G070CBT6 Controller.

I am trying to write and read in 63rd page of flash memory .

HAL_FLASH_Unlock();

 __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP  |

             FLASH_FLAG_WRPERR |

FLASH_FLAG_PGAERR);

 FLASH_PageErase(63);

 HAL_StatusTypeDef Stat1 =HAL_FLASH_Program(TYPEPROGRAM_DOUBLEWORD, 0x0801F800 , 0xAB); // 0xAB is dummy write

 HAL_FLASH_Lock();

 HAL_Delay(10);

 const volatile uint8_t *userConfig=(const volatile uint8_t *)0x0801F800;

 HAL_UART_Transmit(&huart1,(uint8_t *)&userConfig,1,20);

When i program this i am receiving 0x00 in UART.

Please guide.

13 REPLIES 13
Danny1
Associate

SLA, Thanks!

My first steps with eeprom emulation.

What is ?

EE_ADR_MAX

Is this correct?

#define EE_ADR_MAX					((FEE_PAGE_SIZE/4)-1) //???

You don´t declare EE_ADR_MAX in your example.

Thanks!

SLA
Associate II

Hi Danny,

EE_ADR_MAX is the array size for the EEdata Array you need:

#define EE_ADR_MAX 10

uint32_t EE_Array[EE_ADR_MAX] = {0};

Regards

SLA

Danny1
Associate

Hi SLA,

Thanks!

CAvil.1
Associate II

@SLA

Thanks for the implementation, works fine!

@Danny​ 

#define EE_ADR_MAX ((FEE_PAGE_SIZE/4)-1)

Work for me, thanks to.