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 Reply Children
  • Hello,

    I suppose I didn't realize the need to select a timer for the timestamps. I had left the NRF_LOG_TIMESTAMP_DEFAULT_FREQUENCY as 0 to indicate that I wanted to use the app_timer frequency and figured that would be enough. How should I go about selecting a timer to use? 

    app_timer_cnt_get() is defined as follows in my code:

    uint32_t app_timer_cnt_get(void)
    {
        return drv_rtc_counter_get(&m_rtc_inst);
    }

    I built my project on top of the ble_app_hrs_nfc_pairing_pca10040_s132 example found in the SDK's experimental folder. We are pairing a mobile device to the nrf52832 and it is going much slower with our custom mobile app than with the nRF Connect mobile app. Essentially I was hoping to to add timestamps to our devices debug log in order to figure out what steps of our connection process are taking the longest and provide feedback to the app developers as to where to look to improve their connection speeds. 

Related