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

Log Timestamp issues NRF52

Hello!

Recently I was asked to find a way to enable timestamps in our debug logs to make it easier to track performance during various stages of the operation of our device.

I found a few blog posts detailing the process and saw that you have to enable NRF_LOG_USES_TIMESTAMP in the sdk_config.h file. I enabled that, expecting that to be the end and now when I start up my debug session the device hardfaults and doesn't run the program. 

Doing a little more digging I found the following blog post https://devzone.nordicsemi.com/f/nordic-q-a/43701/logging-with-timestamp-on-sdk-15-2. It instructs the questioner to enable NRF_LOG_USES_TIMESTAMP, as I did, and then NRF_LOG_INIT(app_timer_cnt_get), which I changed my code to run. Unfortunately this didn't fix the hardfaulting issue. 

 

As soon as I set NRF_LOG_USES_TIMESTAMP to 0 as it was before my program runs as expected. What step am I missing to enable the timestamp?

For reference

I am on SDK version 17.0.2

my chip is an nrf52832

I am developing using Segger Embedded studio and hope to be seeing the timestamps in it's built in terminal. 

Thanks in advance, please let me know if you need any additional information.

Parents
  • Hi again

    That seems to be correct as well, can you check what this define is set to in your sdk_config.h file as well NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED. If it's set to 0, try setting it to 1 to enable the Timestamp format when logging. Also, make sure the nrf_cli.c and .h files are included in your project.

    If that doesn't help either, try to debug to find the reason for this hardfault. You can use the ble_app_att_mtu_throughput or ble_app_cli applications as reference, as they already support logging with timestamps.

    Best regards,

    Simon

Reply
  • Hi again

    That seems to be correct as well, can you check what this define is set to in your sdk_config.h file as well NRF_LOG_STR_FORMATTER_TIMESTAMP_FORMAT_ENABLED. If it's set to 0, try setting it to 1 to enable the Timestamp format when logging. Also, make sure the nrf_cli.c and .h files are included in your project.

    If that doesn't help either, try to debug to find the reason for this hardfault. You can use the ble_app_att_mtu_throughput or ble_app_cli applications as reference, as they already support logging with timestamps.

    Best regards,

    Simon

Children
No Data
Related