STM32 (stm32f103c8) Serial wire debug -- STM32CubeIDE

Поделиться
HTML-код
  • Опубликовано: 22 окт 2024

Комментарии • 40

  • @phillipnewman9174
    @phillipnewman9174 7 дней назад

    Thank you so much for this video! It's such a great help for all my debugging. Thank you again!

  • @NKernytskyy
    @NKernytskyy 2 года назад +1

    Great detailed step-by-step explanation!

  • @victorhugovargaslopez9533
    @victorhugovargaslopez9533 2 года назад +1

    Thank you very much for your video...

  • @l3arfee
    @l3arfee Год назад

    Amazing, can you explain why we needed the 220 resistor?

    • @OussamaOusmoi
      @OussamaOusmoi  Год назад +1

      Thanks. I don't remember exactly but it should be for restricting the current.

    • @l3arfee
      @l3arfee Год назад +1

      @@OussamaOusmoi Thank you🙏

  • @bsbharat0705
    @bsbharat0705 4 года назад +2

    IT worked very well...Thank you sooo much :)

  • @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

  • @vanitashole
    @vanitashole 2 года назад

    I was looking for something like this thank you

  • @shrijithmjain2137
    @shrijithmjain2137 3 года назад

    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  3 года назад

      Yes you could use the big programmer as well, and it does support the SWD out of the box .

  • @msergejev
    @msergejev 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.

  • @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.

  • @andrewFJ
    @andrewFJ 5 месяцев назад

    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  5 месяцев назад

      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 5 месяцев назад

      @@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  5 месяцев назад

      @@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 5 месяцев назад

      @@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  5 месяцев назад

      @@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 .

  • @OndrejPopp
    @OndrejPopp Год назад

    Tx!

  • @yudhahamdiarzi5553
    @yudhahamdiarzi5553 3 года назад

    Thank you it works

  • @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.

  • @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.

  • @EmbeddedEnigma
    @EmbeddedEnigma 3 года назад

    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  3 года назад +1

      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 :)