cancel
Showing results for 
Search instead for 
Did you mean: 

Debug the code through uart

GAGGA.1
Associate II

Hi!

I am using STM32F373RCT6 controller on custom board. In that board we have used USB to serial convertere chip FT2232HL-REEL and it is connected to USART1 (PA9 and PA10).

STM32F373RCT6 system clock frequency is 70MHz.

Can I use USB to serial option to debug the code instead of ST Link V2? If Yes, how?

I want to flash the code through USB in our project.

If any other details required, please let me know.

Regards,

Gaurav

6 REPLIES 6
TDK
Guru

> Can I use USB to serial option to debug the code instead of ST Link V2? If Yes, how?

The SWD protocol doesn't work over UART, so you can't just have STM32CubeIDE or another IDE use UART instead of the SWD connection.

You can debug your code though UART, but you will need to implement that functionality yourself. A common method is to have printf statements get output over UART and read in on a console. You can use that information to figure out what the chip is doing. This method of debugging is going to be much slower than if you were to connect over SWD in order to inspect variables and registers at will.

If you feel a post has answered your question, please click "Accept as Solution".

With BOOT0 HIGH you should be able to reset into the System Loader and use the COM/USART update method in STM32 Cube Programmer

People have moved away from target hosted debugging, best you can probably do is telemetry and diagnostic output, and create a little debug monitor/console to test your own routines.

Pity you didn't provide yourself a means to get to SWDIO/SWCLK/SWO pins, test points or edge connector to do JTAG/SWD properly. If you really need to step your code to understand it, perhaps build a proxy for your board with suitable access.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
gregstm
Senior II

I've been debugging/programming my STM boards/software via the uart (and stepping through code segments with the simulator) for the last ten years - but I don't have a project manager breathing down my neck, so I can take my time.... I just print diagnostics (via the uart), toggle pins etc. to debug when needed. The simulator is crucial to this method though.

GAGGA.1
Associate II

Thanks for your reply.

I grew up with DDT and SID, and my super-boss​ was always fascinated that I didn't need a symbolic debugger, or ICE, to figure out what his code and mine actually did..

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

...yep, there is a Zen about good debugging. I haven't had the luxury of an ICE since the early 1990's... but I do wish a had a few clones of myself so that I can get some of my half finished projects finished 🙂