cancel
Showing results for 
Search instead for 
Did you mean: 

Can't option byte programming

skef2009
Associate
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
2 REPLIES 2
mtien888
Associate II
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.  

jdf25252
Associate II
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