This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

about system time

hello,

i am using sdk 16 with nrf52832 is it possible to print system time using nrf log?

thanks and regards 

manikandan v

Parents Reply Children
  • I agree with that this is not straight forward, depending on what you intend to use it for. 

    If you intend to use it only for logging, there is actually a built in module. You can see how it is set up in the example found in any of the examples that doesn't use NRF_LOG_INIT(NULL). As far as I can tell, that are these:

    /ble_central_and_peripheral/experimental/ble_app_att_mtu_throughput
    /ble_central_and_peripheral/experimental/ble_app_interactive/main.c
    /ble_peripheral/experimental/ble_app_cli
    /crypto/ifx_optiga_custom_example
    /peripheral/cli
    /peripheral/libuarte/main.c
    /peripheral/radio_test
    /peripheral/usbd_msc
    

    I would recommend checking out the peripheral\cli example, if any of these.

    Other than that, you can use the app_timer, and the function app_timer_cnt_get() to get the timestamp of the RTC (real time counter). This is not "synchronized with the world" as an RTC (Real Time Clock), as awneil said. 

    You would need to translate from the number of ticks to readable time, which depends on the RTC's prescaler. 

    Best regards,

    Edvin

Related