Get Focbox Unity on Amazon NOW!

VESC - Installing a bootloader

I was unlucky and received a VESC with no bootloader. I won’t mention where it came from, because the excellent dude responsible for making a VESC available to me is on vacation and I’m not gonna bother him!

I can’t upgrade the firmware until I install a bootloader. I’ve been putting it off, but now that FOC is in full effect, it’s time to give it a try! Currently my shit is LOUD and I need to roll in silence during top-secret missions.

I’m using VESC 4.7 and currently have firmware 1.10 installed (that’s what the VESC shipped with). It works nicely, but half the fun of having an open-source ESC is being able to install new firmware and use new features.

I’m trying to follow Vedder’s instructions. Here he provides all the command lines needed to prepare a Linux machine to flash the bootloader. (Flash is just a nickname for “programming a chip”). He also gives an example of how to connect an ST-Link V2 to VESC and that’s where I’m getting stuck.

Vedder provides an image of a similar programmer where you can see the pinout:

But the one I bought looks like this:

Here’s a closer look at the pinout:

While it looks like I need to connect GND, SWCLK, SWDIO, 3V3, RST, and GND, I’ve only got RST, GND, DATA, VDD, RST, SWD, CLK, GND, and VDD. WTF!?

Problem #1 is I don’t know which of these pins on my ST-LinkV2 I need to connect.

Problem #2 I know which JST port to use on the VESC, but which pins on the port should connect with the pins on the programmer? Vedder must have put a diagram somewhere that shows how to connect the pins on VESC, but I can’t find anything.

Problem #3 is I don’t have a pin labeled 3V3. I’m assuming that SWCLK=CLK and that SWDIO=SWD

Maybe I should look for a programmer that is exactly like the one in Vedder’s example? Any thoughts? Thanks!

2 Likes

For the pin layout you can take the same order on the JST connector like shown in Benjamin’s picture. But you definitely need a JST-PH 6pin connector.
At least that’s what I’ve done. But you’re right, I can’t see 3.3 on yours. Is there another row of pins on the other side?

1 Like

Thanks @elkick ! No, there are no other pins on the programmer. I may need a different programmer. Without 3V3 I don’t think that I can proceed. @jacobbloy @chaka does that sound right?

1 Like

3.3v is the VDD pin. SWCLK is CLK and SWDIO is most likely SWD on your programmer.

Pin order on the VESC is 3.3v, CLK, GND, DIO, RST, SWO/Data. The labelling on your programmer is inconsistent with what I am used too but this should work.

1 Like

Thank you @chaka that’s what I needed to know! To flash VESC, do I need to power the VESC with a battery, or does the programmer supply power to the chip during the process?

No need to power the vesc during the flashing process. You only need to power the vesc during configuration.

1 Like

Big thanks @chaka and @elkick. Right now I’m waiting for some jumper cables to arrive. Of course, I have a 5-pin set but I need six pins so I ordered this guy

1 Like

These are exactly the ones I’m using too. :smile:
Don’t forget to (hot-) glue them to the STlinkv2 to keep everything in place.

i have those same ribbon connectors! any time i need a set i just peel a few off. I’m actually using them to connect my PPM to the receiver. a little hot glue and they stay put nicely, and you can’t beat the price.

@longhairedboy @elkick is there anything that hot glue can’t fix?

not to my knowledge. lol

And its a hell of a great way to keep your components all tightly secured inside your box. I use it to float battery packs in the box, seal the nuts and washers on charge ports and buttons, cover up potentially problematic solder joints that can’t be heat-shrinked, tie down wiring that needs to stay put, fasten my receiver to the inside of the box, pin down the antenna, hold my PPM wires in place, keep my balance leads secured… basically my boards are filled with this silicone based wonder because its tough, non-conductive, sticks to wood and plastic like a boss and is waterproof.

and it can be peeled off (with some work) without damaging whatever its on. So its sort of temporary while still being sort of permanent.

4 Likes

@longhairedboy word. I’ve got this stuff all over too. Do we need a hot-glue thread to showcase this wonder? It would be fun to ask people to post pics of how and where they use it.

yes!

Must be 20 characters… :sunglasses:

1 Like

OK @chaka @elkick @jacobbloy a quick update. I got my jumper cable ribbon and immediately found that 6 of these don’t fit into VESC’s JST connector port, so I removed three of the cable encasements and got them all connected:

I checked and double-checked and I’m pretty certain that I connected the VESC to the programmer in the correct manner. Did you ask for a weird photo angle? Perfect! I got one! Here it is:

Then I got it plugged into my PC and ran my Ubuntu image:

Everything compiled and prepared just fine. I think this is the way to specify my hardware version, right? I have version 4.7

But trouble came when it was time to “make upload” it appears that something was wrong and the software couldn’t initialize the boot loader upload. There’s the error screen:

What does this suggest? Bad programmer? Not connected properly?

It appears that the programmer didn’t interact with my VESC at all… it’s still stuck with the 1.10 firmware version and I still can’t upload any new firmware versions through BLDC tool. Is there a way to verify that a boatloader is installed?

did you power the vesc?

Thanks @Blasto No, you don’t need to during the flashing process, the programmer powers it. I did power when I tried to upload the firmware through BLDC tool.

It might be better to upload the bootloader first by following Benjamin’s steps for bootloader upload.

Did your STLink show a green light? Make sure not to power on the VESC through the battery as long as you’re working with the STlink.

1 Like

Thanks @elkick I did my best to follow Vedder’s steps… I went step by step using his guide noted above.The STLink green light was one, and blinked during the “upload” of the bootloader. It seemed to fail at that point. I’m trying to figure out why.

All I can see on your screenshot is the firmware, not the bootloader. So when you went through the bootloader part before the firmware it said “verified ok” after bootloader upload?

Have you tried unplugging the USB to cycle the power on the programmer? Sometimes this error will show up during programming. A power cycle has always set things straight in my experience.

Careful setting an uninsulated VESC on a metal tower. Probably wont short anything out through the paint but why tempt fate.

2 Likes