RTC source for log module timestamp

Hi all,

I'm doing some tests with the nRF5340 DK to log with a custom timestamp source. I took the logging exercise 2 example and verified that the log messages are correctly printed with the timestamp associated with the internal clock. However, for my application, I would like to use an RTC as a log timestamp source and have it formatted automatically in the log messages. Based on the exercise, this could be possible since "the logger gets the timestamp by internally calling the kernel function k_cycle_get_32(). This routine returns the current time since bootup (uptime), as measured by the system’s hardware clock. You could change this to return an actual time and date if an external Real-time clock is present on the system". And also, some logging-related functions should help me format the timestamp as I wish.

Given these, I have some questions:

  • Do I have any limitations on what RTC I can use? This is a test, but I'll be using BLE in my real application, and I read that some issues might limit what RTCs are available. 
  • Are there any updated examples of configuring an RTC as a log timestamp source? I'm not able to find any related examples or examples that are not outdated since I'm using the Nordic SDK 2.6.0.
  • Will I be able to use the Message formatting options included in the include/zephyr/logging/log_output.h to format this custom timestamp? 
    Thank you in advance for any help!

Parents Reply Children
Related