![]() RCC_ClkInitStruct.APB1CLKDivider = RCC_APB1_DIV2 RCC_ClkInitStruct.APB3CLKDivider = RCC_APB3_DIV2 RCC_ClkInitStruct.AHBCLKDivider = RCC_HCLK_DIV2 RCC_ClkInitStruct.SYSCLKDivider = RCC_SYSCLK_DIV1 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK |RCC_CLOCKTYPE_D3PCLK1|RCC_CLOCKTYPE_D1PCLK1 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK If (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE ** Initializes the CPU, AHB and APB busses clocks _HAL_RCC_PLL_PLLSOURCE_CONFIG(RCC_PLLSOURCE_HSE) ** Macro to configure the PLL clock source _HAL_RCC_LSEDRIVE_CONFIG(RCC_LSEDRIVE_LOW) While ((PWR->D3CR & (PWR_D3CR_VOSRDY)) != PWR_D3CR_VOSRDY) _HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1) * Configure the main internal regulator output voltage */ ![]() RCC_PeriphCLKInitTypeDef PeriphClkInitStruct So, in variant.cpp pertaining to my board I changed the old function WEAK void SystemClock_Config(void) we connect a digital clock signal instead of a crystal. The clock had to be configured to use HSE (High Speed External) oscillator set to bypass mode - i.e. ![]() This clock is 8 MHz and is derived from a crystal. Instead, I used STM32CubeMX and knowledge from this course (I highly recommend courses by this author) to configure the MCU to use external clock provided by the onboard STLink programmer. I could've tried to calibrate the oscillator, but I didn't bother. The result was that the UART was 6% too slow. It turns this Nucleo board version was configured in stm32duino to use I think the worst clock option, that is CSI, which is an internal 4 MHz RC oscillator.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |