Flashing your DIY Mutable Instruments Module over JTAG/SWD
Connecting to a mutable instruments module via JTAG with an STLinkV2 debugger or discovery (disco) board over SWD.
Use this walkthrough at your own risk
I assume this goes without saying, but everyone else always provides this notification at the top of any tutorial, so someone must have lost a lawsuit over not posting this info at some point.
Use this walkthrough at your own risk. I do not accept liability for damages to your diy unit for following this walkthrough. I am just some random dude on the internet and am not an authority on this module or this process.
The findings in this overview are in the interest of collaboration and helping others only. If you feel any of this is in error, feel free to reach out to me to correct.
Thanks and have fun!
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Prerequisites
Your MI board of choice ready to power up. I recommend Adam’s website: https://www.amazingsynth.com/clouds-pcb/
A 12v AC (+12/-12) psu: https://www.tindie.com/products/p0k3t0/basic-eurorack-power-supply-kit-or-assembled/
A computer with Windows 7,8,10 (This is what I used after fussing w/ STM32CubeIDE for a while)
Micro Jtag connector (buy this w/ your MI module parts): https://www.adafruit.com/product/1675
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Prerequisites
Discovery board (disco board) : https://www.digikey.com/product-detail/en/stmicroelectronics/STM32F0DISCOVERY/497-12876-ND/3045359
Your homebrew MI module:� Board from amazingsynth https://www.amazingsynth.com� Components from digikey https://www.digikey.com/� Specialty components and knobs from thonk https://www.thonk.co.uk
CHECK YOUR GROUND/3.3v RAILS AGAINST YOUR CHIP BEFORE POWER ON (In these instructions)
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
What is our goal?
We are trying to flash our STM32 via its JTAG port over SWD protocol via a discovery board.
The general order of steps is:
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Time sinks
https://mutable-instruments.net/modules/clouds/open_source/ is super useful, but most of this ended up not being helpful for just getting the hex file onto the board. I spent a lot of time setting up the interface to build the hex file only to find that I already had access to a pre-built hex file through amazingsynth.com.
Not checking voltages across all of the pins first. Trust the software. If the ST-Link can connect to the onboard STM32, it can connect to the MI module STM32. They are connected in an identical way.
Make sure your jtag connector is connected to the reverse side of the board. You may be tempted to solder the jtag connector to the same side as all the other parts, but this would be an error. The jtag, power and ftdi connect all connect on the rear side of the board, following the silkscreen indication.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Time sinks
Having multimeter probes that are WAY too big to interface while troubleshooting. I made a pair of mini probes with some 16ga wire and some 22ga hookup cables. Made a little spring out of the 16ga and then soldered the 22ga wire to it as a probe. Put a small piece of shrink tube over it and bent the spring slightly so it kept constant pressure.
Mutable instruments forum (reasonably) will not assist with diy modules even in the diy section.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
What is an ARM STM32?
https://www.st.com/en/microcontrollers-microprocessors/stm32f405-415.html
Pins start to the left of the SMALL dot and rotate around the board counter-clockwise. VDD, then PC13, Then PC14, etc.
The large dot on the chip is not the indicator of pin 1, it’s a smaller dot and it is actually recessed. This is critical.
We will be communicating via STM over JTAG, which uses PA14(JTCK; clock) and PA13(JTMS; data)
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Check your GND and 3.3V inputs
Set your multimeter to beep mode to check for dead shorts and put one terminal at ground. Check each of the 3.3v inputs on your STM32 chip and be sure that you don’t have a dead short from 3.3v to ground on any pin.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
SWD Connection
We will be communicating via SWD over JTAG, which uses PA14(JTCK; clock) and PA13(JTMS; data)
Thse 2 pins, paired with ground and 3.3v will give us connectivity to the discovery (disco) programmer.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
What is JTAG?
JTAG stands for Joint Test Action Group and is used to directly connect to a chip for general diagnostic and programming.
JTAG is industry standard and is built into most communication devices for troubleshooting.
We are using MicroJTAG, which uses 10 pins instead of 14 and the spacing of the pins is 0.05”.
For a full 30 minute rundown of JTAG, please watch EEVBlog’s overview here.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
What is SWD?
SWD stands for Serial Wire Debug and is a simplified and proprietary connection method for interacting with ARM brand microprocessors that combines all communication through the swdio pin.
We are using the jtag port, but we will actually be interacting with the device through SWD to program it.
This is important because you will have to select SWD from within the STLink software and the JTAG option may cause some confusion.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
JTAG/SWD Pinout
We are now looking at this from the perspective of the opposite side of the main board. The micro jtag connector connects to the back side of the board.
This may vary by device, but I have checked 4 other modules and they are all following this standard sequence.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
What is an STM32 Discovery Board?
The discovery board has an STLINKv2 directly on it.. It’s wired to the onboard chip
This also has a spare STM32 processor on it. The STLINK is totally isolated from this processor, so you could totally remove it from the board and use it in a pinch with a hot air rework station.
Unplugging the discovery pins (CN2) will disconnect the spare STM32 processor and you will have direct access to this unit as if it’s an STLINKv2.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Connecting via SWD over JTAG
Pinout:
On the disco board, disconnect both CN2 jumpers and set them aside
You should now be able to plug this in and communicate with your computer
Discovery
Board
MI Module
JTAG Port
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
STM32 Pinout
VDD is Ground
VSS is 3.3v vin
PB12 sits at 0.5v constant, this is your JTCK pin (clock)
PB11 sits at 3.3v constant, this is your JTMS pin (data)
NRST should be low. All other pins should be read low
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
STM32 Crystal
Prior to flashing, the crystal will not be running. The STM32 has an internal clock circuit.
An inactive clock is not subject for alarm.
The other crystal will be actively oscillating and may throw you off. I figured if 1 was oscillating, the other should be. Not so!
You may still need the crystal in place to flash the unit.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Getting STLink
https://www.st.com/en/development-tools/stsw-link004.html
You have to register for an account. It’s free, but it’s weird and�controlling like most of these engineering softwares.
I ran into a problem where I had to use the same browser that I requested the software from. So ordering it in chrome, then going upstairs to my windows machine and opening it in firefox wouldn’t work.. Had to be chrome if I was browsing the website in chrome.
You’ll get a link to download an install. This will also install the drivers for the disco board.
Keyleth Cameron - keyleth.cameron@gmail.com
This is a living document and is subject to change
There are 2 files...
Adam from AmazingSynth.com sends pre-built binaries whenever you buy from him.
Both hex files (located in AmazingSynth.com’s repository below) are available inside their own folders. There is a bootfile and the main folder. You need both folders for each module.
https://www.dropbox.com/sh/z7p2epcbigvl57c/AADl-A8MvFatvBTd0IGirK2ha?dl=0
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Uploading firmware via STLink
Once everything was hooked up, this was REALLY simple. Like stupidly simple.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Uploading firmware via STLink
These are my successful settings.
Once I had a proper connection, after I clicked connect (or refresh here) I got a firmware version and a serial number.
Note I have selected SWD and 4.0MHz
Hot plug and reset mode kept throwing me for a loop. It would ask me to change these settings to connect, but these ended up being what I needed.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Uploading firmware via STLink
I didn’t change a dang thing here. But here are my settings.
Reset wont work because we didn’t hook up the reset pin, so you’ll have to manually reset after it’s done flashing.
If you made it here, congratulations! Hit Start and upload your firmware. Then do the whole process a second time and upload the main file.
HOLY DOOTS YOU’RE DONE! CONGRATULATIONS!
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Resources (Written Knowledge)
Cheeky tutorial on building MI clouds | |
Installing firmware | |
Purchase list | |
PCB Purchasing Location | |
FTDI programmer (not needed) | |
Parts list (BOM) | |
STLink Debug Overview |
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Resources (Videos)
JTAG | |
Boundary Scan | |
SWD |
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Resources (Software)
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Driver/download website for the STLink Programmer (windows only) | |
Autodesk EagleCAD reader | |
STM32CubeIDE |
Resources (Stores)
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
PCB Website and resources to build your own MI board from scratch | |
General electronics distributor | |
General electronics distributor | |
Electronics prototyping distributor | |
Knobs/Pots/Jacks | |
Knobs/Pots/Jacks |
Acknowledgements
Acknowledgements to the community at https://www.reddit.com/r/synthdiy�Thank you for all of your help!
Thank you Adam at https://www.amazingsynth.com for all of your help.
Thank you to Mutable instruments for all of the resources you have provided open-source.
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Contact me
This is a living document and is subject to change
Keyleth Cameron - keyleth.cameron@gmail.com
Appendix: A
This is a living document and is subject to change
Pinouts on stm32
Keyleth Cameron - keyleth.cameron@gmail.com
Appendix: B
This is a living document and is subject to change
Pinouts on discovery board
Keyleth Cameron - keyleth.cameron@gmail.com
Appendix: C
This is a living document and is subject to change
General schematic of clouds
Keyleth Cameron - keyleth.cameron@gmail.com
Appendix: C
This is a living document and is subject to change
General schematic of clouds
Keyleth Cameron - keyleth.cameron@gmail.com