2026-03-25 10:52 AM
NUCLEO F767ZI, CubeIDE 2.1.1, CubeMX 6.17.0
I'm trying to set up UART with printf()
#include <stdio.h>
UART_HandleTypeDef huart3;
static void MX_USART3_UART_Init(void);
int __io_putchar(int ch)
{
HAL_UART_Transmit(&huart3, (uint8_t *)ch, 1, 10);
return ch;
}
....
// in main
// in while
prinf("UART test\r\n");
// MX generated USART3 init
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.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart3) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART3_Init 2 */
/* USER CODE END USART3_Init 2 */
}
Clock tree from MX
Output in Tera Term window
TT is set up exactly the same as the UART init in the code.
Anyone know whats going on here?
Solved! Go to Solution.
2026-03-27 4:57 AM
@CTapp.1 wrote:GCC does generate a warning for it:
@NicRoberts did you not get a warning, then?
2026-03-30 6:46 AM
No warnings.