cancel
Showing results for 
Search instead for 
Did you mean: 

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

Cjosh.1
Associate II
#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?

4 REPLIES 4

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
Principal III

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

Cjosh.1
Associate II

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
Associate II

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