Fetching timestamp for 200Hz data points

Hello!

I am using nRF52DK and the nRF Connect SDK with Zephyr to create my custom application. For one part, I am recording IMU values at a frequency of up to 200 Hz and loading them into a circular buffer which then gets offloaded via BLE to my central device over several packets. I am having some packet loss and I want to make sure I know exactly the order and time the data got recorded, so I want to implement a timestamp, only to be retrieved for a few minutes every hour. My application has a low power requirement (<2mA), and I'm wondering the best way to approach fetching the date/time in UNIX. I tried using the Nordic date/time library but kept getting compilation errors whenever I added CONFIG_DATE_TIME=y to my prj.conf, so I don't know if I'm implementing it correctly.

Any help would be really appreciated!

Parents
  • Hi 

    I did something similar for a hobby project of mine. I basically wanted to use the standard time.h library, and it seemed to work fine. I read the time here, and you can see my config here. Whenever I want to set the local time I do it like this
    Maybe you could try something similar? 

    As for losing data, it seems odd that you would lose data if you only sample at 200Hz. Potentially there is some room for improvement in your Bluetooth configuration, in order to ensure you get sufficient throughput. 

    Best regards
    Torbjørn

  • Thank you  so much for your insight! I agree about the lost data and I'm hoping that the timestamps will add some clarity. I am sending ADC values separately within the same project, so I suspect there might be some timing issue. As for using the time.h library, thanks for your suggestion -- I will give this a try. A quick question as a novice in fetching "local time" values: how exactly does this work? Does my peripheral need access to an internet connection to access a server, or is it just utilizing the built-in oscillator? Does the local time need to be set each time at boot-up?

    Thanks again!

  • Hi 

    It is just using the LF clock to keep track of time, so you will need to set the time after every boot, yes. The goal with my own project is to have a mobile app that automatically sends an accurate timestamp, but I haven't had time to implement it yet...

    Best regards
    Torbjørn

Reply Children
No Data
Related