Skip to main content
Angelo1
Associate III
March 16, 2014
Question

stm32x405, can't program through stlink v2

  • March 16, 2014
  • 2 replies
  • 856 views
Posted on March 16, 2014 at 22:54

Dear all,

after some issues using a programmer as parport interface, i am trying to program stm32f405 with a cheap stlink-V2, but still without success.

I attach the openocd log, maybe someone can help me.

Open On-Chip Debugger 0.8.0-dev-00381-gf91390f (2014-03-14-22:58)

Licensed under GNU GPL v2

For bug reports, read

        http://openocd.sourceforge.net/doc/doxygen/bugs.html

Info : This adapter doesn't support configurable speed

Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748

Info : using stlink api v2

Info : Target voltage: 3.208404

Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints

target state: halted

target halted due to debug-request, current mode: Thread

xPSR: 0x01000000 pc: 0x08001a20 msp: 0x20020000

Info : accepting 'telnet' connection from 4444

██ telnet localhost 4444

Trying ::1...

Trying 127.0.0.1...

Connected to localhost.

Escape character is '^]'.

Open On-Chip Debugger

> flash probe 0

device id = 0x10016413

flash size = 1024kbytes

device id = 0x10016413

flash size = 1024kbytes

flash 'stm32f2x' found at 0x08000000

> flash write_bank 0 bin/gasc.bin 0

jtag status contains invalid mode value - communication failure

error waiting for target flash write algorithm

error writing to flash at address 0x08000000 at offset 0x00000000

in procedure 'flash'

jtag status contains invalid mode value - communication failure

Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 100ms

jtag status contains invalid mode value - communication failure

Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 300ms

jtag status contains invalid mode value - communication failure

Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 700ms

jtag status contains invalid mode value - communication failure

Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 1500ms

jtag status contains invalid mode value - communication failure

Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 3100ms

jtag status contains invalid mode value - communication failure

Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 6300m

May be the fact i didn't connected NJTRST pin to the programmer (should'n be mandatory) ?

Every help si appreciated.

many thanks

angelo
    This topic has been closed for replies.

    2 replies

    Tesla DeLorean
    Guru
    March 16, 2014
    Posted on March 16, 2014 at 23:23

    What if you use the Windows ST-LINK utilities?

    Connect in SWD mode?
    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    ntfreak
    Associate
    March 27, 2014
    Posted on March 27, 2014 at 14:43

    For support you may get help quicker if you post to the OpenOCD mailing list.

    As a guess I would say that you are not erasing the flash first.

    Depending on what your are trying todo a better cmd may be to use write_image.

    flash write_image erase stm32f4x.bin 0

    Also use the generated elf rather than generating a binary.

    Newer versions of OpenOCD have a programming helper script - see http://openocd.sourceforge.net/doc/html/Flash-Programming.html#Flash-Programming

    Spen