Skip to main content
BRamo.1256
Associate II
May 15, 2020
Question

Problems when i try to program the chip

  • May 15, 2020
  • 2 replies
  • 1339 views

Hello, im facing a problem when i try to program the chip, im using the eclipse ide and a cheap stlink debugger, the most common error is this:

adapter speed: 24000 kHz

adapter_nsrst_delay: 100

Info : clock speed 24000 kHz

Info : STLINK v2 JTAG v34 API v2 SWIM v7 VID 0x0483 PID 0x3748

Info : using stlink api v2

Info : Target voltage: 3.192646

Error: init mode failed (unable to connect to the target)

in procedure 'program' 

in procedure 'init' called at file "embedded:startup.tcl", line 495

in procedure 'ocd_bouncer'

** OpenOCD init failed **

shutdown command invoked

I already update the firmware of the stlink, i put boot0 high and use the system memory, i tried to erase the chip using stlink utility, but it appears that flash protections is activated. I also change to software system reset, but nothing works for me. Someone can help me? I think that i have enabled the flash protection in some way and now i cant reprogram the chip.

    This topic has been closed for replies.

    2 replies

    BRamo.1256
    Associate II
    May 15, 2020

    I have used the device many times, but now im using the low power modes, and it happened, is there some relation with this problem?

    Tesla DeLorean
    Guru
    May 15, 2020

    Low power modes turn OFF the logic you're trying to communicate with, or while the debugger gains control of the system.

    Connecting NRST helps, holding BOOT0 HIGH can get your code out of the picture.

    You can also provided sufficient time after startup before sleeping so the debugger can get control, or avoid using __WFI, etc.

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    BRamo.1256
    Associate II
    May 18, 2020

    ... holding BOOT0 HIGH can get your code out of the picture.

    Thanks, but now, when i tried to program another code, this error occurs:

    ** Programming Started **

    auto erase enabled

    Info : device id = 0x10076413

    Info : flash size = 512kbytes

    Error: stm32x device protected

    Error: failed erasing sectors 0 to 0

    embedded:startup.tcl:476: Error: ** Programming Failed **