I have started learning stm32 microcontroller for a while using a very small development board "stm32f103c8t6" (or blue pill). when I started, I learnt from some tutorials that I have to switch a jumper in order to program it.
(The photo is a screenshot taken from a random tutorial, but every tutorial I have watched also said that)
The jumper – as far as I know – only changes the boot mode of the processor to load from the system memory(the bootloader) which only takes effect if I restart the board to starting booting from there.
I don't know how is that supposed to be a "programming mode" as I'm using an external st-link programmer that uses SWD.
So my question here , Is there really such a thing called "programming mode" ?
and if so, How exactly does it work ?
Also it's worth mentioning that I've just tried to program it and the program worked as it's supposed to (I hope I haven't screwed anything up :d ).
Best Answer
You only need to put the microcontroller into bootloader mode if you're going to program it over the UART, using the bootloader.
Generally speaking, you can program the microcontroller over SWD at any time.
The primary exceptions are if the microcontroller is running a program that disables SWD by setting a
SWJ_CFG
bit inAFIO->MAPR
(e.g, to use the associated pins as GPIOs), or if the MCU is running in low-power modes without the appropriateDBGMCU
flags set to keep the debug interface active in those modes. If any of these are the case, putting the microcontroller into bootloader mode is an easy workaround, as the SWD interface is active (and sleep modes are not used) while the bootloader is running.