Merge pull request #14029 from arduino/can_h7_wrong_frequency

STM32H7: FDCAN: use PLL1Q frequency for calculations
pull/14045/head
Martin Kojtal 2020-12-18 09:21:38 +00:00 committed by GitHub
commit 643233ed16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -132,8 +132,10 @@ static void _can_init_freq_direct(can_t *obj, const can_pinmap_t *pinmap, int hz
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / hz;
#else
// STM32H7 doesn't support yet HAL_RCCEx_GetPeriphCLKFreq for FDCAN
// Internal ST ticket 92465
int ntq = 10000000 / hz;
// We use PLL1.Q clock right now so get its frequency
PLL1_ClocksTypeDef pll1_clocks;
HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks);
int ntq = pll1_clocks.PLL1_Q_Frequency / hz;
#endif
int nominalPrescaler = 1;
@ -287,8 +289,9 @@ int can_frequency(can_t *obj, int f)
int ntq = HAL_RCCEx_GetPeriphCLKFreq(RCC_PERIPHCLK_FDCAN) / f;
#else
// STM32H7 doesn't support yet HAL_RCCEx_GetPeriphCLKFreq for FDCAN
// Internal ST ticket 92465
int ntq = 10000000 / f;
PLL1_ClocksTypeDef pll1_clocks;
HAL_RCCEx_GetPLL1ClockFreq(&pll1_clocks);
int ntq = pll1_clocks.PLL1_Q_Frequency / f;
#endif
int nominalPrescaler = 1;