boot switch settings and the waggling thereof

STM32duino bootloader aka Maple bootloader
Post Reply
Posts: 1674
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

boot switch settings and the waggling thereof

Post by zmemw16 » Fri Jul 22, 2016 11:10 pm

i thought i'd watch it, invoking the serial boot loader seems to involve waggling of the boot0 pin
see 4m 6s setting boot1 low and boot0 high to enable system boot loader
see 5m 35s or thereabouts boot0 is set lo, boot1 can be left low

so when i connect my 'usb ftdi' to tx1/rx1 PA9/PA10, i would need boot1 low, boot0 high and the upload method as serial?
once it's written to flash, then to run i now switch boot0 to low and hit reset.

does using the stlink upload method involve this boot0 switching? reset i can understand :)

does either method alter the mapping of the serials, i'm setting up serial/serial1/serial2 etc and printing a 0/1/2 at the start of output lines - sometimes its a 0, sometimes it's a 1

now by 12'ish mins, i think i'm 62, given 07/54 - is that correct? my sister 03/57 thinks different - not surprising.
to be honest, i'm not that certain either, it's array mapping again, [0] or [1]


User avatar
Posts: 7680
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia

Re: boot switch settings and the waggling thereof

Post by RogerClark » Fri Jul 22, 2016 11:42 pm

Its all very well documented by ST

If Boot0 is LOW it doesnt matter what Boot1 is set to.

When Boot1 is HIGH, the STM32 read Boot1 after reset and uses the value to switch between upload to Flash (Boot1 LOW) or RAM (Boot1 HIGH)

After upload, the uploader sends a command to the STM32 (via serial) to run the sketch

However, if you power cycle the board, it will not run the sketch because Boot0 is still high. So to run from cold boot you nee to set Boot0 to LOW.

STLink uses the SWD pins not serial pins, its a special hardware / data protocol.

STLink does not need Boot0 = HIGH, will upload at any time, with Boot0 LOW or HIGH

If you have used the bootloader upload method, the libmaple (Arduino) core, re-assigns the SWD pins (used by STLink), as GPIO.

So if you connect STLink to a board which has the bootloader etc, SWD will not initially work.
In this case, the easiest option is to set Boot0 = HIGH, and upload the sketch via STLink, as this changes the SWD pins from GPIO back to STLink

After you have done this once, you can set Boot0 = LOW and leave it LOW, as STLink will always connect

Post Reply