cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get printf() in Keil

dannym
Associate II
Posted on February 13, 2013 at 20:22

I have an STM32F407 motherboard here connected via SWD, and Keil UVision IDE. 

I can program, run, halt, and read back registers and all the debugging stuff- EXCEPT the printf() won't show anything in the printf() window.  I started out with a Segger JLink and switched to the STLink off an STM32F4Discovery board, and the problem remains, so it's probably not actually specific to the debugger hardware.

I've read the instructions online about the #defines, redirecting the fpuc to ITM_SendChar, setting up the Port 0, and init file, I think I've got that all correct, but still nothing on the printf() window and nothing to go on, basically.  Any ideas?
2 REPLIES 2
dannym
Associate II
Posted on February 14, 2013 at 12:02

Ah ha, the reason it didn't work when hooked through the STM32F4Discovery board's STLink is the two jumpers on CN3 don't disconnect the SWO output from the mounted STM32F4 on the board, thus conflicting with an external connection across the SWD connector.  So you can program and debug but no ITM and no printf()!

It can be fixed by clearing the solder jumper SB12.  That's very tiny and kinda difficult and can't easily be switched back, but it works!

I don't know why printf() didn't work with the J-Link, but it's a totally separate problem, apparently.

Posted on February 14, 2013 at 12:43

I don't know why printf() didn't work with the J-Link, but it's a totally separate problem, apparently.

I think support is dependent on pod firmware/revision. I've have varied experience with this data channel, and preferred a serial channel as I can actually buffer it and not block the processor.

When it worked with Keil, I also noticed that the view window didn't display all the data, looking like it fell behind in the output.

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