I am trying to write a piece of data to the option byte at 0x1FFFF804. If the data I want programming is 0x08AE the data written is 0x51AE. Note this is on a copy of an STM32F103 (a MindMotion MM32F103).
This is my code below.
if (Sleep == ECUSleep(SaveAdr, BkpData) == 1) {
FLASH_Unlock();
FLASH_OPTB_Enable();
FLASH_EraseOptionBytes();
FLASH_ProgramOptionHalfWord(0x1FFFF804, (u16)SaveData.SystemPulse); //Sys Pulse
GPIO_ResetBits(GPIOB,GPIO_Pin_3);
Flash_Lock();
}
Am I missing something? It seems strange that 1 bit is correct and the other is not.