cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F301C8T6 using FLASH Data

Gz
Senior
Posted on August 21, 2017 at 06:48

Hi.

I would like to use FLASH Data(Write, Read, Erase) in Flash memory of STM32F301C8T6. I follow to an example

STM32Cube\Repository\STM32Cube_FW_F3_V1.9.0\Projects\STM32303C_EVAL\Examples\FLASH\FLASH_EraseProgram\MDK-ARM

So It's not working. Please show me how I can do it.

Thank you.

Best regard.

#stm32 #flash #stm32f3 #flash-writing
1 REPLY 1
Gz
Senior
Posted on August 22, 2017 at 03:00

FLASH_EraseInitTypeDef erase_pages;

erase_pages.TypeErase= FLASH_TYPEERASE_PAGES;

erase_pages.NbPages=4;

erase_pages.PageAddress = 0x08008000;

uint32_t Error;

uint32_t pageAddress = 0x08008000;

uint16_t buffer1 = 0xAAAA;

uint16_t buffer2 = 12423;

  /* USER CODE END 2 */

HAL_FLASH_Unlock();

HAL_FLASHEx_Erase(&erase_pages,&Error);

HAL_FLASH_Program(FLASH_TYPEPROGRAM_HALFWORD, pageAddress, buffer2);

HAL_FLASH_Lock();

X = *(uint16_t *)pageAddress;

I tried so I have a solution. It's s

uccess.