‎2022-08-07 08:12 PM
I 'd like to use a GPIO of STM32 to generate a clock for other peripherals. This clock should have the same precision as HSE.Also, the clock should be stable.Also, once set successfully, its stability is not disturbed by running code/interrupts.And it does not consume the MCU's computing resources.For example, I want to output a stable 12MHz MLCK for Audio Codec on any GPIO on a 72MHz general purpose STM32.
Do you have any suggestions?With timers, PWM, Memory to GPIO DMA, ?
Br
‎2022-08-07 08:36 PM
TiM​ or MCO
‎2022-08-07 10:58 PM
MCO is best option if pin available
Timer in pwm mode enablee programmable duty cycle at lower frequencies
Some STM32 clock tree have multiple pll especially for audio, use them to outptu on a pin like mco as frequency is programmable and independent of core.
In extreme limited choice situations, SPI master with cycling dma a byte out with only SCK pin enabled can sometime work around limitations. Similar way on few other peripherals. Depends on situation and final goals.
‎2022-08-07 11:43 PM
Thanks . Maybe MCO is the best option. Can I expect a more general solution?Using HSE as clock source, route to a GPIO through PLL to generate the required clock.:grinning_face: