Skip to main content
CNone.1
Associate
December 21, 2020
Solved

STM8S207RBT6 - write protected

  • December 21, 2020
  • 2 replies
  • 4727 views

Hello,

I have got an industrial PCB with a STM8S207RBT6. I'm able to READ programm memory, data memory and option bytes with ST Visual Programmer and STLink V2.

Also I can write data memory and option bytes. But if I try to write program memory I get an error:

"Programming failed. Device is write protected. Check by values."

But in by value I can't find anything about write protection. Only read out protection, which is turned off.

Option bytes are set to:

000102000000000000

Any advice for my problem?

Regards

Chris

    This topic has been closed for replies.
    Best answer by Peter BENSCH

    The datasheet of the STM8S207RBT6, section 8 (Option bytes) gives you some explanation of the option bytes.

    Yes, ROP is disabled, but the remaining bytes do not completely match the datasheet, e.g.:

    • byte 2 (OPT1, UBC) contains 0x01, which stands for Pages 0 to 1 defined as UBC, memory write-protected
    • byte 3 (NOPT1, NUBC) contains 0x02, but should be the complement of byte 2, i.e. 0xFE
    • byte 4 (OPT2, AFR) contains 0x00, which might be OK
    • byte 5 (NOPT2) also contains 0x00, but should be the complement of byte 4, i.e. 0xFF
    • etc

    This section of the datasheet also describes how to perform a write to the memory.

    Good luck!

    When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

    /Peter

    2 replies

    Peter BENSCH
    Peter BENSCHBest answer
    ST Technical Moderator
    December 21, 2020

    The datasheet of the STM8S207RBT6, section 8 (Option bytes) gives you some explanation of the option bytes.

    Yes, ROP is disabled, but the remaining bytes do not completely match the datasheet, e.g.:

    • byte 2 (OPT1, UBC) contains 0x01, which stands for Pages 0 to 1 defined as UBC, memory write-protected
    • byte 3 (NOPT1, NUBC) contains 0x02, but should be the complement of byte 2, i.e. 0xFE
    • byte 4 (OPT2, AFR) contains 0x00, which might be OK
    • byte 5 (NOPT2) also contains 0x00, but should be the complement of byte 4, i.e. 0xFF
    • etc

    This section of the datasheet also describes how to perform a write to the memory.

    Good luck!

    When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

    /Peter

    In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
    CNone.1
    CNone.1Author
    Associate
    December 21, 2020

    Thanks, you solved my problem!