2020-05-13 05:15 PM
Hello
This is my first time using STM32 MCU on my own PCB.
I know that I have to take many things into consideration. Please help me if I am missing something
I have wired up all VDD/VSS/VDDA/VSSA/VUSB with bypass caps as close as I could
I have used external crystal oscillator, taking intro consideration input capacitance of STM32 MCU. Then I will specify in CubeMX that I am using external clock.
I have included Vcaps as well. (2x 2.2uf ceramic)
I have boot0, SWDIO and SWDCLK floating. Hoping that when I want to flash MCU, I will pull boot0 down and use SWDIO and SWDCLK and after that power-cycle MCU to get it running.
However, I am not sure if I am doing flashing correctly, Do I have to pull up/down either of them? After power cycling, if boot0 is floating around, will MCU run program loaded in flash ?
2020-05-13 06:48 PM
You need to make BOOT0 is pulled down to ensure your code starts from FLASH every time, left floating it can lead to unpredictable startup, especially if the supply rises slowly.
The part will start without an external crystal.
2020-05-13 07:25 PM
In addition to what clive1 says:
> However, I am not sure if I am doing flashing correctly, Do I have to pull up/down either of them?
You don't need pullups/pulldowns on SWDIO or SWCLK.
You should be able to verify flashing by connecting with STM32CubeProgrammer and looking at the flash.
2020-05-14 06:15 AM
This is where I get kinda lost. What if I want to flash the memory ? Do I pull up BOOT0 in that case?
So for normal operation (running the program) I need BOOT0 to be pulled low at startup, and for flashing I need to pull it high?
2020-05-14 06:38 AM
Thanks!
I know im getting annoying but please could you tell me if I have to pull BOOT0 up in order to flash the memory with binary file?
So after that I will power cycle it with BOOT0 pulled down and the program will be run ?
2020-05-14 06:47 AM
> could you tell me if I have to pull BOOT0 up in order to flash the memory with binary file?
To flash with ST-Link, it doesn't matter unless you're remapping SWD pins, but pulling it high at reset might be safer. To flash with the system bootloader, it needs to be high at reset in order to enter the bootloader.
> So after that I will power cycle it with BOOT0 pulled down and the program will be run ?
Yes.
2020-05-14 07:08 AM
It is a short journey..
You don't need the BOOT0 high or low to program the flash via JTAG/SWD.
It changes the code that the processor starts from. In normal operation it should be low, not indeterminate.
If you want to run the System Loader from ROM, BOOT0 should be HIGH. This permits programming methods via USART, USB, CAN, etc. See Application Note AN2606