Skip to main content
Associate III
Apr 6, 2025 8:31 AM UTC
Solved

Debbug printf with Nucleo-h743zI2

Hi everyone,

Im  pretty new with using stm32.

Im trying to debug and make printf output to the log.

 

I found alot of vidoes but got pretty lost.

 

Im confused about what is the way of doing it from the start. 

 

I need to setup the external clock?

Then the  trace asynchronous Sw?

 

 

Any explaination would be amazing, thanks! 

This topic has been closed for replies.
Ariel1Best answer
Associate III
Apr 6, 2025 12:39 PM UTC

Found that:

https://qiita.com/Tohno/items/53d1ef8804428858f3b4

 

Thanks for your help! 

5 replies

Andrew Neil
Super User
Apr 6, 2025 10:00 AM UTC

@Ariel1 wrote:

Im  pretty new with using stm32.


Do you have any experience with any other microcontroller(s)? With C programming in general?

 


@Ariel1 wrote:

Im confused about what is the way of doing it from the start. 


The best thing is not to start with printf - that's getting rather advanced!

The first thing to do when starting with any new embedded platform is just to get a simple LED blinking.

"Blinky" is the embedded equivalent of "Hello, World".

While doing that, get used to using the debugger - stepping the code, viewing data & registers, etc.

The next step is to send characters using simple, direct, UART output.

In the case of STM32, use HAL_UART_Transmit().

This will not only prove your software, but also the hardware connections to your terminal (or whatever).

The above is steps 1-3 here:

https://wiki.st.com/stm32mcu/wiki/Category:Getting_started_with_STM32

Then - and only then - you can move on to printf 

https://community.st.com/t5/stm32-mcus/how-to-redirect-the-printf-function-to-a-uart-for-debug-messages/tac-p/733969/highlight/true#M1096

https://wiki.st.com/stm32mcu/wiki/Getting_started_with_UART

https://wiki.st.com/stm32mcu/wiki/STM32StepByStep:Step3_Introduction_to_the_UART

 

More on STM32 getting started:

https://community.st.com/t5/stm32-mcus-products/for-better-learning-stm32-programming-and-debugging/m-p/719468/highlight/true#M260690

 

 

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Ariel1Author
Associate III
Apr 6, 2025 11:18 AM UTC

Thanks alot,

 

I was able to connect USART2 via FTDI from the PC to the NUCLEO-H743ZI2.

And read/send data.

 

But what im missing out is how i can send/read data via my St-linkv3 usb connection for debugging.

 

How do i know what USART i need to configure(such that i can redirect it) ?

I cant find it in the user manual of the NUCLEO-H743ZI2.

 

Any advice would be great, thanks alot! 

Andrew Neil
Super User
Apr 6, 2025 11:22 AM UTC

@Ariel1 wrote:

I was able to connect USART2 via FTDI from the PC to the NUCLEO-H743ZI2. And read/send data.


So that's answered the original question, then?

If so, please mark the solution:

https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256

 


@Ariel1 wrote:

what im missing out is how i can send/read data via my St-linkv3 usb connection for debugging.


That's a new question - please start a new thread for that.

Post a link here so that people can find it...

(but first, check out the Nucleo board's User Manual - it's in there)

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.