[SOLVED] STM32G070KB with RDP set to level 1 with J-Flash kills the device.

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] STM32G070KB with RDP set to level 1 with J-Flash kills the device.

    Hi!
    Can someone explain to me why this code:

    C Source Code

    1. // Is FLASH_CR register locked for writing?
    2. if (FLASH->CR & FLASH_CR_LOCK)
    3. {
    4. // Unlocking FLASH_CR register
    5. FLASH->KEYR = KEY1;
    6. FLASH->KEYR = KEY2;
    7. }
    8. // Unlocking FLASH option register
    9. if (FLASH->CR & FLASH_CR_OPTLOCK)
    10. {
    11. FLASH->OPTKEYR = OPTKEY1;
    12. FLASH->OPTKEYR = OPTKEY2;
    13. }
    14. // Setting RDP level to 1
    15. FLASH->OPTR &= ~FLASH_OPTR_RDP;
    16. FLASH->OPTR |= 0xBB; // Any value except 0xAA and 0xCC
    17. while (FLASH->SR & FLASH_SR_BSY1);
    18. FLASH->CR |= FLASH_CR_OPTSTRT;
    19. while (FLASH->SR & FLASH_SR_BSY1);
    20. // Updating option bytes by resetting of the device
    21. FLASH->CR |= FLASH_CR_OBL_LAUNCH;
    Display All
    kills STM32G070KB device, when was written with J-Flash, but works great with STM32G071CB with the same Errata note for RDP protection.
    Same code works great for both MCUs when were written with Segger Embedded Studio.

    Thank you!
  • Hi,

    this was handled in the Support Ticket system.
    For all forum users:
    The procedure works fine on both, STM32G0x0 and STM32G0x1 on our side,
    and after retrying on the customers side, too.

    => So far no issue can be seen on J-Link side.

    Best regards,
    Fabian
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.