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

How to add timestamp in RTT viewer using NRF log module

Currently developing on NRF52 sdk12 with a terminal

In my source code i have nrf_log_init(null), and this allows me to print stuff to the RTT viewer.

Now I want to be able to show time stamp minutes:seconds:miliseconds on my RTT viewer, when I print my data out from the uC. I'm looking at the on the Nordic infocenter nRF Log Module , and it seems like that I have to initiate the time stamp function by passing a parameter in the init function below:

ret_code_t nrf_log_init	(	nrf_log_timestamp_func_t 	timestamp_func	)	

Currently, in my source code, I have this parameter set be NULL. So, what do I replace the NULL with in order to print out time stamp?

if someone could write out an example on how to use the timestamp function in NRF log module, then it would be great.

Thank you all for your time.

Parents
  • Hi Fordy,

    We need to clarify what kind of timestamp you are looking for here.

    Note that on the chip, there is no date time minute second etc. The chip doesn't know that. If you want to use timestamp_func, you need count your own time with a 32bit counter.

    If you want hour:minute:second in real normal time, then you need to do that on a PC. You record the timestamp when the log arrive. You can use telnet to do that as shown here and here.

  • terminal time stamp added by windows will not suffice in some cases, since windows threading granularity will not allow a finer resolutio as fine as 1 msec, but rather a resolution only as low as 10-15 msec. This will group several log lines to have the same time-tag, even though they were sent several msec apart.

Reply Children
No Data
Related