STLINK-V3SET

From circuitbending to homebrew stompboxes & synths, keep the DIY spirit alive!

Moderators: lisa, luketeaford, Kent, Joe.

Post Reply
stickjam
Learning to Wiggle
Posts: 4
Joined: Thu Jan 23, 2020 11:20 am

STLINK-V3SET

Post by stickjam » Thu Jan 23, 2020 11:30 am

Has anyone successfully used the STLINK-V3SET kit to flash any Mutable modules? (eg. Braids) And was it with STMicro's tools, the Mutable Dev VM, or other?

I'm getting "STM32 Target Not Found" via JTAG, and no idea how to physically connect it (and the programming software) to use the serial header.

-Bob

User avatar
EATyourGUITAR
has no life
Posts: 3882
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: STLINK-V3SET

Post by EATyourGUITAR » Fri Jan 24, 2020 10:07 am

have you tried reading the manual? you obviously don't have the pins on the programmer connected to the pins on the mutable module. you do know you need to have the mutable module completely disconnected from your eurorack power supply don't you? you could damage a lot of shit if you have power coming into the module in two places at once. the manual will tell you how to use the adapter board for your specific module header pinout. the mutable schematics and pcb layout tell you what the pinout of the programming header is.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

stickjam
Learning to Wiggle
Posts: 4
Joined: Thu Jan 23, 2020 11:20 am

Re: STLINK-V3SET

Post by stickjam » Fri Jan 24, 2020 2:30 pm

The problem may actually be that I've read too many manuals giving conflicting advice.

The Braids manual only describes how to upload firmware using a WAV file. I need to flash a board with a virgin STM32F103 MCU and the programmer I had for another another project is V3 of the STLINK USB debugger. All the documented means to flash from the Mutable Development Environment virtual machine are for the V2 of STLINK or an Olimex dongle. I'd rather not get another laptop to run older STLINK drivers to avoid breaking my existing V3 dev laptop. If I have to get another one, so be it, but I'd rather spend that money on parts to build more modules. :)

My question is whether anyone has successfully flashed a DIY Braids (or other MI) using an STLINK V3, and what connection and software worked? JTAG vs serial? STM23CubeProgrammer vs Mutable VM?

The Mutable VM won't see the STLINK-V3 at all even though it sees other USB devices. The STM32CubeProgrammer software that comes with my dongle can open the binary and recognizes the STLINK-V3 which in turn sees the 3.3 volts coming through JTAG from the fully powered Braids board. Everything looks right, however STM32CubeProgrammer throws an error message that it cannot connect to an STM32 target. According to the STM32F103xx datasheet, JTAG is not the default programming mode, so maybe it's ignoring it until the command is sent serially to switch to JTAG. I'd like to try the serial port which my research seems to be called "FTDI". The STLINK-V3 has two serial ports that all the documentation seem to mention as purely features that can be used for automated debugging. STM32CubeProgrammer has no target protocol option called "FTDI"; the closest parameter-wise is "SWIM" which don't have Tx/Rx pins on the connector to cross-wire to the counterparts on the Braids board.

I've verified that the board is all electrically sound. The only other real possibility is that I've got a fried MCU chip, which would definitely not be recognized by a programmer. I'd just like to know whether the V3 has ever worked for anyone before whipping out the ChipQuik desoldering alloy and changing the MCU.

User avatar
EATyourGUITAR
has no life
Posts: 3882
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: STLINK-V3SET

Post by EATyourGUITAR » Fri Jan 24, 2020 3:39 pm

Stop asking if anyone has done it with your exact combination of parts because that does not provide any useful information. Forget the VM because that has not been tested with your programmer. Nothing on ST's website is telling you to use the mutable VM. If I understand your second post correctly, you had the module powered from your eurorack power supply when you connected the programmer. Reread my first post. Do not power your module from an external source when connecting the programmer. You will break shit. After that, you need to build another module. You do not want to troubleshoot two problems at once. After you get the programmer working with another not broken module, then later you will have verified working tools to determine if the first board contains damaged components.

Ok so you will be programming with jtag because this is an stm32. Don't try to follow tutorials that are not relevent to what you are doing. You have a firmware file, you set your jtag programmer to 3.3v through jumpers or software before you connect power to your module through the programmer. You look at the stm32 datasheet to find where the jtag programmer gets connected. Then you look at the mutable schematic to see if there are pin headers or pogo pins available on the PCB you have. Then you read the manual to your programmer and your official software till you understand what you are doing fully. Before you break it again. Don't rush it. You chose to build it the hard way so now you have to do the work that goes with that. Or just buy an assembled module. Or buy a kit with a preprogrammed IC. Or buy a test socket to use with your programmer. You can program the stm32 before you solder it.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
EATyourGUITAR
has no life
Posts: 3882
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: STLINK-V3SET

