cancel
Showing results for 
Search instead for 
Did you mean: 

Debug the code using UART(USB-TTL)

Ax111_
Associate II

I am using STM32F103(Bluepill). Since I am not able to load program to the controller through ST-LINK V2 programmer, so not able debug the code.  

I am loading the program through UART(USB-TTL)

I want to know if there is a way to debug the code using UART(USB-TTL), i want to analyze the real time memory traces.

3 REPLIES 3
Andrew Neil
Evangelist III

"I am not able to load program to the controller through ST-LINK V2 programmer"

Because it's a bricked clone:

https://community.st.com/s/question/0D53W00001YdJPkSAN/no-st-link-connected

"I want to know if there is a way to debug the code using UART(USB-TTL)"

Wouldn't it be simpler to just get a working ST-Link (or other debug probe) ?

Anyhow, without a proper debug probe, you're left with just "printf" debugging, and/or writing patterns out to spare IO to observe on a 'scope or logic analyser.

Or maybe get/make yourself an old-school Debug Monitor:

https://interrupt.memfault.com/blog/cortex-m-debug-monitor

Michael E
ST Employee

Hello @Ax111_​ ,

You can use print on UART and "instrumentalize" the code.

If needed there is an example in Step3 of the STM32MCUwiki.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

From that last link:

"MRI - Monitor for Remote Inspection

MRI is a debug monitor which allows the GNU debugger, GDB, to debug Cortex-M3/M4 processors. This makes it possible to debug applications running on Cortex-M devices using a full featured source level debugger with no extra hardware other than a serial connection."

https://github.com/adamgreen/mri