CH32 Oscillator
Jump to navigation
Jump to search
In order to get to know the CH32V307 MCU better I decided to create a dual oscillator using the DACs.
Timer
void Timer4_Init (void) { TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure = { 0 }; RCC_APB1PeriphClockCmd (RCC_APB1Periph_TIM4, ENABLE); TIM_TimeBaseStructInit (&TIM_TimeBaseStructure); TIM_TimeBaseStructure.TIM_Period = 3000 - 1; TIM_TimeBaseStructure.TIM_Prescaler = 0; TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInit (TIM4, &TIM_TimeBaseStructure); TIM_SelectOutputTrigger (TIM4, TIM_TRGOSource_Update); TIM_Cmd (TIM4, ENABLE); }