The general steps are as follows:
- Solder wires to the board.
- Configure the STLink of the Discovery board.
- Apply external power to the Vdd pin of the SWD.
- Clear flash memory of the chip.
The following items are required:
- CX-10 quadcopter (~$15)
- STM32F4-Discovery Board (~$15)
- Some wires and female pin headers for a connector
Solder wires to the board
This link basically tells it all:
And this is what is looks like:
Configure the STLink of the Discovery board.
I used the STM32F4 Discovery Board as programmer for the CX-10. This is a cheap solution but another STLink programmer will do as well. The jumpers need to be removed as shown in the picture (I left them on to prevent losing them). Then, I made an ugly adapter to fit the connector on the drone.
Apply external power to the Vdd pin of the SWD
The blue version of the CX-10 had a power regulator that is normally enabled by the STM32F050 processor itself. But if this power regulator is disabled, the processor also has no power! This becomes problematic when flashing the device, since it is not able to supply power to itself. We need an external power source while flashing the device. I solved it the quick and dirty way by extracting 3 Volts from the VDD pin of the Discovery Board.
Clear flash memory of the chip
Read protection of the processor is enabled by default at level 1. This needs to be disabled before the device can be flashed. This can be accomplished through the STLink Utility (only available for Windows). Go to Target->Option Bytes, select Level 0 and press apply. Then, go to Target->Erase Chip. Make sure to apply external power to the VDD-pin of the SWD connection. If anyone knows how to do this in Linux, let me know!
The next step is getting to blinky.