- 8
- 83 756
Z-The-Programmer
Приєднався 15 січ 2021
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)
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...
good tutorial thanks a lot keep it up
Another super usefull video! Little addition, I had to set the output speed to very high for a 50mhz clock. See OSPEEDR register.
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.
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.
For calculating the baud rate... why the input frequency is 4MHz when USART1 is connected to ABP2 which frequency is 80MHz?
Great video! Very informative! Looking forward to more register level programming tutorials!
Is this what is meant by bare-metal programming of GPIO?
please take more video about STM32 Bare metal
it works! thanks
I don't have the pack installer enabled for my keil uvision (non commercial) what should I do ?
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.
Thanks for showing monitor screen big enough to see on my tablet, since I'm stuck in a hospital bed...
Your videos on this subject are absolute GOLD, thanks so much!
Such a useful video and such a nice presentation!! Thankyou so much... hats off to the efforts taken for making this video
make more videos
The Mic quality though! ASMring into my ear
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!
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?
My spi driver search is finally successfull now, Thankyou so much Z- The-Programmer
hello so, where i can get myUART.h file?)))
Write it yourself or just use any other UART library
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 ...
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.
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 👌
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 👌
Well done! All of this effort for a simple UART interface! Well achieved and thank you for your excellent presentation. (Love the graphics)
very clear and straight to the point. Thank you!!
Thanks.
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?
Ah, yes I did make a mistake here. I meant to say bit 0. Well spotted, thank you!
@@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!
my guy you're a life saver xoxo <3
Glad it helped
hello, a very good job ,please continue making videos, do you have any community to join ?like discord or something
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.
Very very good sir Plz make more videos ,on UART,SPI ,I2C, CANN ,EXTRA by St link, and stlink v2
I'll look into it :)
Very good sir
This is great could you please make a video using interrupts for timer output compare and input compare?
Will add it to my list of videos to make :)
i am not able to read more than 256 bytes in externnal spi
bro where you install that dark theme for keil
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.
Hello, this is a great example. Can you please correct the github link. It shows 404 error.
Hi, sorry about that. The link should work now.
Noice
great start
Getting better
Love your voice!
Interesting!
Very Informative!
Great vid! Very Informative. Please more
Good explanation! Thanks you
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!
That's a good point. Thank you for advice!
Really nice video
peripheral registers bit access: ua-cam.com/video/97tCW8JKxmc/v-deo.html
Great, good work!
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.....
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.
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.....
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.
@@z-the-programmer4584 When can we expect this? Love it so far ❤
I am planning to tidy the code up and put it all up somewhere by the end of this month.
@@z-the-programmer4584 awesome, if you have a blog or something I’d love to read more🙌🏽
Planning to make one in the future actually. Posted links to the code in the descriptions of the videos as requested.
Thanks for your nice tutorial 👍
You're welcome. More coming soon :)