The wait(), wait_ms(), wait_us(), and Thread::wait() functions take 10 times as long as they should on a LPC 1768 with the online compiler.
A wait_ms(100) should wait for 100 milliseconds but acutally takes 1 second.
Tested with values for 1 second and 1/10 second.
Tested revisions:
I used the same program with OS 2 and OS 5 with Thread.wait() only on OS 5.
#include "mbed.h"
DigitalOut myled(LED1);
int main() {
printf("clock = %d\r\n",SystemCoreClock);
printf("mbed-os-rev: %d.%d.%d lib-rev: %d\r\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION, MBED_LIBRARY_VERSION);
while(1) {
myled = 1;
wait_ms(100);
//Thread::wait(100);
myled = 0;
wait_ms(100);
//Thread::wait(100);
}
}
clock = 96000000
mbed-os-rev: 5.9.1 lib-rev: 162
clock = 96000000
mbed-os-rev: 2.0.159 lib-rev: 159
[ ] Question
[ ] Enhancement
[x] Bug
ARM Internal Ref: MBOTRIAGE-1005
@ARMmbed/team-nxp Please review
@ARMmbed/mbed-os-hal Can you review, I see LPC1768 target defining us ticker - means it passing our tests.
@janfwesterkamp Thanks for reporting and extensive testing (running on multiple versions).
When I saw #7397, I repeated the test and measured the time with an oscilloscope. Nothing has changed, wait_ms(100) takes exactly 1 second with OS 5 and 0.1 second with OS 2.
Just posted a possible solution at #6407, related to older interface firmware revision, although I was only able to test with mbed-cli.
In that case, updating the lpc1768 interface firmware resolved the error in wait time without needing to reflash my code.
@janfwesterkamp Please test
Updating the firmware fixes the problem. Tested it with 3 different LPC1768, the online compiler and the latest revisions of OS 2 (169:a7c7b63) and OS 5 (0fdfcf735).
There should be firmware related documentation in the new OS 5 handbook.
Most helpful comment
Just posted a possible solution at #6407, related to older interface firmware revision, although I was only able to test with mbed-cli.
In that case, updating the lpc1768 interface firmware resolved the error in wait time without needing to reflash my code.