Board has 12Mhz Xtal

Any other STM32 based boards
Post Reply
Posts: 9
Joined: Thu Feb 25, 2016 11:40 am

Board has 12Mhz Xtal

Post by lloyd-g » Fri Mar 18, 2016 8:40 am

Anyone know where I adjust for this in defining a board or variant?
I can't change the Xtal as it is shared with the on-board JTAG programmer.
did find

Code: Select all

## external crystal (HSE), running at 72 MHz F103 @ 72 MHz w/ crystal -DMCU_STM32F103RB -mthumb -march=armv7-m -D__STM32F1__ 

but does not set the xtal only f_cpu with generic defaults for clock and pll.

Followed NUCLEO_HSE_CRYSTAL but not very clear on setup.
was hoping for a

Code: Select all

#define xtal_f 8000000L

User avatar
Posts: 7683
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia

Re: Board has 12Mhz Xtal

Post by RogerClark » Fri Mar 18, 2016 9:39 am

You need to change the PLL multiplier to suit your crystal in the variant folders wirish/boards_setup.cpp where it sets

Code: Select all


You need to set it to i.e 6 x 12 = 72MHz

Code: Select all

F_CPU is set in Boards.txt to be 72Mhz for all STM32 boards, but I don't think you need to change this, its just the main RCC PLL

If the USB on the F103 doesnt work, you may need to change the USB PLL divider, but this seems unlikely

Post Reply