Skip to main content
Associate III
July 22, 2024
Solved

STM32H7 device uart is not working after changing core clock

  • July 22, 2024
  • 1 reply
  • 3063 views

Why the uart stops working on stm32h755 device once the core clock has been modified and code has been generated using cubemx. It comes with a BSP code for serial communication (which i tried seperately) , that is also not working once the core clock has been modified.

by defualt the core clock is in 64Mhz, if i switch the core to HSI with core running at 400Mhz the uart is giving garabage on the terminal in a fresh project. 

This is the initilization function generated by cubemx

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 */

}

sarun_0-1721621910331.png

sarun_1-1721622434813.png

 

The reason I am posting this here is that I have access to a couple of other STM32 devices where I have done the same but haven't faced such an issue.

I am currently using the 1.11.2 STM32H7 package.

 

Best answer by mƎALLEm

Hello,

I didn't reproduce the issue @400Mhz (attached the modified ioc file). "Welcome to STM32 world !" is well displayed.

Are you using the latest version of CubeMx 6.12.0 ?

Check also your cable.

1 reply

mƎALLEm
ST Technical Moderator
July 22, 2024

Hello,


. It comes with a BSP code for serial communication (which i tried seperately)

Which board are you using?

Could you please share your ioc file?

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
sarunAuthor
Associate III
July 22, 2024

I am using STM32H755 nucleo board

This is working ioc file where i havent touched on the core clock.

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
July 22, 2024

Hello,

I didn't reproduce the issue @400Mhz (attached the modified ioc file). "Welcome to STM32 world !" is well displayed.

Are you using the latest version of CubeMx 6.12.0 ?

Check also your cable.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.