Serial UART with STM32 Microcontroller-Transmit and Receive Data

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ม.ค. 2025

ความคิดเห็น • 81

  • @Engineercorleone
    @Engineercorleone ปีที่แล้ว +4

    Would be great if you may also explain handling of UART with LL drivers. What flag and functions need to be set/called for data transmission?

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +3

      Hi Engineercorleone, once I complete STM32 HAL tutorial series. I'll start making bare-metal microcontroller programming to show LL driver development for STM32 MCU. Thanks for the suggestions. Best wishes!

  • @wolfteam_deliKurt
    @wolfteam_deliKurt ปีที่แล้ว +2

    really good presentation, thanks for that.

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +1

      Hi Burak,
      Glad you enjoyed it!
      I'll be making more videos on STM32 Microcontroller programming in a days to come. Thanks and have a good day.
      Best wishes!

  • @JimBob-w4m
    @JimBob-w4m 5 หลายเดือนก่อน

    Very clear thanks man couldn't figure out receives

  • @SANTOSHSHARMA-m8s
    @SANTOSHSHARMA-m8s ปีที่แล้ว +1

    Good explained

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว

      Thank you so much! I'm happy you find this STM32 UART video useful. Good luck and best wishes!

  • @dennisbaldwin
    @dennisbaldwin ปีที่แล้ว

    Great video. Thank you for sharing.

    • @BINARYUPDATES
      @BINARYUPDATES  11 หลายเดือนก่อน +1

      Hi Dennis, thanks you so much. Best wishes!

  • @waseemafzal7297
    @waseemafzal7297 5 หลายเดือนก่อน +1

    if you are unable to write on terminal (teraterm) just enable US0ART global interrupt 3:04

  • @aperture.soccer
    @aperture.soccer 10 หลายเดือนก่อน +2

    Very good 🌍 bem bacana

  • @demographicreplacement539
    @demographicreplacement539 ปีที่แล้ว +1

    I am interested in the huart being assigned to instance and the index loop. Did you not want to explain that because its not relevant basically? Please explain?

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว

      Hi, huart is UART handle which is a part of HAL API from STMicroelectronics. Since, i used STM32 HAL approach instead of bare-metal, for this UART lesson. I decided to show use of UART over explaining built in API and its parameters. But I'll surely consider making videos on this topics in future. Otherwise, this lesson will be very long just to show send and receive data. I hope you understand. Thanks!

  • @binishakk2812
    @binishakk2812 7 หลายเดือนก่อน +2

    Interrupt call back function should be small right ..

    • @BINARYUPDATES
      @BINARYUPDATES  4 หลายเดือนก่อน

      Hi Binishak, yes avoid writing long code in callback function

  • @ernozblr1318
    @ernozblr1318 ปีที่แล้ว +1

    Good Job thenks

  • @sudheerkumar5966
    @sudheerkumar5966 ปีที่แล้ว +1

    Very very good

  • @Ksr3740
    @Ksr3740 หลายเดือนก่อน

    hi i am actually facing a problem with receiving part, suppose i have given the data buffer which i send as 10 bytes and then i enter a string such as "hello" it wont send it unless i give "hello" again. essentially it wont send the buffer until the complete 10 bytes of the buffer is filled. Basically i have to send "hellohello" for it to transmit and the terminal displays "hellohello" rather than just "hello"

  • @rma1563
    @rma1563 2 หลายเดือนก่อน

    7:33 in my case STLink is detected under USB, not as a COM port. Any fix?

  • @p.kaikieu4796
    @p.kaikieu4796 9 หลายเดือนก่อน

    dear sir, can we use the way like 8:45 to display a value like "value of DHT11" on serial terminal use UART ? i am trying to do this but i not sure about the type of data

  • @LaboussoleNano
    @LaboussoleNano หลายเดือนก่อน

    Hello I've tried to do same thing as you, i got no error but no data is transmitted to putty, what can be the problem?
    Thanks

  • @kailimedia
    @kailimedia ปีที่แล้ว +1

    I got 2 square with question mark in front of the tx buffer printout in the console. what is the problem?

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว

      Please check if your uart Baud Rate Setting is correct in PuTTY Serial terminal software. Usually, this caused by baud rate mismatched between microcontroller program and serial terminal software. I hope this may help you. Good luck and best wishes!

  • @mohameddawoodbinadammv9839
    @mohameddawoodbinadammv9839 ปีที่แล้ว

    Well explained

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว

      Thank you Mohamed, I hope you enjoyed UART with STM32 Microcontroller. Good luck and best wishes!

  • @MrDp9000
    @MrDp9000 ปีที่แล้ว +1

    Nice video...
    But why did you define your message string as uint_8 instead of char? And why it still worked?

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +2

      Thank you Mr. DP! Good question. The point is uint8_t is an 8-bit integer and char is also of size 1 byte, since1 byte is 8-bit in size. And STM32Cube HAL API handle 8-bit integer pretty neatly so I used integer instead char type. But, I'll be making videos in future to show exact correlation of sending char and string using Serial UART. Thank you for your input and video idea. Have a beautiful day, Best wishes!

  • @codewarrior7072
    @codewarrior7072 ปีที่แล้ว +1

    Thanks for the video! Could you update the video description with the code or a link to github?

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +1

      Hi Codewarrior, I'll soon add links to the code once iI complete this STM32 Microcontroller Programming series. Due to lack of time I couldn't manage right now. I hope you understand. Thanking you!

  • @NitishKumar-mt6tf
    @NitishKumar-mt6tf 6 หลายเดือนก่อน

    from where u added LED ON in function in Rx cplt call back code on main program sir

  • @bhupendersingh2604
    @bhupendersingh2604 ปีที่แล้ว +1

    I have one doubt here
    Use are using int data type to store string

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +1

      Hi Bhupender, In this example I've covered to sending string over UART. And used integer variable. You can also consider using char for storing characters. As in the end, string is made up of characters. The code makes easy with int as it shown. its all depends on use case. Wish you good time!

  • @damienndzanga2406
    @damienndzanga2406 17 วันที่ผ่านมา

    My STM32 IDE doesn't generate code, what should I do, do I need a physical board before it can generate c++ code or can I do everything virtual even if I don't have a physical board.

    • @blazerstorm3192
      @blazerstorm3192 13 วันที่ผ่านมา

      Login your st account into the ide, then in the build settings tick generate intel hex file, you can then use proteus for simulating stm32 with that hex file

  • @destroyerex
    @destroyerex 6 หลายเดือนก่อน

    helpful video, tysm

  • @nagahemachandchinta5498
    @nagahemachandchinta5498 5 หลายเดือนก่อน +1

    Would this work for USART? I couldn't find anything on coming on Putty whilr transmit

    • @BINARYUPDATES
      @BINARYUPDATES  4 หลายเดือนก่อน

      Yes, just make sure when you configure the UART peripheral in IOC file you keep synchronous instead of asynchronous communication. Also to use HAL USART API to access USART peripheral of STM32 Microcontroller. I hope this may help. Best wishes!

  • @faisal32ful
    @faisal32ful ปีที่แล้ว

    very helpful. Thank you.

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +1

      Hey Faisal, thank you for your words. I'm glad to know you found this Serial UART communication with STM32 Microcontroller lesson useful. I wish you good luck and best wishes!

    • @faisal32ful
      @faisal32ful ปีที่แล้ว

      Thank you@@BINARYUPDATES

  • @davinlim5326
    @davinlim5326 ปีที่แล้ว +1

    My STlink does not has COM. how could I fix that.

    • @macitizm
      @macitizm ปีที่แล้ว

      i have same problem. if you solve that please commend me

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +1

      Please make sure ST-Link drivers are installed properly while installing STM32Cube IDE. Otherwise you can manually install or upgrade drivers from IDE. Just go to Help in top menu bar and then select "STLink Upgrade". And then select right version and upgrade. I hope this may resolve issue.Otherwise just reinstall IDE. Good luck and best wishes!

  • @sagarraj-p5b
    @sagarraj-p5b 9 หลายเดือนก่อน +3

    why i cant type anything in puTTy or RealTerm .....I am using stm32f0discovery board and TTL .can anyone help me?

    • @pranjal7582
      @pranjal7582 5 หลายเดือนก่อน

      I have the same problem

    • @pranjal7582
      @pranjal7582 5 หลายเดือนก่อน

      Dude, my code worked.You should definitely see your code.

  • @abiaselira2807
    @abiaselira2807 10 หลายเดือนก่อน

    This video was really helpful to help me with this homework but I am stuck. Would you be able to help me with the homework problem? The data will consist of ASCII characters (the contents of text files). The IOT board will convert each
    character received into its two-character hex-ASCII value, and echo those back to the PC. Both Rx and Tx data on the IOT board are to be buffered with ring buffers in order to maximize
    throughput, and XON/XOFF flow control signals to the PC will be used by the IOT board to modulate
    the rate of received data.

  • @nikhilshejwal-ll8fw
    @nikhilshejwal-ll8fw ปีที่แล้ว +1

    Hello, I just started STM32 Development and am getting the error, Target not responding while uploading the code. Could you please help me with a possible solution?

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว

      HI Nikhil, to resolve this error. You must upgrade the firmware running on your STM32 microcontroller. To do this, open STM32Cube IDE --> go to Help on too menu bar --> Select ST-Link Upgrade --> Select your STM32 Nucleo board and then --> Click on Upgrade button. And you're done! This is how you can upgrade firmware on STM32 Board. Good luck and best wishes!

  • @dienau6313
    @dienau6313 ปีที่แล้ว +1

    It helps me a lot, thank you, sir!
    And may I ask you some questions?
    1. Currently I am studying to program the STM32F405R6T6, so does it have the same code as stm32f446re?
    2. Beside the serial UART, I want to add 2 CAN protocols to the stm32, and I want to program to transmit the data from UART to stm32 to CAN1 to CAN2 and the opposite way, and I'm struggling for how to transmit the data from stm32 to CAN1, may you provide me some clues?
    Thank you!

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +1

      Hi Dienau, thank you! The program for STM32F405R6T6 will be same as STM32F446RE as its been covered in video. They both inherit the same family of STM32. I'll try to cover CAN Protocol video lesson as early as possible. As its been very busy because of my projects. I hope will find time. Good luck for your project and best wishes!

  • @RakeshWasnik-EmbeddedSystems
    @RakeshWasnik-EmbeddedSystems ปีที่แล้ว

    So at 14:40 are we supposed to press enter after typing a string? In my setup it sometimes shows and sometimes it doesn't, then again stops responding even after pressing RESET button on the board. And how do I add

    when I am using a variable like rx_data instead of a plain string?

    • @RakeshWasnik-EmbeddedSystems
      @RakeshWasnik-EmbeddedSystems ปีที่แล้ว +1

      I noticed that in my PuTTY (I am using Windows and Nucleo F767ZI) When I am sending data from the Board to the Laptop using infinite loop, its properly working, but when I type in PuTTY, I am not sure when is it receives and when it transmits back the same data (rx_data) but I have to press > button (right arrow key). Then the data appears on the PuTTY terminal.
      I don't know what's wrong, maybe I should try using some other serial terminal.

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +2

      Hi Rakesh, as likely you've pointed out. Its an issue caused by Serial Terminal Software. Especially when you write from microcontroller to your laptop over UART communication. If you want to know more then check the configuration of putty. I mean once you open PuTTY on left pane find TERMINAL > KEYBOARD check parameters and play with them. I suggest use other Serial terminal program like Tera Term or something similar. Please note its not an issue with your STM32 Microcontroller program. I hope you enjoyed this video lesson. I'll be adding more lesson along with advance STM32 projects in future. Have a good day. Best wishes!

  • @rajamukherjee4667
    @rajamukherjee4667 7 หลายเดือนก่อน

    Which type of USB cable is required to connect STM 32 F446RE with my laptop??

    • @BINARYUPDATES
      @BINARYUPDATES  6 หลายเดือนก่อน

      Mini USB cable will work STM32F446RE nucleo board

  • @classonbread5757
    @classonbread5757 ปีที่แล้ว

    9:58 is the transfer_cplt variable ever used in this video?

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +1

      Hi, this variable "transfer_cplt" is used at line number 233 and under void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart). It's flag that keep track of serial data transfer over UART when STM32 send data to computer using serial UART. I hope this may help you. Thanks and best wishes!

  • @RushikeshKumavat-h2y
    @RushikeshKumavat-h2y ปีที่แล้ว

    The second and third part of your code is not working in my pc. what is the solution ?

  • @gersonsoares6628
    @gersonsoares6628 8 หลายเดือนก่อน

    Bom video amigo: onde esta no codigo (linha) o led-off ?

  • @21ece028mariyappan.r
    @21ece028mariyappan.r 5 หลายเดือนก่อน

    How To use the web cam in laptop to uart with stm32 nucleo h563zi for the predicted class by garbage segregation in trained model
    I have the trained model in .tflite,how to implement?

  • @karthikrr1545
    @karthikrr1545 ปีที่แล้ว

    How to set baud rate for Rx function

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว

      Hi Karthik, I suggest setting up the baud rate while configuring UART peripheral in STM32CubeIDE. This can be a process while creating new STM32 project. And also when we configure peripherals. The baud rate for transmission and receiving would be same. I hope this may be useful. Good luck and best wishes!

  • @sudhansumtripathy
    @sudhansumtripathy ปีที่แล้ว

    what is a weak function , do to teach how to write the code from scratch without autogeneration

  • @SaiKumar-hv3qd
    @SaiKumar-hv3qd ปีที่แล้ว +1

    where to download the driver
    please give me the source to download it. In the ST website i didn't find the driver 😐😐

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว

      Hi SaiKumar, you should update ST Link drivers right from STM32CubeIDE Software. I suggest you to find tab HELP and then choose ST-LINK Upgrade. This opens up dialog box there it automatically select latest drivers and just hit UPGRADE button. And you're done. I hope this will find useful to upgrade firmware for STM32 Microcontroller board. Good luck and best wishes!

  • @NitishKumar-mt6tf
    @NitishKumar-mt6tf 6 หลายเดือนก่อน

    LED ON OFF through UART I have same type copy in our code but not working LED ON but extra character comes and when type LED OFF and then enter not off pls help me

  • @Radplus
    @Radplus 5 หลายเดือนก่อน

    Hi
    Why uart sends data reversed
    For example
    If I want to send
    1139(ascii) = 0473(hex)
    When uart sends data i have
    7304(hex) in my computer
    How I can prevent this

    • @BINARYUPDATES
      @BINARYUPDATES  4 หลายเดือนก่อน

      Hi ltlt, The example project demonstrate transmit and receive data over serial uart peripheral that's why you get echo back your character sent through serial terminal. you may need to modify code to just send means transmit data as shown in first part of the video lesson. I hope this may help. Best wishes!

    • @Radplus
      @Radplus 4 หลายเดือนก่อน

      @@BINARYUPDATES thanks👍

  • @ramaramkrishnan9818
    @ramaramkrishnan9818 4 หลายเดือนก่อน

    Nice bro, one small help LCD 16*2 interface explain bro

  • @naingaunglwin833
    @naingaunglwin833 ปีที่แล้ว

    if(rx_data[0] !=13)
    {
    rx_buffer[rx_indx++]=rx_data[0];
    }
    what is the meaning of 13 use in if statement ? for detect "Enter"

    • @mfgkwmfgkw
      @mfgkwmfgkw หลายเดือนก่อน

      In ASCII the char 13 is "carriage return", written as
      in C.
      (But I find this not really good here. On Windows a line is usually finished with a character pair CR (carriage return,
      , ASCII 13) and LF (line feed,
      , ASCII 10).But other systems like Linux use only LF resp.
      for line ending. Then the code above will not work, because there is never a 13 and you wait forever. So waiting for 10 instead of 13 or any of them would be more robust.)

  • @kevinkibbe2146
    @kevinkibbe2146 3 หลายเดือนก่อน

    The code here has an obvious issue. The LED turns on after you type LED ON and as soon as you hit enter the led turns on, so far so good. But the problem is as soon as you type any character the led turns off.

  • @labegm3639
    @labegm3639 ปีที่แล้ว

    well explained!
    I have a question, where Can I found this informations ? (like book or some documentation)

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว +2

      Hi Labegm, Thank you and happy to know you found this Serial UART tutorial useful. Usually, I refer STM32 HAL Documentation while writing code for STM32F4 Microcontroller. If I remember correctly, the user manual is UM1725 - Rev 8. Just search online and you'll find it. Good luck and best wishes!

  • @logeshwersp5420
    @logeshwersp5420 ปีที่แล้ว

    I am unable to see any messaged in putty

    • @BINARYUPDATES
      @BINARYUPDATES  ปีที่แล้ว

      Hi, please check your PuTTY configuration especially Baud Rate settings. Wish you good luck and best wishes!

    • @shahafyehuda472
      @shahafyehuda472 ปีที่แล้ว

      me neither, did you figure this out?

  • @ChestertonAdair-y2s
    @ChestertonAdair-y2s 3 หลายเดือนก่อน

    Williams Kevin Jones Kevin Johnson Sandra