Skip to main content
Visitor II
August 6, 2013
Question

Can't option byte programming

  • August 6, 2013
  • 2 replies
  • 1111 views
Posted on August 06, 2013 at 15:27

Hello!

I'm can't programming option byte in the stm8s105c6t6 into my board stm8s-discovery.

This code:

 mov FLASH_DUKR,♯$56;

 mov FLASH_DUKR,♯$AE;

 ld A,♯%00001100; IWDG_HW and LSI_ EN set

 ldw X,♯$4805

 ld (X),A

 incw X

 cpl A

 ld (X),A

 Here I read option bytes,  they unchanged. Can you Help me? 

#stm8 #option-bytes
    This topic has been closed for replies.

    2 replies

    Visitor II
    September 4, 2013
    Posted on September 04, 2013 at 20:41

    I have similar problem that I can't change option byte(wait state) by program for STM8S207.  

    Visitor II
    September 5, 2013
    Posted on September 05, 2013 at 16:58

    ST manuals can be somewhat obscure. First check section 4.5.3 - Note that the access method is the same as for data memory using 0xAE then 0x56 and then setting the OPT bit in the FLASH_CR2.

     mov FLASH_DUKR,#$AE;    FLASH_RASS_KEY2

     mov FLASH_DUKR,#$56;    FLASH_RASS_KEY1

     mov FLASH_CR2,#$80;    OPT bit to enable Option byte programming

     mov FLASH_NCR2,#$7f;

     ld A,#%00001100; IWDG_HW and LSI_ EN set

     ldw X,#$4805

     ld (X),A

     incw X

     cpl A

     ld (X),A

    Hope this works for you

    jdf