2015-03-30 06:44 AM
I use STM32F417IG
Minimal example of code:uint32_t startAddress = 0x80E0000;static uint32_t mSize =0x13;//char test_string[13]={''Hello World.''};HAL_FLASH_Unlock();for(uint32_t i=0;i<mSize;i++){ status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_BYTE, startAddress+i,test_string[i]); if(status==HAL_ERROR) { printf(''Flash error code: %d for data index %d\n'',HAL_FLASH_GetError(),i);//Always return 6 }}What is wrong? #flash #hal #stm322015-03-30 12:24 PM
Dunno, what's 6 defined as meaning, and is the memory erased, check the bytes are 0xFF
2015-03-30 10:11 PM
#define HAL_FLASH_ERROR_PGS ((uint32_t)0x00000002) /*!< Programming Sequence error */
#define HAL_FLASH_ERROR_PGP ((uint32_t)0x00000004) /*!< Programming Parallelism error */Sector 12 (0x080E000 - 0x080FFFFF) filed by 0xff. I try to fully erase chip by j-link flashing device. No any changes.