Z-The-Programmer
Z-The-Programmer
  • 8
  • 83 756
Redirect Printf To UART And Send Serial Data Via On-Board USB Port (STM32, STM32CubeIDE)
In this tutorial I will show you how to redirect the printf function to UART to enable the printf to be utilised with STM32 microcontrollers for things like debugging and other purposes. I then show how to set printf buffer size enable printing of floats (disabled by default) to allow transmission of floating point values over the UART. Finally, I demonstrate how to choose the correct UART peripheral on the microcontroller to allow the UART data to be sent to the ST-LINK so that it can be transmitted over the on-board USB port so that a TTL to USB converter doesn't have to be used. The STM32CubeIDE is used for the demonstration.
Timestamps:
00:00 - Redirect Printf To UART
02:10 - Demonstration Of Printf With UART
02:46 - Setting Printf Buffer Size
03:14 - Printing Floating Point Values
04:03 - Printing Via Virtual COM Port (USB)
Переглядів: 6 343

Відео

STM32 UART: Register Configuration, Transmission and Reception
Переглядів 6 тис.2 роки тому
This tutorial will teach you have to configure UART (USART) registers of an STM32 microcontroller to get the UART peripheral up and running. The tutorial will then show how to write transmission and reception functions for the UART peripheral to enable communication between the microcontroller and other devices using this serial protocol. Finally, the tutorial will demonstrate how the microcont...
STM32 SPI Interrupt Tutorial: Setup And Usage With Registers
Переглядів 8 тис.2 роки тому
In this tutorial I demonstrate how to set up and use STM32 SPI interrupts only using registers (no hardware abstraction layers, HAL) to communicate over the SPI. There are three types of interrupts for SPI: - Receive buffer not empty interrupt - Transmit buffer empty interrupt - Error Interrupt I cover the registers required to set up each interrupt along with code demonstrations showing how to...
How To Write An STM32 SPI Driver (Full-Duplex Master Mode)
Переглядів 39 тис.2 роки тому
This tutorial demonstrates how to write a full-duplex SPI driver for an STM32 microcontroller without any hardware abstraction layers (bare metal) to communicate over the Serial Peripheral Interface (SPI) with other SPI devices with the microcontroller being the master on the bus. The tutorial covers the necessary SPI theory, STM32 SPI registers required and includes a coded example developed t...
STM32 GPIO Programming #2 - Alternate Function
Переглядів 4,7 тис.2 роки тому
A tutorial on how to configure pins of a STM32 microcontroller to alternate function mode. The tutorial covers the registers that are used for programming the pins and includes a code example of programming the pins of a stm32l432kc microcontroller without any hardware abstraction layers (bare metal). Source code for this tutorial is available at: github.com/Z-The-Programmer/STM32-Code/tree/mai...
How To Program A STM32 Timer Using Registers
Переглядів 5 тис.3 роки тому
A tutorial on how to program a timer of a STM32 microcontroller. The tutorial covers the registers required to set up the timer, the necessary theory and includes a code example of programming the timer using the stm32l432kc microcontroller without any hardware abstraction layers (bare metal). Source code for this tutorial is available at: github.com/Z-The-Programmer/STM32-Code/tree/main/How To...
STM32 GPIO Programming #1 - Input/Output
Переглядів 9 тис.3 роки тому
A tutorial on how to configure pins of a STM32 microcontroller to input or output mode. The tutorial covers the registers that are used for programming the pins and includes a code example of programming the pins of a stm32l432kc microcontroller without any hardware abstraction layers (bare metal). Source code for this tutorial is available at: github.com/Z-The-Programmer/STM32-Code/tree/main/G...
Keil uVision setup for STM32 (Step By Step)
Переглядів 6 тис.3 роки тому
A tutorial on how to set up a Keil uVision project for programming a STM32 microcontroller. It covers all necessary steps which include: - Installing required packs from the pack installer - Creating the project - Configuring flash tools to allow the program to be downloaded onto the microcontroller Timestamps: 0:00 - Introduction 00:15 - Pack installation 01:10 - Creating a project 02:21 - Con...

