STM32 (stm32f103c8) Serial wire debug -- STM32CubeIDE

  Рет қаралды 24,879

Oussama Ousmoi

Oussama Ousmoi

4 жыл бұрын

In this video I'm showing how to setup the STM32 serial wire debug and to use it as a serial monitor for displaying data from the microelectronic on the debugging console in the STM32CubeIDE
Project code : github.com/foxmjay/stm32_swd

Пікірлер: 39
@NKernytskyy
@NKernytskyy 2 жыл бұрын
Great detailed step-by-step explanation!
@vanitashole
@vanitashole Жыл бұрын
I was looking for something like this thank you
@victorhugovargaslopez9533
@victorhugovargaslopez9533 2 жыл бұрын
Thank you very much for your video...
@bsbharat0705
@bsbharat0705 3 жыл бұрын
IT worked very well...Thank you sooo much :)
@OussamaOusmoi
@OussamaOusmoi 3 жыл бұрын
I'm glad it helped :) .
@yudhahamdiarzi5553
@yudhahamdiarzi5553 3 жыл бұрын
Thank you it works
@OussamaOusmoi
@OussamaOusmoi 3 жыл бұрын
You're welcome!
@amirpasagic162
@amirpasagic162 3 жыл бұрын
Is it possible to capture this data with some external app. For example if I wish to visualize my data via python script, and I still wish to avoid using the USB2Serial dongle, could I somehow capture the data sent to this port via python script?
@OussamaOusmoi
@OussamaOusmoi 3 жыл бұрын
It's probably possible using openocd and pyocd , but i wouldn't recommend going that path, as the SWD is only intended for debugging purposes, not for communication . I would suggest looking at virtual serial implementation on STM32 microcontrollers using something called CDC. check out a youtube channel called Controllers Tech, he has a good video on that . once you have implemented that, you can then easily use pyserial to communicate with the device . Good luck.
@bennguyen1313
@bennguyen1313 Жыл бұрын
How are printfs via ITM different than printfs over SWV? I thought both use SWD+SWO, yet ITM_SendChar() doesn't work for me, despite have an SWD+SWO compatible chip and debugger! Does GDB / OpenOCD support this?
@OussamaOusmoi
@OussamaOusmoi Жыл бұрын
Sincerely i never heard of ITM till now :), it looks very similar to the method i used in my video though . I still didn't have the chance to try OpenOCD as well. Sorry i can't help you much on this. if you got any results it would be great if you share it with us :). Good lucj
@OndrejPopp
@OndrejPopp Жыл бұрын
Tx!
@klaus9503
@klaus9503 3 жыл бұрын
Can I somehow route the output to a file instead to the console?
@OussamaOusmoi
@OussamaOusmoi 3 жыл бұрын
mmm, I'm not sure about that, as this meant to be for debugging purpose mostly. You probably need to use a serial to usb in this case, and dump the serial data to a file.
@alirezanajafi128
@alirezanajafi128 2 жыл бұрын
Hi! thanks a lot for the detailed walk-through. I'm working with stm32f4 discovery board with 168 MHz core clock. I did whatever you mentioned in the video and still I get nothing in my SWV console and timline graph. Can anyone give me any idea why this thing is not working?
@OussamaOusmoi
@OussamaOusmoi 2 жыл бұрын
Hi, is the st-link programmer integrated with the board ?
@OussamaOusmoi
@OussamaOusmoi 2 жыл бұрын
I just googled the board, and it looks like it has an integrated st-link, i wonder if the swdo pin not used, you can try using an external st link if you have, check out this link electronics.stackexchange.com/questions/230036/problems-connecting-st-link-v2-and-stm32f4-discovery-board
@alirezanajafi128
@alirezanajafi128 2 жыл бұрын
Hi, thanks for the reply. The st-link is indeed provided with the board. It is also detected via the debugger (The scan option). However, my "printf"s dont appear in the SWV console and my global variable "counter" does not appear on the SWV timelime graph s.th. I can however see it changing in the live expression section, top right of the CubeIDE.
@shrijithmjain2137
@shrijithmjain2137 2 жыл бұрын
Hi, amazing it worked, and could we use St link/V2/01-0 i.e the big programmer to program the same in Blue pill?
@OussamaOusmoi
@OussamaOusmoi 2 жыл бұрын
Yes you could use the big programmer as well, and it does support the SWD out of the box .
@l3arfee
@l3arfee Жыл бұрын
Amazing, can you explain why we needed the 220 resistor?
@OussamaOusmoi
@OussamaOusmoi Жыл бұрын
Thanks. I don't remember exactly but it should be for restricting the current.
@l3arfee
@l3arfee Жыл бұрын
@@OussamaOusmoi Thank you🙏
@EmbeddedEnigma
@EmbeddedEnigma 2 жыл бұрын
while soldering the wire to pin on stlink I fucked it up badly, my hands were shaking so much that all the pins on stlink got attached together due to solder and now my stlink is not working XD. I have order 2 other stlinks V2 to test on them but can u give me anytips how to solder wire on IC pin so I don't fuck it up again ?
@OussamaOusmoi
@OussamaOusmoi 2 жыл бұрын
Oh no dude , sorry to hear that... :) . but yeah the IC has a bit small footprint . I usually use more flux, and I put very little solder at the tip of the wire, and tack it down to the pin . Maybe try practice first on some scrap pcb if you have Good luck :)
@andrewFJ
@andrewFJ 2 ай бұрын
Now why can't you do that with a simple Serial Wire method? It really drives me nuts that I have to include so much unreadable garbage code to my main program in order to trace some variables. I want to be able to use is in a compact and neat way that doesn't mess up readability of my program.
@OussamaOusmoi
@OussamaOusmoi 2 ай бұрын
Maybe you can write the extra code in a separate header, and include it in your main program, that way you will only call the print function in your main program.
@andrewFJ
@andrewFJ 2 ай бұрын
@@OussamaOusmoi then why doesn't everyone else do It? I'm an electronic engineer and every time dealing with code I just wonder what a weird mindset programmers have, they seem to never strive for compact, neat and readable coding method.
@OussamaOusmoi
@OussamaOusmoi 2 ай бұрын
@@andrewFJ I agree with you, but for tutorials we tend to put all in one file as a simplification for the videos. You are free to structure your code as you like though :)
@andrewFJ
@andrewFJ 2 ай бұрын
@@OussamaOusmoi Anyways thanks for your video, at least it explains something. Just one more question, perhaps if I debug my MCU via USB can I get messaged back or the "trace asynchronous SW" is the only way?
@OussamaOusmoi
@OussamaOusmoi 2 ай бұрын
@@andrewFJ Via USB it will act as COM port, and you could use it as a serial dongle, however it needs extra setup for the project, you may search for serial communication for stm32 microcontrollers . Good luck .
@wangere7697
@wangere7697 2 жыл бұрын
I did everything as instructed but now I get this error: "Error in final launch sequence: Failed to start GDB server Failed to start GDB server Error in initializing ST-LINK device. Reason: (18) Could not verify ST device! Abort connection" Is there something I'm missing?
@OussamaOusmoi
@OussamaOusmoi 2 жыл бұрын
In what step do you get this error exactly ?. are you able to program the STM32 normally ?.
@wangere7697
@wangere7697 2 жыл бұрын
@@OussamaOusmoi I am able to flash code to the STM 32 normally. But when I try to run debug I get this error. I wanted to debug with printf.
@OussamaOusmoi
@OussamaOusmoi 2 жыл бұрын
@@wangere7697 Checkout this link community.st.com/s/question/0D50X0000BUjpxvSQB/error-in-initializing-stlink-device-reason-18-could-not-verify-st-device-abort-connection It seems like other people getting similar error and it looks like it's probably due to a counterfeit board . do you have other board to try with ?
@wangere7697
@wangere7697 2 жыл бұрын
@@OussamaOusmoi Thank you. I am expecting some few boards this week.
@wangere7697
@wangere7697 2 жыл бұрын
@@OussamaOusmoi Thank you. I am expecting some few boards this week.
Custom USB HID Interface using STM32 (stm32f103c8)
32:35
Oussama Ousmoi
Рет қаралды 14 М.
НРАВИТСЯ ЭТОТ ФОРМАТ??
00:37
МЯТНАЯ ФАНТА
Рет қаралды 1,1 МЛН
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 59 МЛН
Cat Corn?! 🙀 #cat #cute #catlover
00:54
Stocat
Рет қаралды 16 МЛН
БОЛЬШОЙ ПЕТУШОК #shorts
00:21
Паша Осадчий
Рет қаралды 11 МЛН
Hacker's Guide to UART Root Shells
17:40
Flashback Team
Рет қаралды 469 М.
STM32 Guide #4: Generated Code, HAL, and Bare Metal
26:20
Mitch Davis
Рет қаралды 78 М.
printf() over the UART using STM32
12:55
Vidura Embedded
Рет қаралды 30 М.
Tutorial on STM32 External Interrupts and callback funktions
24:31
SWD Debug Issues check list
11:12
Web learning
Рет қаралды 12 М.
Scientific Concepts You're Taught in School Which are Actually Wrong
14:36
iPhone, Galaxy или Pixel? 😎
0:16
serg1us
Рет қаралды 825 М.
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 6 МЛН
Это - iPhone 16 и вот что надо знать...
17:20
Overtake lab
Рет қаралды 104 М.
Что не так с раскладушками? #samsung #fold
0:42
Не шарю!
Рет қаралды 213 М.