Repository navigation
Conversation
… non-HAL things out of the fdcan_toad
…rns successfully now
…ecause we don't need them/they complicate the codebase
…n formatter on modified sources; make fdcan_toad give a compiler error when neither STM32H7 or STM32G4 are defined
| RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; | ||
| RCC_OscInitStruct.PLL.PLLM = RCC_PLLM_DIV4; | ||
| RCC_OscInitStruct.PLL.PLLN = 85; | ||
| RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; |
There was a problem hiding this comment.
We are now using external OSC? is this intentional / do we want to do this on H7 as well?
There was a problem hiding this comment.
Yes this is intentional; we have an 8MHz mems oscillator on the board
There was a problem hiding this comment.
H7 also has 8MHz mems so we should use that as well, best to do it in a new PR for organization
| HAL_RCCEx_CRSConfig(&pInit); | ||
|
|
||
| PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USB; | ||
| PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_HSI48; |
There was a problem hiding this comment.
interesting that this works on G4, while HSI48 had issues on H7...
(usb wouldn't work if we set the clock to HSI48 like we are doing here)
There was a problem hiding this comment.
Could this have something to do with the fact that we have CRS disabled on the H7? HSI48 is not precise enough alone to be used for USB
There was a problem hiding this comment.
ah that's almost certainly it - we could consider HSI48 + CRS on the H7 then?
Not sure what's actually better, but I assume the same thing is better for both. Anyhow, issue for future PRs.
| RCC_OscInitStruct.PLL.PLLN = 60; | ||
| RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; | ||
| RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV4; | ||
| RCC_OscInitStruct.PLL.PLLQ = RCC_PLLQ_DIV2; |
There was a problem hiding this comment.
have we checked that we are hitting max CPU clock with this config?
There was a problem hiding this comment.
We are not, this hits 120MHz. Maximum frequency is 170MHz, is this really a big deal?
There was a problem hiding this comment.
I'm fine w/ 120 MHz, just want to note down that we are reducing our max frequency on the G4 in this PR.
Presumably the original config with the 85 scaler was to get to 170?
|
FDCAN stuff seems solid, a few unused vars I think... Clock stuff is probably fine b/c it is working, but I think we should check if we want to propagate some of the changes to the H7 - fine to defer to another PR if desired. |
… for G4 to address PR comments
Adds G4 support to CAN library. Also moves board-specific things out of the fdcan_toad.c/.h files.