Skip to main content
Associate II
December 20, 2023
Question

STM32L010 - printf debug

  • December 20, 2023
  • 2 replies
  • 2678 views

Hello together,

 

I developed a PCB with the STM32L010RBT6 on it and I would like to debug with printf. I connected the SWD Pins (3.3V, SWCLK, SWDIO, GND, NRST) to my Nucleo F446RE kit for SWD debugging. So far so good I can now debug in the CubeIDE but I can't read any of my printf statements. Is there any chance to printf debug on that Cortex-M0?

I tried to connect to the serial communication with the CubeIDE included "SWV ITM Data Console" and with my terminal but never read something out of it. 

 

I would appreciate any help or tips. Thank you!

 

 

2 replies

Tesla DeLorean
Guru
December 20, 2023

The Cortex-M0(+) doesn't support the SWV/SWO model.

Use a UART. Perhaps use a buffer to hold text you can view in stopped instance of the debugger?

Keil had an Event Recording Method   https://developer.arm.com/documentation/kan321/latest/

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Claus_CEAuthor
Associate II
December 21, 2023

Thank you for your fast reply. I tried the Event Recorder in Keil's uVision but it's not working for me, so my last choice would be using an UART->USB adapter and then I can view it in the Keil or CubeIDE. 

Is there any chance to make it work without UART->USB adapter?

Andrew Neil
Super User
January 17, 2024

@Claus_CE wrote:

I tried the Event Recorder in Keil's uVision but it's not working for me

Why not? What went wrong with it?

 

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.
Rim LANDOLSI
ST Employee
December 21, 2023

Hello @Claus_CE  and welcome to the community,

 

You can have a look at the AN4989 STM32 Microcontroller, it  explains how to debug with printf.

Could you also include the debug configuration settings and the type of variable you want to print? This would be more helpful.

 

Thanks,

Rim