2018-11-02 12:39 PM
I have an heavily modified LCD Application/example for STM32F746 Discovery and Usart code from CubeMX. It looks like their clock frequencies do not match, that is the Baud rate is off. I would like know in which files is the clock frequency set up. And of course Baud rate too, I'll have to match that to the clock later.
2018-11-02 04:41 PM
The system should be able to decompose the RCC and PLL settings, and use the HSE_VALUE defined in stm32f7xx_hal_conf.h to set bad rates.
Clock stuff RCC file, baud rate U(S)ART files
printf("Core=%d, %d MHz\n", SystemCoreClock, SystemCoreClock / 1000000);
printf("HCLK=%d\n", HAL_RCC_GetHCLKFreq());
printf("APB1=%d\n", HAL_RCC_GetPCLK1Freq());
printf("APB2=%d\n", HAL_RCC_GetPCLK2Freq());
2018-11-02 05:39 PM
Do you mean that the CPU calculates the baud rate itself, no matter how strange the clock frequency is?
So this is enough (in Usart.c file.)?
huart6.Instance = USART6;
huart6.Init.BaudRate = 9600;
huart6.Init.WordLength = UART_WORDLENGTH_8B;
huart6.Init.StopBits = UART_STOPBITS_1;
huart6.Init.Parity = UART_PARITY_NONE;
huart6.Init.Mode = UART_MODE_TX_RX;
huart6.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart6.Init.OverSampling = UART_OVERSAMPLING_16;
huart6.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart6.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart6) != HAL_OK)
2018-11-02 05:42 PM
By the way, I have loop back working. I have to try connecting boards together next.