Mbed-os: wait taking 10x longer on LPC 1768

Created on 30 Jun 2018  路  6Comments  路  Source: ARMmbed/mbed-os

Description

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:

  • 03196b2 (5.9.1)
  • 35fa909 (5.8.6)
  • c9e63f1 (5.5.1)

Test program

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

Terminal output of failed test with OS 5

clock = 96000000
mbed-os-rev: 5.9.1 lib-rev: 162

Terminal output of successful test with OS 2

clock = 96000000
mbed-os-rev: 2.0.159 lib-rev: 159

Issue request type

[ ] Question
[ ] Enhancement
[x] Bug

closed_in_jira nxp mirrored bug

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.

All 6 comments

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.

Was this page helpful?
0 / 5 - 0 ratings