12 years, 9 months ago.

Issues with Freescale KL25Z and Ticker/Timeout

The Ticker and Timeout functionalities don't seem to be working properly for small times (<70ms or so) on the KL25Z.

The ticker looks like it's either triggering multiple times per tick or skipping ticks.

Ticker example

#include "mbed.h"

DigitalOut out(PTA1);
Ticker tick;

void togglePin (void) {
    out = !out;
}

int main() {
    tick.attach_us(togglePin, 10000);
}

/media/uploads/stvnrhodes/img_20130301_155645.jpg

The timeout looks like it triggers in no faster than 65ms.

Timeout example

#include "mbed.h"

DigitalOut out(PTA1);
Timeout timer;

void toggleOff (void);

void toggleOn (void) {
    out = 1;
    timer.attach_us(toggleOff, 10000);
}

void toggleOff(void) {
    out = 0;
    timer.attach_us(toggleOn, 30000);
}

int main() {
    toggleOn();
}

/media/uploads/stvnrhodes/img_20130301_154615.jpg

It may be coincidence, but the cutoff seems to be close to 65535us, the maximum size of a 16-bit unsigned integer.

1 Answer

12 years, 9 months ago.

Hi Steven, we fixed the implementation of the "us_ticker_api" for the KL25Z. [mbed library revision 61]

Simply select the "mbed" library and click on the "Update" button in the right "Library Details" panel.

Thanks for reporting this issue.

Cheers, Emilio

Accepted Answer

My mbed library says it is up to date but I'm also having problems with times <100ms.

posted by John-Michael Reed 07 Apr 2013

deleted

posted by auPilot auPilot 27 Jan 2016