STM32 Programming via USB (DFU) - Phil's Lab #72

preview_player
Показать описание
How to flash firmware via USB to STM32 devices via DFU (device firmware upgrade) and STM32 Cube Programmer. This way you do not need an ST-Link or similar programmer to flash firmware - however, you cannot set breakpoints, debug, and so on.
Note: this is only supported on certain STM32 microcontrollers (check the datasheet!).

[SUPPORT]

[GIT]

[TIMESTAMPS]
00:00 Introduction

00:24 Altium Designer Free Trial
00:43 JLCPCB and Git Repo

01:08 STM32 DFU Overview

01:58 Test Firmware
02:38 Generating Binaries

03:19 STM32CubeProgrammer and Flashing (BOOT0=1)
04:37 Run Mode (BOOT0=0)

ID: QIBvbJtYjWuHiTG0uCoK
Рекомендации по теме
Комментарии
Автор

I love when I open YouTube and see that you got a new video online. USB is underrated as a simple communication interface in the embedded space. Since VCP is readily available for STM32 chips, I stopped using UART with an FTDI UART->USB chip. USB is much more reliable and easy to work with. If the data arrives, it is correct because the USB protocol checks all the errors for you. No need to add a CRC to messages or anything.

thegame
Автор

Great video, I get excited whenever I see you upload a new video because I'm sure it's going to be full of useful information

EfraAv
Автор

Hi Phil, Thanks for the video! For my final year thesis I've been designing a flight control system from scratch and I've been using STM32 Programmer this to flash to a matek f7 FC - except I've been using a hex file.

I wish I had found your videos at the beginning of my project, particularly your sensor fusion video part 1, because I must have spent more than 200 hours trying to get an angle measurement from raw gyro/acc data haha.

Keep up the great work though mate, a lot of people will appreciate it.

steev
Автор

Good video, thanks for sharing, is there specifications in pcb layout to get the pc detects the stm32 as a driver? Are the 22 ohm therminal resistors needed? How to properly route the lignes from the stm32 pins to the usb connector ?, thanks

TnInventor
Автор

Is it possible to bring up a serial monitor during normal operation with cube ide? I have a 3d printer running Marlin on an STM32 but the usual ways of connecting are closed off (USB not exposed). I wondered if I can get a console to Marlin via cube IDE if I hack on the USB lines.

Audio_Simon
Автор

are there any hardware considerations that need to be taken into account for this to work? Looking at some of the STM32 F series datasheets, it mentions that for the embedded bootloader to work over serial interfaces such as UART and USB requires that the crystal oscillator be of a certain value. Is this the case here?

yamaan
Автор

thank you for the useful video,
what if we want to secure the firmware, what should be done before downloading the firmware, and which config is needed?

myetis
Автор

Hi!

1. Does the boot0 pin need to be pulled and held high in STM32 throughout the whole DFU process over USB or does it behave like raspberry pi rp2040 where the state of the boot0 pin is changed momentarily while pressing reset?

2. If I configure an stm32 MCU on cubeIDE (GPIO pins, crystal, USB, etc.) and get a compiled bin/hex file, and want to run QMK keyboard firmware which also compiles to give a bin/hex file, how do I flash both the files without one overwriting the other?

agneeshwar_
Автор

Thanks for the video. Can you use the .dfu files, instead of the .elf files? I had been using the Dfuse Demonstrator for firmware updates using the .dfu files, however, for a while now, I've not been able to do it. I've been using the STM32CubeProgrammer for my firmware updates BUT using the .hex files. I'm still trying to figure out how I might be able to use the .dfu files though for firmware updates. Any suggestions?

bongoonfire
Автор

Thanks for the tutorial, one question: Is this feature about download/program STM32 able for all MCU series?, Is possible in particular case of STM32F103xx?. Thanks in advance.

germangomez
Автор

Can I program via USB from the get-go? As in once I get the assembled board, program from USB immediately?

lambsauce
Автор

Great work,
I am currently working on my final year engineering project using STM32 and your videos are getting me up to speed.

Thank you. and If I may ask, once we design our PCB and have the manufactured and within it build our own circuits that would otherwise be purchased as modules e.g STM32 chips, GPS, mpu6050 etc, do they come ready to accept the code or do we have set up the firmware or drivers?

geraldmbuthia
Автор

Hey Phil! Great video as always. Any chance you could talk about programming STM32 chips using the Arduino IDE? I realize that a specific bootloader needs to be flashed but I am having trouble finding a good source that explains how this is done not using a developer board. Any help on this topic would be greatly appreciated, thank you!

jimmykessler
Автор

I noticed you're using GPIO_WritePIn for driving your LEDs, I wondered if it would be more advantageous and efficient to use PWM for LEDs, what' your take on this?
Also what's the reason and advantage of uploading your .elf file via STM32 programmer (it doesn't work on WIn11) instead of doing it directly from the CubeIDE?
When I program my boards I just use SerialWire.

andrewFJ
Автор

nice
So if i want to use usb to uart bridge i need to just select UART ?

sanjikaneki
Автор

Can we use cube programmer for blue pill

farukbeyaz
Автор

I'm pretty new to this entire STM32, can you do this with a brand new chip as well? or do you still need to upload some kind of bootloader via SWD first?

spacekip
Автор

Hi Phil,

As i understand, we will not be able to debug the device when only connected via USB, is this correct?

LiveEnjoyment
Автор

Could you do a tutorial for openocd on a raspberry pi? Essentially remote flashing stm32 boards

shahinhaque
Автор

Hey. Thank you so much for creating this content. I really learn a lot about embedded HW/SW design from your videos.
When will the second part of "ESC Hardware design" be published? And are you planning to make a video about implementing FOC on the finished ESC?
Keep up the great work.
Best regards from Germany

tomhunemorder