STM32F4 Discovery - Writing / Reading Flash memory
This is my first post here, sorry if format or something is wrong. I succeed writing and reading flash memory of the STM32F4 Discovery following the advises of our colleges here and here (both posts explain the same way): __attribute__((__section__(".user_data"))) const char userConfig[64]; [...] void Write_Flash(uint8_t data) { HAL_FLASH_Unlock(); __HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP | FLASH_FLAG_OPERR | FLASH_FLAG_WRPERR | FLASH_FLAG_PGAERR | FLASH_FLAG_PGSERR ); FLASH_Erase_Sector(FLASH_SECTOR_6, VOLTAGE_RANGE_3); HAL_FLASH_Program(TYPEPROGRAM_WORD, &userConfig[0], data); HAL_FLASH_Lock();