grlib/occan: Fix baud rate calculation

Fixes #5166
This commit is contained in:
Jan Sommer
2024-12-03 09:10:02 +01:00
committed by Joel Sherrill
parent 23fa41ecae
commit ab21dcba06
2 changed files with 6 additions and 3 deletions

View File

@@ -1019,7 +1019,9 @@ static void convert_timing_to_btrs(
{
btrs->btr0 = (t->rsj << OCCAN_BUSTIM_SJW_BIT) |
(t->scaler & OCCAN_BUSTIM_BRP);
btrs->btr1 = (0<<7) | (t->ps2 << OCCAN_BUSTIM_TSEG2_BIT) | t->ps1;
/* Core adds +1 to the register values, so compensate here by decrementing */
btrs->btr1 = (0<<7) | ((t->ps2-1) << OCCAN_BUSTIM_TSEG2_BIT) | (t->ps1-1);
}
static int occan_set_speedregs(occan_priv *priv, occan_speed_regs *timing)