1 year, 7 months ago.

Wait() function is too long in offline compiler, but works in online compiler

Hello,

I am working on mbed LPC1768. I am just flashing a LED every 0.5 s and the code is this:

  1. include "mbed.h"

DigitalOut myled(LED1); Serial pc(USBTX, USBRX); tx, rx

int main() { while(1) { myled = 1; wait(0.5); myled = 0; wait(0.5); } }

When compiled using the online compiler everything works out as it should. However, when the offline compiler (GCC_ARM) is used, the wait function last for 5 seconds (It is always a factor 10 higher than intended). It is still able to print out on the screen using UART, and the clock is still 96 MHz when printed out. A friend of mine have also compiled the code for me using ARM and ARMC6, but the issue is still the same when I flash the .bin file on the board. Any suggestions to how to solve this issue?

1 Answer

1 year, 7 months ago.

Hello Tobias,

The info at the link below could help:

https://os.mbed.com/questions/78806/LPC1768-MBED-OS-5-wait_ms/

Accepted Answer