AnsweredAssumed Answered

STM32F103 option byte PGERR

Question asked by Jeroen3 on Dec 27, 2016
Latest reply on Dec 27, 2016 by Jeroen3

I'm trying to write the option bytes, but I get PGERR or Imprecise data bus error.

Here is some psuedo code that is what is happening. The HAL also does this, that's why I started from scratch using the programming manual. But to no avail.

... HSI is ON. Prefetch if off... two wait states

 

    _FLASH_CR_unlock();
    __disable_irq();
    FLASH->OPTKEYR = FLASH_KEY1;
    FLASH->OPTKEYR = FLASH_KEY2;
    FLASH->CR |= FLASH_CR_OPTPG;
    FLASH->SR |= FLASH_SR_EOP | FLASH_SR_WRPRTERR | FLASH_SR_PGERR;
    *0x1FFFF804 = 0xAA;
    while(FLASH->SR & FLASH_SR_BSY);
    // Check for EOP bit and compare data.
    uint32_t SR = FLASH->SR;

 

... check and return flags

 

I've asked this before, in the old forum. However, I need this, so I'll ask again.

STM32F103 xl option bytes 

Outcomes