Skip to content

Commit

Permalink
Tune in the timer divider for tip control to make PWM less audible
Browse files Browse the repository at this point in the history
  • Loading branch information
Ralim committed Jun 18, 2023
1 parent 341c3f6 commit 6a50743
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions source/Core/BSP/Miniware/Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,12 @@ static void MX_TIP_CONTROL_TIMER_Init(void) {
TIM_MasterConfigTypeDef sMasterConfig;
TIM_OC_InitTypeDef sConfigOC;

htimTip.Instance = TIP_CONTROL_TIMER;
htimTip.Init.Prescaler = 3;
htimTip.Instance = TIP_CONTROL_TIMER;
#ifdef TIP_HAS_DIRECT_PWM
htimTip.Init.Prescaler = 100;
#else
htimTip.Init.Prescaler = 3;
#endif
htimTip.Init.CounterMode = TIM_COUNTERMODE_UP;
htimTip.Init.Period = 255; // 5 Khz PWM freq
htimTip.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; // 4mhz before div
Expand Down

0 comments on commit 6a50743

Please sign in to comment.