Hi ,
I'm trying to print something via "ITM_SendChar();" in the Debug (printf) Viewer of Keil. But it seems no work for me.
Environment: KEIL v5.17 + STM32L475VE + ST-LINK V2-1
Trace settings:
Code in main.c:
void main(void) { //SYSCLK = HSE / PLLM * PLLN / PLLR //SYSCLK = 8M / 1 * 20 /2 = 80M SystemClock_Config(); while(1) ITM_SendChar('A'); }
Observed things:
1. There is no prints in the debug (printf) viewer(see pictures)
2. There is "Trace: no synchronization" in the status bar during the running.(see pictures)
Any ideas ?
Thanks in advance.
Well, after going through the ITM and ST-LINK documents.
It might be HW conflicts.
The SWO pin was set for LCD controlling in my development board after checking the board layout.
And also, same method works on another board.
Hi,
Yes, I agree with you. This is either a hardware conflict or a wrong configuration of the SWO pin.
If you want to use the serial wire trace, the SWO pin must be dedicated for trace output and nothing else. So it must be connected to the Cortex-M debug connector and not to the LCD.
Since you got the error message in the status line 'Trace: No Synchronization', the trace does not work at all. I see that you are using a quite old uVision version 5.17 (October 2015). This version does not support the so called 'Debug description' which is part of most new Device Family Packs. With this information, uVision would automatically configure the SWO pin for trace when you enable trace in the dialog and when you start a debug session. In your uVision version, you probably need an INI file to configure this pin.So I would recommend you to update your MDK to the latest version 5.27 pre-release (http://www2.keil.com/mdk5/)
I hope this helps a bit.
Hans