8 years, 4 months ago.

Is the wait time in KL25z limited to 2us by default?

Hi,

I am trying to generate a 50% duty cycle clock having 1 MHz frequency using FRDM-KL25z. So I just wrote the following code in mbed online compiler. The wait time I specified is = 0.0000005 sec (or, 0.5 usec). However, when I observe the clock in the scope, it is showing a 125 KHz clock corresponding to wait time = 2 us.

#include "mbed.h"

DigitalOut CLK(PTE1);

int main()
{
    CLK = 0;
    while(1)
    {
        CLK = 1;    
        wait(0.0000005);        
        CLK = 0;   
        wait(0.0000005);
    }
}

But, when I set the wait time to 100 us (5 KHz freq), it is coming correctly.

I am a new user of FRDM-KL25z. So, please help me in this.

- Thanks Samiran

Be the first to answer this question.