Generic STM32F401RBT6 with 12Mhz Crystal

Hi. I have a 3D printer board with the above processor but the crystal is 12MHz instead of 8MHz. I understand I need to set the clock multipliers (USB, SDIO, etc) to suit but I cannot figure out how to do this in platformio. Best I can figure is I need to create a variant but I do not understand how to do that. I could not find any documentation on that. Any examples I could find do not explain this very well at all. Can anyone point me in the right direction to do this?

GitHub - maxgerhardt/pio-custom-stm32duino-variants: A short example of how to use a custom variant folder for the PlatformIO + STM32Duino environment

build_flags + -DHSE_VALUE=12000000UL.

Thank you. Is there a way to use build flags to set the other multipliers? Or does that require a variant?

No, they’re const.

Either create a variant (useful anyways for a custom board), or redef the weak extern "C" void SystemClock_Config(void) func in your own FW.