Prototype21
Junior Member level 1
Hello Guys,
I am trying to setup UART under oscillator bypass mode in STM32f446RE Nucleo Board. I have created a new project in CubeIDE with UART under Asynchronous mode. I have commented out the SystemClock_Config and written my code for oscillator bypass mode even though everything can be done via code generation tool ( Part of learning ). But UART is not responding. Please find the below-attached project.
Please find the attached project.
I am trying to setup UART under oscillator bypass mode in STM32f446RE Nucleo Board. I have created a new project in CubeIDE with UART under Asynchronous mode. I have commented out the SystemClock_Config and written my code for oscillator bypass mode even though everything can be done via code generation tool ( Part of learning ). But UART is not responding. Please find the below-attached project.
Code:
char data[] = "Hello World\r\n";
int main(void)
{
HAL_Init();
//SystemClock_Config();
RCC_OscInitTypeDef Osc = {0};
RCC_ClkInitTypeDef Clk = {0};
Osc.OscillatorType = RCC_OSCILLATORTYPE_HSE;
Osc.HSEState = RCC_HSE_BYPASS;
HAL_RCC_OscConfig(&Osc);
Clk.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
Clk.AHBCLKDivider = RCC_SYSCLK_DIV2;
Clk.SYSCLKSource = RCC_SYSCLKSOURCE_HSE;
Clk.APB1CLKDivider = RCC_HCLK_DIV2;
Clk.APB2CLKDivider = RCC_HCLK_DIV2;
HAL_RCC_ClockConfig(&Clk, FLASH_ACR_LATENCY_0WS);
__HAL_RCC_HSI_DISABLE();
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
MX_GPIO_Init();
MX_USART2_UART_Init();
while (1)
{
HAL_UART_Transmit(&huart2, (uint8_t*) data, sizeof(data), HAL_MAX_DELAY);
}
}
Please find the attached project.