Skip to main content
Associate
May 23, 2025
Solved

Unable to use print anything on teraterm using UART

  • May 23, 2025
  • 2 replies
  • 483 views

Hey everyone. I am trying to print something on TeraTerm console using USART2. I am using STM32L4R5ZI board for this function. Below is a picture of my .ioc file: 


ioc_file.png
Below is the Code in my while(1) Loop: 
Code_while(1)_Loop.png

Below is the configuration for USART2 in main.c file and msp_c: 

USART_main_c.pngUSART_msp_c.png

Finally, this is my clock configuration for this project: 

Clock_configuration.png

My teraterm settings are as follows: 
TeraTerm_setting.png

I am trying to send some data to TeraTerm. However, nothing is being printed out. 


Can someone help me out with this issue? @Peter BENSCH 

Best answer by Chris21

Chris21_0-1748030911036.png

Not USART2...

2 replies

Karl Yamashita
Principal
May 23, 2025

When posting code, use the </> instead of screen shots

KarlYamashita_0-1748029633269.jpeg

 

Use strlen instead of sizeof for strings. Don't use HAL_MAX_DELAY as that is ~49 days before it returns from a timeout. 100ms will suffice.

You don't check HAL status to see what could be the issue.

HAL_StatusTypeDef hal_status;
	hal_status = HAL_UART_Transmit(&huart2, Test, strlen(Test), 100);
	if(hal_status != HAL_OK)
	{
		if(hal_status == HAL_TIMEOUT)
		{
			// do something
		}
		else if(hal_status == HAL_BUSY)
		{
			// do something
		}
		else if(hal_status == HAL_ERROR)
		{
			// do something
		}
	}

 

If a reply has proven helpful, click on Accept as Solution so that it'll show at top of the post.CAN Jammer an open source CAN bus hacking toolCANableV3 Open Source
Chris21
Associate II
May 23, 2025

Are you using a NUCLEO-L4R5ZI board?

Default solder bridge connects to PG7 and PG8.

 

Chris21_0-1748030458697.png

 

Chris21
Chris21Best answer
Associate II
May 23, 2025

Chris21_0-1748030911036.png

Not USART2...

Lm3332Author
Associate
May 24, 2025

Thank you. I knew that PG7 and PG8 were the terminals for my terminal. However, I was following a lot of tutorials on YouTube, and most of them were using USART2. That's why I was using it. 

 

Anyways, Thanks for the help. Appreciate it @Chris21