[SOLVED] STM32G031 Flash Download Protected

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

  • [SOLVED] STM32G031 Flash Download Protected

    Dear Segger Community

    I'm using a JLink Pro to flash a STM32G031G8 device via SWD with JLinkExe under Ubuntu. Downloading works and the software starts _after a power cycle_. Resetting the MCU, either by issuing the 'r' command or by pulling the RESETn pin low does not start the program. After a power cycle, the RESETn pin works as expected.
    This is not ideal, but I can life with it.

    However, note that the JLink recognizes this device as 'active write protected' and performs a device erase when connecting to it. This is a problem for RTT: When I connect the RTT-Viewer it also erases the device. (See screen shot). This prevents me from using RTT, which is a problem for me.

    Any ideas why this device appears as protected? Using JLinkExe's 'mem' command check the Option Bytes of the STM32 shows them in their default state, which is not locked.

    Best Regards,
    Lukas
    Images
    • JLinkExe.png

      237.42 kB, 982×1,091, viewed 662 times
    • RTT Viewer.png

      124.44 kB, 897×885, viewed 548 times

    The post was edited 1 time, last by ls_technokrat ().

  • Hi Lukas,
    Thank you for your inquiry.

    Unfortunately, the J-Link Software and Documentation Pack does not support text boxes for Linux/MAC yet.
    Under Windows, there is an unlock dialog, which asks the user whether he wants to unsecure the device or not.
    In Linux this is always done without user confirmation.

    About why your device is in locked state:
    Your device is probably locked after power cycling it.
    Since the Commander is automatically unlocking the device by establishing connection,
    default/factory settings are set when reading the option bytes by this time.

    Are you working with an evaluation board or with custom hardware?
    If eval board: Could you tell us which one you are using?
    If custom: Is this reproducible on an eval board?
    Could you provide us with a data file (.hex, .bin,..) to reproduce the issue?

    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.
  • Hi Fabian

    Thank's for the quick reply!

    Ok, I tried pulling the BOOT0 pin high without success, but it might actually be disabled per default. I'll look into that.

    It's custom hardware and I don't have a demo board at hand to see if it happens there as well, but I guess it does. The hex file of my software is attached.

    BR,
    Lukas
    Files
  • Hi Fabian

    Quick update: I tried different configurations of option bytes - all without success. JLink persistenly consideres this device as 'write protected' even though it is not.
    As recommended, I tried the JLink tools on Win 10 and they ask me if I want to unlock the device. If I answer no, I can still program the device -> So its a bug in JLink?

    Btw: On Win 10 the RTT Viewer works if I tell it _not_ to unlock the device. I consider it a bug in your Linux software that you do not provide this option.

    Thanks for your support!

    BR,
    Lukas
    Images
    • stm32g031g8 option bytes st-link util.PNG

      125.18 kB, 608×1,114, viewed 361 times
    • Jlink flashing write protected device.PNG

      94.97 kB, 1,349×1,062, viewed 332 times
  • Hi Lukas,

    we received your ticket in our support system and will answer you there.

    For the future, please stick to one channel of communication.
    Otherwise the response time might be longer due to confusion, etc.

    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.