2025-05-14 11:39 PM - last edited on 2025-05-15 1:34 AM by Amel NASRI
Hi Team,
Currently I am using STM32U58I-IOT02A Board and implementing UART Transmit and receive, I am seeing that it is not printing anything on the PUTTY terminal, Can anyone suggest me how to handle this issue. I have tried to send with HAL_UART_Transmit() and printf() commands both and it no outputs on the console.
code is pasted below :
static void MX_USART3_UART_Init(void)
{
/* USER CODE BEGIN USART3_Init 0 */
/* USER CODE END USART3_Init 0 */
/* USER CODE BEGIN USART3_Init 1 */
/* USER CODE END USART3_Init 1 */
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200;
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart3.Init.ClockPrescaler = UART_PRESCALER_DIV1;
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart3) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetTxFifoThreshold(&huart3, UART_TXFIFO_THRESHOLD_1_8) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_SetRxFifoThreshold(&huart3, UART_RXFIFO_THRESHOLD_1_8) != HAL_OK)
{
Error_Handler();
}
if (HAL_UARTEx_DisableFifoMode(&huart3) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART3_Init 2 */
/* USER CODE END USART3_Init 2 */
}
HAL_GPIO_WritePin(uart_e_GPIO_Port, uart_e_Pin, SET); //ph13
HAL_GPIO_WritePin(ph15_GPIO_Port, ph15_Pin, SET); // ph15
RS232_Send(RS232_ACC, "USART3 Ready\r\n");
HAL_StatusTypeDef RS232_Send(RS232_Port port, const char *data)
{
HAL_StatusTypeDef status = HAL_OK;
snprintf((char *)tx_buffer[port], RS232_TX_BUFFER_SIZE, "%s", data);
status = HAL_UART_Transmit_IT(rs232_uart[port], tx_buffer[port], strlen((char *)tx_buffer[port]));
return status;
}
Edit: code formatting
2025-05-15 1:31 AM
hello @ram_jan
You didn't use the correct USART. Based on the user manual of your board, the Virtual ComPort in the STM32U58I-IOT02A is connected to USART1, not USART3.
Thank you.
Gyessine
2025-05-15 11:12 PM
Hi Team,
Thank you for the suggestions.
I am currently planning to use both UART2 and UART3 for different operations. However, I’ve observed that transmissions on the remaining UARTs are not working as expected.
Could you please let me know what additional steps or configurations I should check to ensure proper functionality?
Looking forward to your guidance.
2025-05-16 8:04 AM
Hello @ram_jan
The virtual COM port provided by the ST-Link, which allows you to print results in the serial monitor, is only connected to USART1 in your specific board . If you want to use other USARTs, such as USART2 or USART3, you will need to implement buffering since they are not directly linked to the ST-Link. You can refer to This Wiki
Thank you
Gyessine
2025-05-22 10:25 PM
Thanks for the Suggestion, I will check and update !!!