This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

UART1 visualise in Debug

Hello,

First of all I need to mention I'm new within the STM and Keil environment. Have plenty experience in Arduino and Pic (C++).
So still in a learning curve, don't "kill" me. (I already went true a lot of documentation)

I understand that STM & Keil is quite different then Arduino, but gives much more insight and functionality for the programmer. GREAT.

"Blinky" works fine.
But now I took the next step "Hello" on Uart1. Configured all settings with STMCUBE (great tool).
Then added this code in the main part. (See below).
I expected that in Debug mode (I use J-Link Segger) when I opened the serial window and selected "Uart1", I would see "Hello" on the screen.....

But "NO".... Perhaps something is wrong in the code, but I'm more afraid there is something I don't get about the "setup" or functionality of the debugger. Because I never used a "Debugger" before.
I also read some documents about "printf", and the "viewer", but I have to admit, I don't fully understand (fputc.....). Seems also need some configurations....
And if the debugger cant show the Uart1 data in the serial terminal, what is then the use of this functionality.....?

Sorry if this a too "simple" question, but probably the Arduino messed up my "thinking".
Would like to get much more understanding of these STM controllers.

Thankx
YB

Setup:
Keil-Lite (can this be the reason for my problem???)
STM32F103VC
J-Link Segger debugger

Program:

int main(void)
{ /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration----------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* Configure the system clock */ SystemClock_Config(); /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_TIM1_Init(); MX_USART1_UART_Init();

/* USER CODE BEGIN 2 */ char *msg = "Hello"; HAL_UART_Transmit(&huart1, (uint8_t*)msg, 6, 0xFFFF); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1)

Parents Reply Children
  • JTAG/SWD debugger like J-Link or our ULINK2 do not handle the UART of your microcontroller in any way. If your application sends something to the UART, you need to connect a terminal to it to see the output. This is then independent of uVision.
    As an alternative, you can redirect the output of your application to the ITM printf window. Please see:
    www.keil.com/.../ulink2_trace_itm_viewer.htm

    When MDK 5 is installed you can find further information at:
    file:///C:/Keil_v5/ARM/PACK/Keil/ARM_Compiler/1.0.0/Doc/html/_retarget__examples__i_t_m.html
    You may have to adapt the path depending on your MDK installation path.

  • The 'Serial Windows' are only intended for simulation with ARM devices and some Monitor debug solutions with 8051/166 devices. The simulation of on-chip peripherals is not supported any more for all newer ARM devices.

  • Thanks for this feedback. I will read again the ITM docs.
    But what is then the use of "Uart1" in the debugger?? For what can you use this screen.
    I even tried simulation mode, but no output...
    On a terminal the program works fine.

    Thanks