КОМЕНТАРІ

  • @mohsenkarimi404
    @mohsenkarimi404 Місяць тому

    good tutorial thanks a lot keep it up

  • @soundforce_nicolas
    @soundforce_nicolas Місяць тому

    Another super usefull video! Little addition, I had to set the output speed to very high for a 50mhz clock. See OSPEEDR register.

  • @soundforce_nicolas
    @soundforce_nicolas Місяць тому

    Thanks a lot this is great stuff! I was using SPI DMA transfer with HAL to send data to a DAC, but realized it took 1.5us for the transfers to start, limiting a lot the maximum update frequency of the system, considering sending 16bits at 50mhz only takes about 500ns. So using simply the DR register together with your interrupt explanation (to send the 2nd channel data after the first one is done) is a much better solution.

  • @thaidao1945
    @thaidao1945 2 місяці тому

    Thanks. It worked for me. For anyone playing with a development board NUCLEO-H745ZI-Q ( MCU : STM32H745ZIT6), replace USART_ISR_TXE by USART_ISR_TXE_TXFNF. It will work well.

  • @gepeto152
    @gepeto152 5 місяців тому

    For calculating the baud rate... why the input frequency is 4MHz when USART1 is connected to ABP2 which frequency is 80MHz?

  • @sumedhburbure4173
    @sumedhburbure4173 5 місяців тому

    Great video! Very informative! Looking forward to more register level programming tutorials!

  • @ECEAaronXavierLobo
    @ECEAaronXavierLobo 5 місяців тому

    Is this what is meant by bare-metal programming of GPIO?

  • @quangdat2523
    @quangdat2523 6 місяців тому

    please take more video about STM32 Bare metal

  • @NuWhite
    @NuWhite 7 місяців тому

    it works! thanks

  • @ketankukde1248
    @ketankukde1248 7 місяців тому

    I don't have the pack installer enabled for my keil uvision (non commercial) what should I do ?

  • @lohikarhu734
    @lohikarhu734 8 місяців тому

    Your typing is a bit too fast for me to follow, but, that's why they pay you the big bucks. It's a good thing that this controller is not too complex! Actually, it's a good example of the "double-edged sword" oh having incredible flexibility in a small device, but requiring quite a bit of internal configuration to get through the flexible pathways... I started with XC6801, 1978, which was a kind of beginning of the trend, with 2 or 3 functions on port pins, and a few registers to get the desired results.

  • @lohikarhu734
    @lohikarhu734 8 місяців тому

    Thanks for showing monitor screen big enough to see on my tablet, since I'm stuck in a hospital bed...

  • @chadzulu4328
    @chadzulu4328 8 місяців тому

    Your videos on this subject are absolute GOLD, thanks so much!

  • @arunraj4608
    @arunraj4608 9 місяців тому

    Such a useful video and such a nice presentation!! Thankyou so much... hats off to the efforts taken for making this video

  • @akhilshariff3831
    @akhilshariff3831 10 місяців тому

    make more videos

  • @MoleRat94
    @MoleRat94 Рік тому

    The Mic quality though! ASMring into my ear

  • @johnfrancis923
    @johnfrancis923 Рік тому

    Absolutely fantastic! I've scoured countless resources in search of a comprehensive guide on configuring and initializing hardware from scratch, steering clear of manufacturer libraries. Your content is a gem-thank you for simplifying what seemed like a daunting task!

  • @salmanshuaib2244
    @salmanshuaib2244 Рік тому

    Curious, when you start a project. Do you install any of the GPIO packs or do you only install the Device startup and CMSIS core packs?

  • @sudharanilashkare2361
    @sudharanilashkare2361 Рік тому

    My spi driver search is finally successfull now, Thankyou so much Z- The-Programmer

  • @lonny_breaux
    @lonny_breaux Рік тому

    hello so, where i can get myUART.h file?)))

    • @KI-tm8jg
      @KI-tm8jg 7 місяців тому

      Write it yourself or just use any other UART library

    • @bogdanmariusz6384
      @bogdanmariusz6384 5 місяців тому

      You can use HAL UART from the ST Micro Framework. You can use also CubeMX to configure HMI (Human Machine Interface) but then you will loose control over buffering etc. and although I did not try hard getting input does not seem obvious. If what you need is a "quick-n-dirty" printf then the ready-made solutions from SDKs are good enough, but for the "real" stuff I almost always end up writing a custom driver, specially if I need DMA, hardware FIFO and running under RTOS ...

  • @adammontgomery7980
    @adammontgomery7980 Рік тому

    This is excellent! Most others are using cubeide which is fine but more stuff to learn. I like to just look at the datasheets although these are a bit gnarly.

  • @MohamedAli-ih3kx
    @MohamedAli-ih3kx Рік тому

    Such an insightful video, i hope u keep making more videos about writing device drivers for Microcontrollers like STM32 for different peripherals such as UART DMA I2C I2S ADC, i really hope that man, keep up the good work 👌

  • @MohamedAli-ih3kx
    @MohamedAli-ih3kx Рік тому

    Such an insightful video, i hope u keep making more videos about writing device drivers for Microcontrollers like STM32 for different peripherals, i really hope that man, keep up the good work 👌

  • @dicktonyboy
    @dicktonyboy Рік тому

    Well done! All of this effort for a simple UART interface! Well achieved and thank you for your excellent presentation. (Love the graphics)

  • @benjamin-cf6ew
    @benjamin-cf6ew Рік тому

    very clear and straight to the point. Thank you!!

  • @dael1438
    @dael1438 Рік тому

    Thanks.

  • @jamesmasonic
    @jamesmasonic 2 роки тому

    At 3:08 you say you start enabling the timer by setting bit one of the clock enable register. (1u << 0) sets bit zero not bit one. Isnt it?

    • @z-the-programmer4584
      @z-the-programmer4584 2 роки тому

      Ah, yes I did make a mistake here. I meant to say bit 0. Well spotted, thank you!

    • @jamesmasonic
      @jamesmasonic 2 роки тому

      @@z-the-programmer4584 Wellcome. You have a great way of teaching neat with examples showing the code and the manual. It would be great you would make more videos covering more topics like interrupts UART DMA ect. I would pay for it if you had Udemy. Thanks!

  • @thomassmale8895
    @thomassmale8895 2 роки тому

    my guy you're a life saver xoxo <3

  • @h_silochi
    @h_silochi 2 роки тому

    hello, a very good job ,please continue making videos, do you have any community to join ?like discord or something

    • @z-the-programmer4584
      @z-the-programmer4584 2 роки тому

      Glad you're finding the videos helpful! And don't have anything like that at the moment but it's something to think about for the future.

  • @sudheerkumar5966
    @sudheerkumar5966 2 роки тому

    Very very good sir Plz make more videos ,on UART,SPI ,I2C, CANN ,EXTRA by St link, and stlink v2

  • @sudheerkumar5966
    @sudheerkumar5966 2 роки тому

    Very good sir

  • @rftech1608
    @rftech1608 2 роки тому

    This is great could you please make a video using interrupts for timer output compare and input compare?

  • @manojsuryawanshi1334
    @manojsuryawanshi1334 2 роки тому

    i am not able to read more than 256 bytes in externnal spi

  • @muhammadirvin
    @muhammadirvin 2 роки тому

    bro where you install that dark theme for keil

    • @z-the-programmer4584
      @z-the-programmer4584 2 роки тому

      In Google if you type "keil dark mode", a GitHub link should come up which has the files and instructions required. It has been added by AlirezaFatehi95.

  • @pedrovaaz7942
    @pedrovaaz7942 2 роки тому

    Hello, this is a great example. Can you please correct the github link. It shows 404 error.

  • @birb4095
    @birb4095 2 роки тому

    Noice

  • @MoleRat94
    @MoleRat94 2 роки тому

    great start

  • @MoleRat94
    @MoleRat94 2 роки тому

    Getting better

  • @MoleRat94
    @MoleRat94 2 роки тому

    Love your voice!

  • @MoleRat94
    @MoleRat94 2 роки тому

    Interesting!

  • @MoleRat94
    @MoleRat94 2 роки тому

    Very Informative!

  • @MoleRat94
    @MoleRat94 2 роки тому

    Great vid! Very Informative. Please more

  • @LeftoverRice99
    @LeftoverRice99 2 роки тому

    Good explanation! Thanks you

  • @jeremywolfe9378
    @jeremywolfe9378 2 роки тому

    Great video! One recommendation is that it is best practice to use the CMSIS library and all the defines that come with it. It is almost impossible for someone to tell what (0x1 << 1) means(unless you want to dig through the reference manual) when you could use RCC_AHB1ENR_GPIOBEN. This is still bare-metal programming and it greatly increases the readability of your code. Great work!

  • @EmbeddedEnigma
    @EmbeddedEnigma 2 роки тому

    Really nice video

  • @pointer-x
    @pointer-x 2 роки тому

    peripheral registers bit access: ua-cam.com/video/97tCW8JKxmc/v-deo.html

  • @wilgaced
    @wilgaced 2 роки тому

    Great, good work!

  • @magicmarker1369
    @magicmarker1369 2 роки тому

    Love the Tutorial man, very simple, clearly explained and easy to follow, I have a suggestion and a request. the suggestion being, you should include a link to the downloadable source code for whose who are following your tutorials at a pace, and secondly can you please do a video on STM32 serial communications?.....keep up the great videos.....

    • @z-the-programmer4584
      @z-the-programmer4584 2 роки тому

      Glad you like the tutorial! That's a very good idea actually, thanks for that I'll be looking into making the code available. I'm planning to do a tutorial on UART in the near future so it's coming.

  • @magicmarker1369
    @magicmarker1369 2 роки тому

    Love the Tutorial man, very simple, clearly explained and easy to follow, I have a suggestion and a request. the suggestion being, you should include a link to the downloadable source code for whose who are following your tutorials at a pace, and secondly can you please do a video on STM32 serial communications?.....keep up the great videos.....

    • @z-the-programmer4584
      @z-the-programmer4584 2 роки тому

      Glad you like the tutorial! That's a very good idea actually, thanks for that I'll be looking into making the code available. I'm planning to do a tutorial on UART in the near future so it's coming.

    • @ravishankar7972
      @ravishankar7972 2 роки тому

      @@z-the-programmer4584 When can we expect this? Love it so far ❤

    • @z-the-programmer4584
      @z-the-programmer4584 2 роки тому

      I am planning to tidy the code up and put it all up somewhere by the end of this month.

    • @ravishankar7972
      @ravishankar7972 2 роки тому

      @@z-the-programmer4584 awesome, if you have a blog or something I’d love to read more🙌🏽

    • @z-the-programmer4584
      @z-the-programmer4584 2 роки тому

      Planning to make one in the future actually. Posted links to the code in the descriptions of the videos as requested.

  • @imk8729
    @imk8729 2 роки тому

    Thanks for your nice tutorial 👍