Skip to main content
ABlum.2
Associate III
June 9, 2021
Solved

Generate a 20 MHz clock with the GPIO outputs in STM320H745zi

  • June 9, 2021
  • 3 replies
  • 3482 views

Hello everyone!

Is there any project to generate an Clock output of 20Mhz? I tried with TIM 16 but the best I can get is around 300 kHz

Thanks in advance

Alan Blumenstein

This topic has been closed for replies.
Best answer by Javier1

@ABlum.2​ That pin has the DFSDM1_CKOUT option.0693W00000BaXMaQAN.pngI never used this peripheral but its meant for driving external ADCs so the DFSDM1_CKOUT pin can generate a very fast pwm clock signal for you.

0693W00000BaXNiQAN.png 

Did you tried this already?

3 replies

Mike_ST
Technical Moderator
June 9, 2021

In the STM32H7 firmware package,

available here:

https://www.st.com/en/embedded-software/stm32cubeh7.html

you have a PWM example \Projects\NUCLEO-H745ZI-Q\Examples\TIM\TIM_PWMOutput

and then it's a matter of adjusting uhPrescalerValue, PERIOD_VALUE and PULSEx_VALUE

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
ABlum.2
ABlum.2Author
Associate III
June 9, 2021

Hi Mike_ST

Thanks for the response. I tried to play with this example before and I am not reaching the 20 MHz, I also tried to use an interruption were I set a digital output to generate the clock but the frequency drop down to 400 kHz.

Regards

Alan

Javier1
Principal
June 9, 2021

Are you using a XTAL as a HSEclock source?

How high is your system clock?

Maybe share a snap of your cubeMX page clock setup

hit me up in https://www.linkedin.com/in/javiermuñoz/
ABlum.2
ABlum.2Author
Associate III
June 9, 2021

0693W00000BaVWsQAN.pngHi Javier,

Thanks for the answer here I send you a picture of the clock setup.

Tesla DeLorean
Guru
June 9, 2021

Sounds like you're trying to service an update interrupt rather than let the TIM control the pin directly. ​

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
ABlum.2
ABlum.2Author
Associate III
June 9, 2021

Hi Tesla Delorean

Thanks for the answer. Yes the pin I need to control is not realted to any TIM (pin PC2_C) hence I need to toggled it to make the clock.

Regards

Alan

Javier1
Javier1Best answer
Principal
June 9, 2021

@ABlum.2​ That pin has the DFSDM1_CKOUT option.0693W00000BaXMaQAN.pngI never used this peripheral but its meant for driving external ADCs so the DFSDM1_CKOUT pin can generate a very fast pwm clock signal for you.

0693W00000BaXNiQAN.png 

Did you tried this already?

hit me up in https://www.linkedin.com/in/javiermuñoz/