OpenOCD init Failed

openocd

The title says it all. One thing to say before going into detail about the issue. I am a complete beginner at using the terminal in Ubuntu that I need help with the codes to fix this issue.

Long story short. Im trying to upload some firmware to a motor controller using an STM32F4 Discovery board since programming takes place with the ST-Link/V2 over SWD pins on the Discovery board (the one on the right). I accidentally forgot to remove the jumpers to allow upload to the motor controller and I don't know what happened to the board. It does not have blinking leds on the lower half of the board anymore as a result. The picture below show what I have been getting as of yesterday to upload firmware to the controller. I have done a test to see if connecting and not connect the controller would give this error. Doing both have resulted in this error. I'm try to fix this issue, but Sourceforge has been working well the past few hours due to a "storage infra fault" for some of the files I hope would work.

enter image description here

Edit 1. In response for more information. Motor controller is an open source project by Benjamin Vedder. More information is on his blog at http://vedder.se/2015/01/vesc-open-source-esc/. The picture below is of the STM32F4 Discovery board I used because I need a ST-Link/V2 to upload the firmware to the controller. Connecting the Dicovery board to the computer supplies enough power to the board. The picture below is of the jumpers I must remove before programming the controller. Not removing the jumpers will result in the Discovery board being program with whatever firmware is being used at the moment. This portion of the Discovery Board with the jumpers uses the St-Link/V2.

Best Answer

I accidentally forgot to remove the jumpers to allow upload to the motor controller and I don't know what happened to the board. It does not have blinking leds on the lower half of the board anymore as a result.

Which board - discovery or the 'motor controller'? If you are talking about discovery, then there is nothing wrong with it, since you flashed the microcontroller on the discovery board with the firmware for the 'motor controller'. The jumpers you are referring to simply short SWD lines between the programmer and the microcontroller. In other words, this could not affect the functionality of the board you are trying to program in any way.

Given the information you provided I can suggest the following:

  • Provide external power source to the board. OpenOCD reads 2.85V target voltage, while the 'motor controller' board uses a 3.3V linear regulator. This means that either there is some voltage drop or that USB simply doesn't provide enough current to power both boards.
  • Use as short cables as possible.
  • Update ST-Link firmware and OpenOCD. You can use ST-Link Utility to upgrade firmware (Windows® only).
  • Make sure you grant "0666" permissions to st-link. This can be done by adding the following udev rule under /etc/udev/rules.d/50-stlinkv2:

    SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", MODE:="0666"

    Note that VID and PID of your programmer might differ.