Post by EATyourGUITAR » Fri Jan 24, 2020 5:27 pm

Although it is unlikely, you may also have damaged the 3.3v regulator on your programmer. You should test that to see if it is putting out 3.3v before using the programmer. If your programmer is putting out 5v then it could damage the next 3.3v target you plug in. The target power may not be active until you are actually attempting to program. In that case you would put the oscilloscope on the target 3.3v pin with no target connected. Then scope it while you make a dry run of programming a 3.3v target.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
stevenb
Common Wiggler
Posts: 121
Joined: Wed Dec 18, 2013 11:16 pm
Location: Nirvana Silly, California

Re: STLINK-V3SET

Post by stevenb » Fri Jan 24, 2020 6:05 pm

stickjam wrote:
Fri Jan 24, 2020 2:30 pm
The problem may actually be that I've read too many manuals giving conflicting advice.

My question is whether anyone has successfully flashed a DIY Braids (or other MI) using an STLINK V3, and what connection and software worked? JTAG vs serial? STM23CubeProgrammer vs Mutable VM?

The Mutable VM won't see the STLINK-V3 at all even though it sees other USB devices. The STM32CubeProgrammer software that comes with my dongle can open the binary and recognizes the STLINK-V3 which in turn sees the 3.3 volts coming through JTAG from the fully powered Braids board. Everything looks right, however STM32CubeProgrammer throws an error message that it cannot connect to an STM32 target. According to the STM32F103xx datasheet, JTAG is not the default programming mode, so maybe it's ignoring it until the command is sent serially to switch to JTAG. I'd like to try the serial port which my research seems to be called "FTDI". The STLINK-V3 has two serial ports that all the documentation seem to mention as purely features that can be used for automated debugging. STM32CubeProgrammer has no target protocol option called "FTDI"; the closest parameter-wise is "SWIM" which don't have Tx/Rx pins on the connector to cross-wire to the counterparts on the Braids board.
:bang:

I flashed my (factory) Clouds a few days ago with no problem using the STLINK v2 with a JTAG 20 >10 pin adaptor I purchased on Amazon. I built the firmware and flashed the device in one step using this command "make -f clouds/makefile upload". All the pertinent information is on Github page https://github.com/pichenettes/mutable-dev-environment .

Did you tell the VM to use the STLINK using the commands from the Github page mentioned above? This was for my STLINK V2 programmer:
export PGM_INTERFACE=stlink-v2
export PGM_INTERFACE_TYPE=hla

The other thing to try is to hold the reset button on the circuit board down while powering up. Release the reset button, then try to program the device. If the board isn't in reset, you can't program it. The programmer should take care of that, but maybe....

Steven

User avatar
EATyourGUITAR
has no life
Posts: 3882
Joined: Tue Aug 31, 2010 12:24 am
Location: Providence, RI, USA

Re: STLINK-V3SET

Post by EATyourGUITAR » Sat Jan 25, 2020 7:55 am

stevenb wrote:
Fri Jan 24, 2020 6:05 pm
The other thing to try is to hold the reset button on the circuit board down while powering up. Release the reset button, then try to program the device. If the board isn't in reset, you can't program it. The programmer should take care of that, but maybe....

Steven
if you do or do not need to do this should be super obvious after reading the STM32 manual, the programmer manual, and the mutable schematic. you do not need to guess what to do next. you need to read the documentation.
WWW.EATYOURGUITAR.COM <---- MY DIY STUFF

User avatar
gbiz
Super Deluxe Wiggler
Posts: 1041
Joined: Tue May 07, 2013 11:20 am
Location: Sussex, UK

Re: STLINK-V3SET

Post by gbiz » Sat Jan 25, 2020 10:34 am

stickjam wrote:
Fri Jan 24, 2020 2:30 pm
...
The Mutable VM won't see the STLINK-V3 at all even though it sees other USB devices.
...
It sounds like you need to configure USB passthrough for the programmer USB id for the VM. Until that happens the host o/s will retain access to it. You can configure passthrough from the VirtualBox console or you can add it into the Vagrantfile config script as an additional usbfilter line if you know the USB id. The VBox console would probably be easier for you, it'll show you what USB devices are not being passed through to the VM. Once you have passthrough working, lsusb in the vagrant shell will show the programmer.

