Skip to content

Commit

Permalink
Limit PLL filter bandwidth for UART sources by polling rate
Browse files Browse the repository at this point in the history
  • Loading branch information
jpieper committed Nov 12, 2024
1 parent 83964c0 commit 2af62ba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fw/motor_position.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@ class MotorPosition {
} else if (mode == M::kCuiAmt21) {
source_config.cpr = 16384;
}
const float source_rate_hz =
1000000.0f /
aux_config->uart.poll_rate_us;
const float max_pll_hz = source_rate_hz / 10.0f;
source_config.pll_filter_hz =
std::min(source_config.pll_filter_hz, max_pll_hz);
break;
}
case SourceConfig::kSpi: {
Expand Down

0 comments on commit 2af62ba

Please sign in to comment.