2017-04-05 01:20 PM
Hi,
First, let me just say that I am new to the STM32 series of microcontrollers, so if I am asking the obvious, or has already answered somewhere else, I apologize.
Now, I want to use a bank of STM32F407s as co-processors for a bigger computer system. To this effect, I need to download firmware to the STM32s from the main CPU over and over again. I know I can do this using the bootloader in the STM32's system memory, but I am worried that it will not be able to recover, should the system memory gets corrupted.
So, I would love to program my code directly into the STM32's flash memory using JTAG or something similar, without going through software running on the chip. There is a lot of info about how to do this on the STM8 family, but nothing on the STM32.
How can I do that?
Ronald
2017-04-06 04:20 PM
I know I can do this using the bootloader in the STM32's system memory, but I am worried that it will not be able to recover, should the system memory gets corrupted.
This is not very likely without the chip being subjected to environmental stress far beyond normal operating conditions. Do you plan to operate it e.g. in a highly radioactive environment or at extreme temperatures?
You don't need to believe me but this is the way to go; the other one is lengthy, obscure, and full of pitfalls.
There is a lot of info about how to do this on the STM8 family, but nothing on the STM32.
The info is out there but as it is with other things in these SoCs, it's at the designer of the relevant IP block, in this case the debug modules which are part of the core. Ergo, you have to go to ARM to get most of that info; ST provides only the FLASH programming itself (which is described in the respective chapters of RMs). Be warned, ARM is not exactly famous for well-organized and easy-to-understand documents.
You can also have a look at open-source implementations of various levels of debuggers, namely the Cortex-M- relevant portions of OpenOCD but mainly the BlackMagic Probe.
JW
2017-04-06 05:22 PM
J-Link and ST-Link will do the job if you have the port for the chip doing it.
2017-04-07 03:53 PM
Thanks guys. I've decided to go with both. I have additional I/O available on my main CPU, so will go through the bootloader for a start, but keep the connection between my main CPU and SWD interface for later.
2017-04-07 06:04 PM
I do not have a port. My main CPU is another ARM chip. Where do I find the source code for the ST-Link? I don't mind porting it myself.
Ronald
2017-04-07 07:10 PM
The source code for the ST-LINK is not available. You'd be better looking at open source implementations of the SWD/JTAG protocols if that is the way you want to go. Unless you're going into the cores at Fukushima I'm not sure I'd be loosing sleep about the System Memory OTP failing, more productive things to worry about.