Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
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);
}

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();
}
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