Skip to content

Commit 049785f

Browse files
committed
STM32H7: FDCAN: use PLL1Q frequency for calculations
1 parent f616f2a commit 049785f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

targets/TARGET_STM/can_api.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,10 @@ static void _can_init_freq_direct(can_t *obj, const can_pinmap_t *pinmap, int hz
132132
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / hz;
133133
#else
134134
// STM32H7 doesn't support yet HAL_RCCEx_GetPeriphCLKFreq for FDCAN
135-
// Internal ST ticket 92465
136-
int ntq = 10000000 / hz;
135+
// We use PLL1.Q clock right now so get its frequency
136+
PLL1_ClocksTypeDef pll1_clocks;
137+
HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks);
138+
int ntq = pll1_clocks.PLL1_Q_Frequency / hz;
137139
#endif
138140

139141
int nominalPrescaler = 1;

0 commit comments

Comments
 (0)