Skip to main content
Visitor II
December 21, 2020
Solved

STM8S207RBT6 - write protected

  • December 21, 2020
  • 2 replies
  • 4104 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

    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

    CNone.1Author
    Visitor II
    December 21, 2020

    Thanks, you solved my problem!