Arm Mbed OS support forum

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

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?

    #include "mbed.h"
    #include "FastPWM.h"
    FastPWM fastpwm(PA_8,1);
    int main() {   
    fastpwm.period(5.25e-8 );
    fastpwm.write(0.5);
    }

No one in mbed can help for my issue? Any hint will be sufficient. Please let me know if given information is not clear to you.

I run the program on DISCO-F746NG.

#include "mbed.h"
#include "FastPWM.h"

FastPWM fastpwm(PA_8,1);

int main()
{
    fastpwm.period(6.25e-8 );
    fastpwm.write(0.5);
    while(true){;}
}

I made a screenshot my digital scope.


PA8 pin output signal looks okay for me (my digital scope bandwidth is only 100MHz).

Thank you for the reply. @kenjiArai , I am attaching my waveform image. Don’t know but it looks messy waveforms. Have you add any filter before giving it to CRO?

I found a Nucleo-F746ZG board from my junk box and tried to check it.
IMG_3020
Please connect CN12 Pin23 to CRO (By the way, you have not a CRO (Cathode Ray Tube Osc) but good Digital Storage Osc 300MHZ!).
You cannot see on CN9 pin17 because SB115 is open.

Yes @kenjiArai, Its Digital storage OSC :slight_smile: , But waveform i shared is already from Cn12 pin23(PA_8). I am already using pin23 from Cn12(PA_8). Please check attached image

Please try this bin file.
https://onedrive.live.com/?id=E726C1E354E854B2%211726747&cid=E726C1E354E854B2
If it also negative, please change port PA_8 to others.
I made PA9 output version and it works well.

I have tried both of your Binaries and getting same messy Waveforms(Attached waveforms are from PA_9). This looks Strange, you are getting proper output with the same board. Let me check this in new ordered F746zg boards, i will probably get it tomorrow. Thank you for the help and efforts. Will revert back with new boards output.

Okay, I understood your situation.
Before order a new board, please check your Digi-Osc.
Picture shows your CH1 input impedance looks 50 ohm.
If you have no hi-impedance probe, you cannot observe proper output.
I recommend to use another observation tool like a logic analyzer or another Osc with hi-imp probe.

With 1 Mega ohm input impedence our output waveform looks like this. Let us check this in another logic analyzer, still there is some noise may be due to oscilloscope.

Hello @kenjiArai , Hurray. Got proper PWM now. Its Probe issue. Thank you for such a nice help.

:upside_down_face: