cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 Nucleo H7A3ZI board UART Issue

mahmanish
Associate II

Hi Community,

 

I am facing very basic issue. My UART in H7A3ZI Nucleo 144 board is not displaying correctly on terminal. 

 

My UART Setting: 

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)

 

My Code:

 

int _write(int file, char *ptr, int len)

{

HAL_UART_Transmit(&huart3, (uint8_t*)ptr, len, HAL_MAX_DELAY);

return len;

 

}

 

//and

 

while (1)

{

/* USER CODE END WHILE */

 

/* USER CODE BEGIN 3 */

printf("current number is %d\r\n", counter++);

HAL_Delay(500);

}

 

My Buad rate is 115200

This is basic code to get UART output data on ST link virtual serial port that is connected to Laptop.

1 REPLY 1

Watch what value HSE_VALUE is using, against the MCO frequency the ST-LINK/V3 is actually generating.

25 MHz / 3 = 8.333333 MHz, not 8.000 MHz

The firmware update tool should provide some clocking options.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..