When working with STM32 using registries only it is important that you have REFERENCE MANUAL and DATASHEET available. We will use them a lot 🙂
In today’s post we will be outputting SYSCLK to external pin of our STM32F407 discovery board. As mentioned we dive into our RM and find part responsible for RCC configurations. From there it is easy to see which bits we need to output SYSCLK to our pin.
As you can see on the above reset value shows that desired SYSCLK and default no prescaler will be selected. Then in this instance let’s find out on which pin we have to enable our alternate function.
To do this we need to find it in DS.
Great – it is default system function! So the only thing we should do is just set this PIN as output
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOCEN; // Enable clock: GPIOC
* Enable SYSCLK output to PC9
GPIOC->MODER |= GPIO_MODER_MODER9_1 ; // AF: PC9 => MCO2
let’s see it if works by looking into our logic level analyzer
We will defenitely be able to use this functionality in interacting with external hardware – but thats for future posts