RTC Time_helloWorld does't work in the latest update.

04 Oct 2018


The example at https://os.mbed.com/docs/v5.10/apis/rtc.html does not work in the latest os update.

When loaded in the online compiler it does work (i.e. produces the output it is supposed to produce). When the MBED_OS is subsequently updated the code doesn't behave correctly. I can't say anything about the set_time() but time(NULL) returns -1.

This is kind of annoying guys I have software for some network devices that was written and tested years ago ... now nothing works like it is supposed to.

A few days ago I had the same thing with a socket accept() function that was implemented in the way it was described in the manual, it didn't work until someone suggested to use the deprecated approach.

Can someone please suggest tools and/or an approach that at least does what it's supposed to do? How can I roll back to previous stable libs and os-es?


11 Oct 2018

Okay ... Seems like the latest update (5.10.1) fixed my problem RTC problem.


11 Oct 2018

Hi Koen,

We're glad that the example is now executing okay - is the same true for your application? Could you tell us what target you are using? We would like to replicate the failure on v5.10 if possible.

The Online Compiler lets you choose another OS/library/program version through the "Revision" button as shown in the picture below. If you first select "mbed-os" in the Program Workspace you can then switch to another version of Mbed. The same is true for a library or program that is under version control - you first select the entity in the Program Workspace and then use the Revision button to bring up the log.



Ralph, Team Mbed

12 Oct 2018

Hi Ralph,

Thanks for your reply, i've recorded this behaviour on an NXP LPC1768 MBED device. Like I said on the MBED OS release 5.10.

I'm sorry to say that porting my code from the project a few years back to mbed OS 5 is still in the phase where I'm opting to use Raspberry Pi Zero HW. Allthough, that means an extensive (and expensive redesign).

Sorry for that, I just keep encountering issues that aren't or are poorly documented or just don't work as expected. Latest encounter was my test implementation using TCPSocket. See: https://os.mbed.com/questions/82733/TCPSocket-clientclose-causes-hardware-fa/

BTW. I use MBED for education, i'm not a 10000+ units/year client.

Kind regards,

Koen. Koen

16 Oct 2018

Did you only change from OS 5.10.0 to 5.10.1 ? I work with FRDM K64F and changed some moments ago to 5.10.1 because the setting of RTC also did not work at 5.10.0, but no result. The bug is still present. Regards, Kevman

16 Oct 2018

Yes I only changed the OS release.


22 Oct 2018

Hi Kev,

Sorry - but we aren't able to replicate the problem on OS v5.10.1. Are you still not seeing the example work? If so - are you building with the Online Compiler or CLI ? OS v5.10.2 came out recently. You shouldn't need that but it's available if you want to try it as an alternative.

Are you sure that the board is getting programmed?

Do you have a good working program that you can use to verify that it isn't a board-level issue?


Ralph, Team Mbed

09 Feb 2019

I'm afraid its a bit more serious.

I do not know which files are used where now, however there are significant issues with the online compiler MBED-DEV OS2 where the MBED LPC1768 RTC no longer works, time returns -1, same as above.

I did ask this question here:


Edit...... The problem was in the targets.json file, Target LPC1768: "device_has": was missing "RTC". put that in and its now working.