I'm going to assume that as the USB id is different from the v2, you'll then need to configure openocd to recognise the stlink-v3. It might be easiest to copy teh existing stlink-v2.cfg file to create a stlink-v3.cfg & edit it as needed. The openocd config scripts (i think - i don't have a running MI Vagrant image or Ubuntu system here) are in /usr/share/openocd/scripts/interface. If you look in the config file you'll see what needs to be changed, basically the hla_device_desc & hla_vid_pid. You'll need to to edit these with sudo.
Once you have a new config file, then change the PGM_INTERFACE stanza in stmlib/makefile.inc to use your stlink-v3 interface file. (Or run "export PGM_INTERFACE=stlink-v3" on the shell before you run the first make).
This of course assumes the version of openocd that's in the MI Vagrant image supports the v3 as well as the v2. The current openocd manual suggests the current stlink driver supports all 3, worst case you'll need to grab the lastest openocd & install that.

stickjam
Learning to Wiggle
Posts: 4
Joined: Thu Jan 23, 2020 11:20 am

Re: STLINK-V3SET

Post by stickjam » Sat Jan 25, 2020 3:06 pm

Thanks guys. This gives some food for thought and things to check.

The manual for the STLINK-V3SET states that it "does not provide power supply to the target application." On some ARM forums, it's mentioned that the V3 needs Vcc from the target so that the logic level shifters can match to the chip being programmed.

https://www.st.com/content/ccc/resource ... 526767.pdf

I've done so many PIC and dsPIC builds, I can almost program them with my eyes closed. ARM is newb territory for me. To I also tried to connect to a partially built Rings board that has all the power and digital populated. Identical results. Next step is to put a scope on the JTAG signal pins to make sure there's physical communication at all. The other application I have for the V3 doesn't use JTAG, so I might have a bad cable.

After all is said and done, I may end up biting the bullet and going with tried and true--getting a spare laptop and an STLINK-V2; or an Olimex programmer since it's what Emilie uses.

Thanks

stickjam
Learning to Wiggle
Posts: 4
Joined: Thu Jan 23, 2020 11:20 am

Re: STLINK-V3SET

Post by stickjam » Sat Feb 08, 2020 1:04 am

UPDATE: An ST-LINK/V2 arrived from Mouser and I just got Braids flashed with it from the dev VM just fine. There was a problem on the board that was contributing to the difficulty, but even after fixing that, the ST-LINK/V3SET still doesn't work.

With all your suggestions, I came close to the changes needed in the VM to make the V3 work, but it still had problems. Now that I know the Braids board is good, I'll get back to trying to make the V3 work and if it does, I'll post the changes needed for posterity.

Thanks
-Bob

User avatar
Pav
Wiggling with Experience
Posts: 272
Joined: Sat Mar 19, 2016 3:21 pm
Location: UK Hampshire

Re: STLINK-V3SET

Post by Pav » Sat Feb 08, 2020 5:24 pm

Well done Bob for your persistence here. :yay:
I too have been researching the mutable development environment this week to understand if a friend could use the Stm32programmer sw and stlink v3 . The former is not a full ide but flashes mpu.I believe I will need to make a mod to chosen modules makefile to add a target to build the combined boot loader hex and program hex hex file and place a copy in the build directory. I see in stmlib/makefile.inc where the combining is done as part of "make upload" . Didn't see it place a copy anywhere That I can import with stm32 programmer. ( if someone comes back and says oh yes it does..Cool)
rgds Pav

User avatar
gbiz
Super Deluxe Wiggler
Posts: 1041
Joined: Tue May 07, 2013 11:20 am
Location: Sussex, UK

Re: STLINK-V3SET

Post by gbiz » Sat Feb 08, 2020 6:04 pm

One thing i just noticed i forgot to mention above, you'll need to create a udev rule file for the v3 in the vagrant image.

In /etc/udev/rules.d/ you'll find 3 rules files with names beginning "49-stlinkv". You'll need to add a similar rule file for the v3 that contains the usb id for the v3. You'll need to do this as root or run each command with sudo. Once you've created the file, reload the udev rules with "sudo udevadm -R" to load the new rule.

Post Reply

Return to “Music Tech DIY”