# Stand-alone flashing of STM32

I'm developing a fixture tool to test a custom PCB with ST Bluenrg1 (STM32 M0 core + bluetooth).

This fixture tool has its own MCU working at 5V.

I would like to flash automatically first previous to test the pins of the board, but I'm looking for a best solution to do this without spending 600 EURO in a "Flasher ARM" (which allows stand-alone flashing via hand-shake protocol).

The idea is to use the MCU of the testing tool to ask the Flasher to start the upload of the firmware, and answer to the Testing Tool if it has been done correctly or not.

I'm checking options with raspberry + OpenODC, raspberry + usb STlinkv2, looking for flashers with stand-alone mode... but I'm getting a little bit confused with the best option (best option with relativelly low cost).

Which solutions do you use when want to program your MCUs without computer?

UPDATED: I’m using SWG protocol to program it with a computer and a STLINKv2 programmer. I do it by hand, previous to test the connections in the testing fixture tool. I would like to include this programming step in the Testing fixture tool, and make it as simple as possible, as this will be done in the warehouse by other people (the idea is the testing tool to upload first the code and if everything is Ok, test the connections)

• each mcu has its own solution(s) so you pick from those. a cortex-m0 core means that swd is certainly available and there are various very low cost solutions there. including sometimes built in bootloaders with their own protocols. An ftdi breakout board with mpsse can with the right software program any of these protocols that dont involve different voltage levels. and those can be had for $15 full retail. There is no reason to be paying more than that to program/develop on a cortex-m. the stlinks are$10. jlink clones $5 and so on. – old_timer Dec 16 '19 at 12:59 • there is no such thing as "best", its all relative. My best, his best, her best may not be the best one for you. Depends on your setup which there isnt enough space here for you to describe. You read the datasheet/documentation for the part in question and choose the option if only one or one of the options if more than one. Or use a different part. – old_timer Dec 16 '19 at 13:01 • I design with this in mind st.com/en/development-tools/st-link-v2.html – Dirk Bruere Dec 16 '19 at 13:42 • Pi gpio to SWD works with openocd, may not be electrically robust but spares are cheap. Any embedded Linux system could typically host a USB SWD just make sure (with a scope) it can actually drive NRST. You would not want your tool to be based on an MCU alone as the other part of this is typically record keeping. – Chris Stratton Dec 16 '19 at 15:17 • Your edit only reiterates what was already true: the component pieces are the same as your current PC setup, what you need is to find a smaller system that can do the PC's job and give it a simple user interface like a small monitor, a button to push, a good/bad indicator, generate whatever serial number sticker / unique signed certificate / general output you require, etc - this is really not an MCU job, though you might end up needing an MCU as a delegate to do some particular task on behalf of a larger system. – Chris Stratton Dec 16 '19 at 20:25 ## 1 Answer You're looking for a bootloader. Luckily the Bluenrg series comes with bootloader developed by ST. You can refer to AN4872 for the details. From the document The BlueNRG-1 and BlueNRG-2 bootloader is activated by hardware forcing high DIO7 at device reset. Take care that the Bluenrg is a 3.3V MCU (If I remember correctly), you may need to additional hardware changes. • You can also get a production programer which stores the code in itself rather than needs to connect to a PC but$ – DKNguyen Dec 16 '19 at 3:28
• No. This is a place for SWD as the question asks, not a bootloader – Chris Stratton Dec 16 '19 at 15:16
• @ChrisStratton I disagree,The question isn't about SWD. As far as I understand a bootloader is perfectly suited for OP's need. – Anubhav Dec 17 '19 at 8:40