Skip to main content
Cjosh.1
Associate II
January 15, 2021
Question

I want to generate 16 MHZ clock signal from Nucleo-F746ZG development board. I have used FastPWM library to generate 16 MHZ clock on PA_8 pin. But not able to see square wave on CRO. Can someone please help

  • January 15, 2021
  • 4 replies
  • 1411 views
#include "mbed.h"
#include "FastPWM.h"
FastPWM fastpwm(PA_8,1);
int main() { 
fastpwm.period(5.25e-8 );
fastpwm.write(0.5);
}

This is my simple code to generate PWM in MHZ using FastPWM. When i check on CRO its showing frequency about 16 to 19 MHZ but not abel to see square waves. what am i missing here? Can someone please help?

This topic has been closed for replies.

4 replies

waclawek.jan
Super User
January 15, 2021

I don't think you will find much help for mbed here. Try dedicated mbed support (forum, if such exists).

For precisely timed PWM, use hardware timers.

If the GPIO output is not fast enough, try different setting for the given pin in GPIO_OSPEEDR. I don't know how is this set in mbed.

JW

Uwe Bonnes
Chief
January 15, 2021

PA8 is also MCO1. Check if you can use that way. Check also, that alternat functions are set the right way.

Cjosh.1
Cjosh.1Author
Associate II
January 18, 2021

Thank you for reply @Community member​  and @Uwe Bonnes​ , Yes @Community member​ you are right, i have posted same question on same day on mbed forum also and no one replied to it. Anyway let me go with your suggestions. Will revert back with the output. Thank you.

Cjosh.1
Cjosh.1Author
Associate II
January 19, 2021

Just for Information. I am able to get proper 16 MHZ output on PWM pins like D6,D9,D10,PA8 etc... with the same code posted in question. It was probe issue and input impedance issue. I have set input impedance to 1 Mega-ohm. Thank you.0693W000007BoWqQAK.jpg