Skip to main content
RKuma.12.300
Associate
Aug 28, 2019 12:05 PM UTC
Question

STM32G0 READ AND WRITE ISSUE

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.

This topic has been closed for replies.

13 replies

SLA
Associate
Jan 9, 2020 12:33 PM UTC

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
Visitor II
Jan 10, 2020 4:11 PM UTC

Hi SLA,

Thanks!

CAvil.1
Associate
Jan 14, 2020 3:54 PM UTC

@SLA

Thanks for the implementation, works fine!

@Danny​ 

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

Work for me, thanks to.