Flashing STM32 with ST-LINK, JLINK and UART Bootloader, cross platform | VIDEO 44

  Рет қаралды 80,138

Matej Blagšič

Matej Blagšič

Күн бұрын

Пікірлер: 65
@TimmyWhiskers
@TimmyWhiskers 3 жыл бұрын
Programming and flashing STM32 from VSCode is a dream come true. Thank You!
@Abdullu
@Abdullu 4 ай бұрын
For Debian 12: If you installed "stlink-tools/bookworm-backports" and when executing "st-info --probe" you get "ERROR usb.c: Could not open USB device 0x0483:0x3748, access error." ... then execute (with elevated privileges) "udevadm trigger", then "udevadm control --reload-rules" ... this will reload udev rules installed with the apt package without requiring a reboot. These udev rules allow all regular users to interact with ST-LINK hardware debugger USB devices, including the "clone sticks".
@mzalewski
@mzalewski Жыл бұрын
Thank for section about programming using UART! I just disabled SWD (I set all pins as inputs 🤦‍♂) on processor by mistake and UART is the only option to reprogram it. You are my savior! 😀
Жыл бұрын
I did that as well heh, so some degree. I just used JLink and connect under reset. Since the pins only set themselves to input when the code boots, you can connect the debugger to the core right after reset. Debugger and their tools saved me that time :)
@tariqsingh3747
@tariqsingh3747 6 ай бұрын
couldn't you boot0 yourself to safety?
@haydenbraxton8095
@haydenbraxton8095 3 жыл бұрын
Super thorough video! Thanks for this.
@Cptnbond
@Cptnbond 3 жыл бұрын
Inspiring, I just must test this, thanks a lot for the through demonstration. Cheers.
@majdkassem767
@majdkassem767 3 жыл бұрын
Thank you for sharing your experience
@zhitailiu3876
@zhitailiu3876 2 жыл бұрын
Thanks for this great video, it help me a lot!
@berkay8406
@berkay8406 Жыл бұрын
You're amazing, nice work!
@hieucdtspk
@hieucdtspk 2 жыл бұрын
It's a great tutorial, thank so much!
@Aldo85ita
@Aldo85ita 5 ай бұрын
Thank you very much for this video! Did you make a video about how to flash stm32 by stm32flash utility over i2c?
@jainvibhore1997
@jainvibhore1997 Жыл бұрын
Great tutorial, I was wondering if it was possible to upload the binaries over USB with something like maple bootloader installed on cheap bluepill boards?
@psnyder9442
@psnyder9442 2 жыл бұрын
I have been helped a lot by several of your videos, thank you very much for your clear explanations. I now have completed my s/w development on an STM32F411RE and wish to use it standalone, that is, with no laptop connected. Do I have the correct understanding that if I use the STM32CUBEProgrammer to program my flash memory using the project .bin file created by STM32CUBE IDE as you describe, that I can disconnect my laptop, connect a dedicated board power supply, and my code will run as intended? I am unclear, for example, if that project .bin file includes all of the setup actions such as interrupt vectors, clock and peripheral initialization. I understand that I will need to consult the manual to configure the jumpers to allow this to happen, but I can probably figure that out on my own. Thank you.
2 жыл бұрын
Hi, I'm glad that my videos have helped you. When you flash your board, more often than not, you flash your program in .bin format, which includes everything (functions, static data, constants, system init, etc.), you write it into internal flash memory which is non-volatile. This means, that even after disconnecting power, the contents of your application will be left intact. Therefore you can flash your board with either Cubeprogrammer or with newer stlink v2s you can just drag and drop the binary into the mounted stlink drive and the device will flash itself. After that on every power on , the board will start your application. Thank you for watching.
@psnyder9442
@psnyder9442 2 жыл бұрын
@ I took your advice and it worked! Then, I powered by an external ps and it powered-up and ran my code. Then, I powered down and reconnected to ST-LINK and could continue development. Wonderful, thanks again!
@sruthins4143
@sruthins4143 4 ай бұрын
How to do through CAN?
@VillageShorts36
@VillageShorts36 7 ай бұрын
hi i have a sti7111 board but uart is block can we open uart with stm32 ?
@xThirdOpsx
@xThirdOpsx 2 жыл бұрын
Thanks a lot for this video. One question: in the uart example you show the use of the dtr and rts pins, but the uart interface on any stm only requires rx and tx, and dtr and rts only go to the ftdi chip or whatever other uart-usb bridge one has. Is my understanding of the circuit correct? Does this also mean that if I choose a usb-uart bridge that doesnt have those control signals I won't be able to flash the stm32? Thanks
2 жыл бұрын
That's correct. In the video I used a ft232 chip on a breadboard which has dtr(connected to boot0) and rst available. Some uart cables/adapters omit dtr pin, like the official ftdi cables, that just have cts instead of dtr. Cta cannot be used as output, so for flashing it's useless. Well, you can also get the device into boot mode by switching pins manualy and therefore you can omit options that use that pin.
@xThirdOpsx
@xThirdOpsx 2 жыл бұрын
@ Thanks! So basically you are taking advantage of the fact that the dtr lines goes high right before starting transmitting the new firmware and goes low when finished, which is exactly how you want the boot0 pin to behave, so you just tie them together, is this correct?
2 жыл бұрын
Partly. In the video I configure the particular ftdi chip to have the dtr low at idle - this would make the stm32 use default boot from flash. Then I toggle the dtr line along with rts using the stm32flash command, which puts the mcu into bootloader mode and out again after flashing. So if your ftdi/serial cable does not have dtr, then remove the ping toggling options of dtr and rts and perform the bootloader yourself and also the device reset after flashing as well. That reminds me to look into cables with dtr exposed instead of cts.
@xThirdOpsx
@xThirdOpsx 2 жыл бұрын
@ Ok now after reading the stm32flash docs it's more clear what you are doing. I will not use an ftdi chip in my design so I will have to possibly place an inverter gate in dtr and rts, will check the datasheet for the default logic level. One last thing I need to verify is that stm32flash is able to use those signals regardless of the uart ic in use. Seems pretty obvious that this pin toggling action should work with any uart ic that has those signal. Personally I will use the CH340C.
@dummag4126
@dummag4126 3 ай бұрын
why not with usb?
@Tome4kkkk
@Tome4kkkk Жыл бұрын
Those interfaces are often more expensive in Poland than the development board. Does neither of these method work with just a plain microusb cable?
Жыл бұрын
All methods using STLINK or JLink utilities are available for the devboards using onboard debugger. With JLink you are limited to debuggers up to version 2.1. It does not work with newer stlink v3.
@DanialKoosha
@DanialKoosha Жыл бұрын
افرین
@AdlaneHichemBRIKI
@AdlaneHichemBRIKI 8 ай бұрын
Hello, Thank you for your this tutorial. Do you have the pinout of your stm32 with the ftdi chip? i'm putting DTR to boot0, RX => TX(uC), TX => RX(uC) what else am i missing? Thanks
@AdlaneHichemBRIKI
@AdlaneHichemBRIKI 8 ай бұрын
I didn't end up using the dtr pin, i just set boot0 = 1 and boot1 = 0, and use the stm32flash utility and it worked (nucleo-F401RE), this is the command : stm32flash.exe -w led_blinking_F4.elf -v -g 0x0 -b 9600 COM10
@herantd
@herantd 11 ай бұрын
If your on MacOS, just remove '-e' before 'si 1' and before 'r'
@JeffHykin
@JeffHykin 2 жыл бұрын
What terminal prompt are you using? I really like the grayed out username@host on the right! And great video. Showing *how* and where the original info is in the manuals/docs was phenomenal.
2 жыл бұрын
Thank you for the comment, I'm glad you found my video usefull. As for the terminal prompt ... I was in the process of building a better one (as you can see in all the videos, even ditros change). Only constant is zsh, which is my shell of choice. I played around the raw .zshrc config adding info to the right part of the promt. Here I moved usual username and hostname to the right with grey colors, so that there is more space for the current path. Later I moved the username:hostname back to the left with rainbow colors, but I added git info (when in git repository) to the right. I don't have that exact config anymore, but I configured this with snippets from the forums (search for "zsh right prompt") and you'll figure out the syntax and where to change the contents and color. I recommend Luke Smith's channel and his config: github.com/LukeSmithxyz/voidrice/blob/master/.config/zsh/.zshrc Nowdays I use starship.rs/ and I love the two line promt - now there is SPACE for the command line even with a long directory path. I even added git info, nix, etc. You can find it in my repository for fedora config (distro does not matter): github.com/prtzl/fedora-config.
@JeffHykin
@JeffHykin 2 жыл бұрын
@ thanks for the detailed response! I'll definitely search that I also use Zsh (spaceship-prompt), I've been looking at upgrading to starship but haven't made the switch yet. I've also been watching the warp terminal project
@IsrarSayed
@IsrarSayed Жыл бұрын
Which Pin of Microcontroller you are connecting to RTS ?
@sinushkin
@sinushkin 2 жыл бұрын
Thank you a lot! what will happen if you regenerate project from CubeMx? Will it rewrite you Makefile with your custom jflash task?
2 жыл бұрын
I can't belive I did not mentioned this, because I have a feeling I did in at least one video, but I cannot find it. I have also tested this now as well, but the answer is still NO. It will update certain sections, where you add new peripherals and it would add include paths, but if you delete some parts of it, it won't write them back or correct them. Only if you delete the makefile, it will create a new one. Make sure to use git for your project, even if just localy, to prevent any accidental damage to the makefile.
@sinushkin
@sinushkin 2 жыл бұрын
@ ok, thank you. I just thought that put flash tasks to make file is wrong (ideologically) vscode can cascade tasks. For example you can create task make, flash and combine them into another build'n'flash. And use it in preLaunch. In this case you can leave makefile prestine.
@cantaff0rd2
@cantaff0rd2 10 ай бұрын
Hi. Nice series. Do you perhaps know why I am getting this error? /usr/local/share/stlink/chips: No such file or directory 2024-01-12T18:30:05 WARN common.c: unknown chip id! 0x413 Failed to connect to target Failed to parse flash type or unrecognized flash type I have tried different methods but it also seems to want something from /usr/local/share/stlink/chips and that path does not exist on my station. Do you know what could be wrong? Thanks
@e.m.451
@e.m.451 9 ай бұрын
Try set CPUTAPID 0 in your .cfg
@farukhalilagic2070
@farukhalilagic2070 3 жыл бұрын
I guess you do this for your living. Do you use cube mx in your professional projects ?
3 жыл бұрын
I also use Cube for work. Other companies have their versions like Cypress Psoc creator so it's common to use such tools. If nothing more you save time for initialization and also removes possibility for such bugs.
@RisteOstojic
@RisteOstojic Жыл бұрын
Pozdrav Mateja. Mozes li mi odma odgovoriti na nekoliko pitanja hitno je?
Жыл бұрын
Moze. A raje po anglesko da je za sve.
@RisteOstojic
@RisteOstojic Жыл бұрын
@ Hvala Matej ali problem je rijesen.Veliko hvala da ste pokazali spremnost da pomognete.
@bozidarnemec7578
@bozidarnemec7578 Жыл бұрын
Hello Matej. Great tutorial. Can you please help me. I am programm the STM32G030 with st-flash (release 1.7.0) on raspberry pi4 and tool st-link-v2 (orginal ST or clone). Usaly it is not working, programm process interrupts because the tool find wrong processor id, or the programming result is OK "jolly good", but insite the processor is nothing written. what can be wrong? how i can "stable" programm the STM32 with raspberry pi 4 and st-link-v2? please help me thank you.
Жыл бұрын
I cannot find a problem just by your description. Your mcu should have id of 0x466 and is supposed to be supported on stlink. Can you try st-probe to get some info? Also, do you have all the libraries? Did the build succeed with no major warnings or errors? Have you installed all the correct libraries? Also, do you have the correct image for your mcu? Did it build correctly? There is a possibility that either the mcu is dead or the programmer is not working 100%. I have one dead f4 discovery board. I tried using stlink (original), then the open source tool, I also tried reflashing the debugging with jlink and using external debugger to confirm that none of them worked. If you have that option, you can try (using windows) to convert a debugger to jlink and try with that as well. Also you can try using stlink (open source) to erase the whole memory and try flashing again - create new dummy project that you know should work for this mcu.
@tauraimirimi2844
@tauraimirimi2844 3 жыл бұрын
great video. am trying to fiddle with stm32s after pics and avrs. also looking for diy flasher coz i hve battery bms from 48v telecom bat boards.
@stuff2learn07
@stuff2learn07 3 жыл бұрын
can we upload firmware through spi ? If yes, how?
3 жыл бұрын
I'm not sure, but you can check built in dfu bootloader specification datasheet and find your mcu family. It will have at least uart but some also have usb and i2c, maybe spi as well.
@tanvirmahmud1048
@tanvirmahmud1048 3 жыл бұрын
Hey I have a Pre compiled .bin file. Now I want to upload that file in STM32. How i can do
3 жыл бұрын
You can do it as shown in the video for the stlink/jlink that you have, or uart. Just insert the path to the binary file into your download command.
@shahzaibshamim6524
@shahzaibshamim6524 3 жыл бұрын
Can you share that .bin file?
3 жыл бұрын
You can run make or build with ide.
@hsenaed6894
@hsenaed6894 3 жыл бұрын
Please.Can you help me explain how to activate a xor mode
@pabloolguin818
@pabloolguin818 2 жыл бұрын
Hi, Thank you for you channel. I really helpfull to me. I would like to know how I configure VSCode terminal with this colors and git location. If you can to tell me how to configure it I'm will be greatful. Greetings from Chile!!
2 жыл бұрын
Thank you for kind words. I'm glad you find my videos useful. I'm using zsh with starship on my system. This is what gives me a two line prompr with current directory, git info and more. Vscode uses your default shell, so when I launch a terminal in vscode, it runs zsh, which is configured with starship and other addons. Search on internet for starship.rs . It also works with bash and fish and is easy to configure. Cheers!
2 жыл бұрын
Oh, you can also find my starship and zsh config (the colors and git info) im my github repository github.com/prtzl/fedora-config inside dotfiles directory (starship.toml and zsh.rc)
@pabloolguin818
@pabloolguin818 2 жыл бұрын
@ Thank you! I will try to configure it. Also, I would like to work with FFT. Do you know how can I use CMSIS library to calculate FFT with DSP of STM32F446ze?. Thank you very much again!
@alexchabanenko6347
@alexchabanenko6347 11 ай бұрын
спасибо
@wegi9621
@wegi9621 10 ай бұрын
Really I don't understand where is the sense replace ST-LINK firmware to J-LINK. Bcos I understand the big heart of J-LINK factory with releasse firmware for STM32 was a step, when STM added to their own products like NUCLEO, Discovery and so on integrated ST-LINK with very huge builded firmware as MSC, VCP and ST-LINK. So J-LINK releassed their firmware when J-LINK was a worthless option in comparision to ST-LINK. Also we need remember how expensive is this J-LINK shit. So we shouldn't bother J-LINK with this. It's a waste of the time.
@aleksey_vomarba
@aleksey_vomarba Жыл бұрын
Very useful video, thank you very much! It helped me very much!
Debugging STM32 in VSCODE with stlink and jlink | VIDEO 45
17:33
Matej Blagšič
Рет қаралды 46 М.
STM32 UART BootLoader HowTo
10:25
Web learning
Рет қаралды 68 М.
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 37 МЛН
小路飞和小丑也太帅了#家庭#搞笑 #funny #小丑 #cosplay
00:13
家庭搞笑日记
Рет қаралды 12 МЛН
I was just passing by
00:10
Artem Ivashin
Рет қаралды 18 МЛН
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 101 МЛН
STM32 Guide #2: Registers + HAL (Blink example)
30:02
Mitch Davis
Рет қаралды 211 М.
Supercharging Printf with RTT-Viewer:
24:52
PR TechTalk
Рет қаралды 2,6 М.
Extracting and Modifying Firmware with JTAG
21:03
Matt Brown
Рет қаралды 46 М.
STM32 Guide #1: Your first STM32 dev board
12:12
Mitch Davis
Рет қаралды 226 М.
Tag-Connect To ST-Link or J-Link Adapter PCB | Voltlog #460
8:09
The "Impossible Torpedo" was real
16:33
Steve Mould
Рет қаралды 818 М.
Creating an STM32 Project with J-Link RTT
19:43
STMicroelectronics
Рет қаралды 5 М.