Skip to main content
Mlope.1
Associate
February 19, 2020
Question

hello, I'm trying flash a stm32f429ZI with openocd but i'm blocked by an error. Someone can help?

  • February 19, 2020
  • 5 replies
  • 4361 views

0690X00000DBvkoQAD.png

This topic has been closed for replies.

5 replies

Andreas Bolsch
Lead III
February 20, 2020

Apparently you're including some config file(s) twice. So, what's you command line for starting openocd precisely?

Mlope.1
Mlope.1Author
Associate
February 20, 2020

openocd -f interface/ftdi/test-Run.cfg -f target/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x08000000"

Mlope.1
Mlope.1Author
Associate
February 20, 2020

openocd -f interface/ftdi/test-Run.cfg -f target/stm32f4x.cfg -c init -c "reset halt" -c "flash write_image erase nuttx.bin 0x08000000"

Mlope.1
Mlope.1Author
Associate
February 20, 2020

inside the file test-Run.cfg

0690X00000DBxj9QAD.png

Andreas Bolsch
Lead III
February 20, 2020

Well, test-Run.cfg already includes stm32f4x.cfg, so including this again on the command line is clearly an error.

Mlope.1
Mlope.1Author
Associate
February 20, 2020

I do that but the open failed

0690X00000DC0b3QAD.png

Andreas Bolsch
Lead III
February 20, 2020

Please add '-d3' to command line and post the relevant part of the log (the last 10 lines before the first error including the error message should be sufficient).

Mlope.1
Mlope.1Author
Associate
February 26, 2020

hello, this is the output:

Debug: 265 5 transport.c:239 handle_transport_init(): handle_transport_init

Debug: 266 5 hla_transport.c:152 hl_transport_init(): hl_transport_init

Debug: 267 5 hla_transport.c:169 hl_transport_init(): current transport hla_swd

Debug: 268 5 hla_interface.c:42 hl_interface_open(): hl_interface_open

Debug: 269 5 hla_layout.c:40 hl_layout_open(): hl_layout_open

Debug: 270 5 stlink_usb.c:1642 stlink_usb_open(): stlink_usb_open

Debug: 271 5 stlink_usb.c:1659 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x374b serial: 

Error: 272 6 stlink_usb.c:1672 stlink_usb_open(): open failed

Debug: 273 6 hla_layout.c:47 hl_layout_open(): failed

Debug: 274 6 command.c:626 run_command(): Command failed with error code -4

User : 275 6 command.c:687 command_run_line(): in procedure 'program' 

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

in procedure 'ocd_bouncer'

Debug: 276 6 command.c:626 run_command(): Command failed with error code -4

Debug: 277 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_echo ** OpenOCD init failed **

Debug: 278 6 command.c:143 script_debug(): command - echo ocd_echo ** OpenOCD init failed **

User : 280 6 command.c:762 jim_echo(): ** OpenOCD init failed **

Debug: 281 6 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_shutdown error

Debug: 282 6 command.c:143 script_debug(): command - shutdown ocd_shutdown error

User : 284 6 server.c:627 handle_shutdown_command(): shutdown command invoked

Debug: 285 6 command.c:626 run_command(): Command failed with error code -4

User : 286 6 command.c:687 command_run_line(): 

Debug: 287 6 hla_interface.c:117 hl_interface_quit(): hl_interface_quit

Andreas Bolsch
Lead III
February 26, 2020

This line shows that the stlink is connected and (to some extent) working properly, otherwise vendor and product id wouldn't show up:

Debug: 271 5 stlink_usb.c:1659 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x374b serial: 

And this line indicates some error with the stlink:

Error: 272 6 stlink_usb.c:1672 stlink_usb_open(): open failed

The precise cause isn't clear, some possibilities that came to my mind:

  • most likely: insufficient access rights, for linux: on my system 'lsusb' shows 'Bus 001 Device 013: ID 0483:3748 STMicroelectronics ST-LINK/V2', hence a check with 'ls -l /dev/bus/usb/001/013' shows something like 'crw-rw-r--+ 1 root trusted 189, 12 2020-02-26 17:10 /dev/bus/usb/001/013'. This means that all members of group 'trusted' have full access to the stlink. The user you're working as needs r/w-access. Do you have an '/etc/udev/rules.d/49-stlink.rules' file? Comes with stsw-link007 or STM32CubeProgrammer.
  • another instance of openOCD (or something else) already got access to the stlink and blocks further attempts, in this case disconnecting and reconnecting the USB cable should be sufficient
  • you stlink is messed up in some way, rather unlikely, but you could verify with the update program (available from st webside: stsw-link007) that it can connect to the stlink