STM Nucleo make upload configurable speed fault fixed

General topics and discussions about the VESC and its development.
magiced
Posts: 1
Joined: 13 May 2016, 10:43

STM Nucleo make upload configurable speed fault fixed

Postby magiced » 13 May 2016, 20:06

Hi!

I've spent ages trying to upload the firmware using an STM Nucleo board with the ST-link built in. I kept getting the error 'adaptor does not support configurable speed'

I am using linux mint, but this should work using ubuntu as well, so if you're having this problem with ubuntu it should sort you out

After some time of bashing my head against the wall I have solved this problem. OpenOCD 0.7, (which is the version in the repository that is installed by the apt-get command) does not support the ST-link v2.1 on the STM Nucleo boards. However, the up to date version openocd 0.9 does, so if you install it and make a small change to the makefile for the BLDC firmware, this problem should be solved.

The program has to be compiled and installed for openocd to work. this is nothing to be scared of, it's really very straightforward!
Compilation is when a raw c program, which is how the most up to date openocd software is packaged, is translated from the C code, which can be looked at and written in a text browser, to the machine code your computer processor needs it to be in for it to run. This is the same thing that happens when you type 'make' in Vedder's tutorial. the C code for the VESC is translated into the raw machine code file, which gets uploaded onto the stm32 chip which is the brain of the VESC.

Fix it like this:

1. uninstall openOCD 0.7 - i used mint's software manager for this, i'm not sure how you do it unbuntu

2. download openOCD 0.9
https://sourceforge.net/projects/openoc ... urce=files

3. Extract the files to wherever you want to put install the program. It installs wherever you put it. mine is in /home/ed/Programs/openocd-0.9.0/

4. open the openocd-0.9.0 folder in the terminal

5. type in: './configure'
e.g. in the openocd 0.9 folder type ~/Programs/openocd-0.9.0 $ ./configure
This checks your computer for a bunch of things that the openocd program needs to compile and creates the make file, which tells the complier what to do when it's compiling the software.

lots of commands will flow past in the terminal window. when it's finished you can scroll back and read them all if you want to learn more about what's happened.

6. type in 'sudo make install'. it will ask for your password. Lots of stuff will
This compiles the program and tells the operating system to add it to the path, so when you type openocd into the command line it knows where to put the command. You have to run this command as a superuser (sudo stands for Super User DO) as the installation involves changing some files in the filesystem, which cannot happen without authorisation, so you tell the program it can run as the superuser.

again, a lot of commands and messages flow past on the browser. you can look at them if you scroll up after it's finished.

7. You will need to go into wherever you put the BLDC firmware, in my case: /home/ed/BLDC/bldc-firmware. find the file 'Makefile' and open it in a text browser.
under the heading 'upload' (this is about at line 268 in my file)
you will need to change the following lines:
openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x_stlink.cfg -c "program build/$(PROJECT).elf verify reset"
#openocd -f board/stm32f4discovery.cfg -c "reset_config trst_only combined" -c "program build/$(PROJECT).elf verify reset" # For openocd 0.9

comment out the first line by putting a hash # in front and uncomment the second line by deleting the hash e.g.
#openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x_stlink.cfg -c "program build/$(PROJECT).elf verify reset"
openocd -f board/stm32f4discovery.cfg -c "reset_config trst_only combined" -c "program build/$(PROJECT).elf verify reset" # For openocd 0.9

then change the board config file in the second line to your board. in my case, it's the stm32 Nucleo f4. if you have a different board with an st link built it, have a look in the boards folder in the openocd folder, which has all the config file for a bunch of different boards openocd works with. There's so many to choose from!
e.g.
openocd -f board/st_nucleo_f4.cfg -c "reset_config trst_only combined" -c "program build/$(PROJECT).elf verify reset" # For openocd 0.9

This allowed me to upload the new firmware onto my VESC. I hope if you've had a similar problem it'll work for you too!


The following are useful to find out more
https://leanpub.com/mastering-stm32 //download the free sample it's very informative
http://openocd.org/doc-release/html/index.html //openOCD manual
https://openenergymonitor.org/emon/node/6189

Return to “General”

Who is online

Users browsing this forum: TheFallen and 3 guests