Calculate date and time with nRF52832

I want to calculate date and time like a real-time clock with nRF52832, but are there any sample sources?

Third-party sources are fine.

  • Hello,

    Did you plan on using the nRF5 SDK or NCS? I see that you have some previous questions on LE Audio, which would be NCS, so I assume you want to go on with that? Let me know either way.

    The reason I ask is that we have something that could work for the old nRF5 SDK. It is a sample written by a colleague of mine, called the "nRF Calendar".

    Note that it is not an official sample, but perhaps something you can use as a starting point. As mentioned, it is written for the nRF5 SDK, but perhaps you can extract something from there. 

    Then there is a sample in NCS found in:

    ncs\nrf\samples\bluetooth\peripheral_cts_client,

    There is an equivalent found in

    nRF5 SDK\examples\ble_peripheral\ble_app_cts_c.

    What this sample does is that when it connects to a phone, it uses one of the standard Bluetooth services that the phone possesses, the Current Time Service, to fetch the current time. Perhaps you can use this to set the time, and the implementation from the nRF Calendar example to keep track of time from there.

    Best regards,

    Edvin

  • I am thinking of using this in a module that has nRF52832 implemented for a different project than LE-Audio.

    A 32.768kHz clock is implemented.

    I would like to create a function that can manage the date and time with a real-time clock in an environment that does not use ncs.

    Is there a sample source?

  • I see that you are using the nRF52832, which doesn't support LE audio, but I wanted to know whether you intended to use NCS or the nRF5 SDK. But then I take it you are using the nRF5 SDK?

    In that case, as I mentioned, the nRF Calendar (link in my previous reply), and the ble_app_cts_c example from the nRF5 SDK are two relevant examples. nRF Calendar to keep track of time, and the cts_c sample you can add to it if you want to fetch the time if you connect to a mobile phone. 

    Best regards,

    Edvin

Related