cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to use print anything on teraterm using UART

Lm3332
Visitor

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 

3 REPLIES 3
Karl Yamashita
Principal

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
		}
	}

 

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.
Chris21
Senior II

Are you using a NUCLEO-L4R5ZI board?

Default solder bridge connects to PG7 and PG8.

 

Chris21_0-1748030458697.png

 

Chris21_0-1748030911036.png

Not USART2...