2018-02-07 03:33 AM
We use STM32F429II on our project.
We had over 30 systems running in our lab without problem. Just sent a unit to a remote location, and after few days of continues running, the option register was set to 1 on all bits.
Reprogramming hex without changing config register does not help. CPU not running.
Setting the same 'corrupted' config settings on a working unit config register does not recreate the problem. The system continues to work.Only after writing both new hex file and original options register settings to the faulty unit, the faulty unit is back on.
I have this code on my initialization to set code protection and brown out level setting if those are not set:
if (FLASH_OB_GetBOR() != OB_BOR_LEVEL2) //set BOR level 2 if not set
{
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
FLASH_OB_BOR_LevelConfig(OB_BOR_LEVEL2);
HAL_FLASH_OB_Launch();
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
}
if (FLASH_OB_GetRDP() != SET) //set protection level 1 if not set
{
HAL_FLASH_Unlock();
HAL_FLASH_OB_Unlock();
FLASH_OB_RDP_LevelConfig(OB_RDP_LEVEL_1);
HAL_FLASH_OB_Launch();
HAL_FLASH_OB_Lock();
HAL_FLASH_Lock();
}
So after first run the settings are:
1. read out protection 1
2. BOR level 2
3. WDG_SW
4. nRST STOP
5. nRST_STBY
All other not set. (based on STLINK software)
After corruption:
1. Read out protection level 1
2.
BOR level - off
3. WDG_SW
4. nRST STOP
5. nRST_STBY
6. BFB2 set
7. All sectors write protected
Basicly all option registers bits are set to 1 !What do you think?
Thanks,
Yoram
2018-02-07 08:02 AM
Flash corruption is frequently associated with power supply issues. I would advise not doing these things the instant the part starts.