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

Measure and retrieve time data using Nordic Thingy:52

Hi all,

I am building a demo for Bluetooth mesh networking with thingy. I had followed the instructions under this link:

https://github.com/NordicPlayground/thingy52-mesh-provisioning-demo

for the provisioning of devices in a mesh network. 

With nRFgo Studio, I have managed to reprogram the firmware of my thingy with a J-Link interface.

Thingy is excellent with many sensors for environmental or orientation data. Does it measure the time it has taken for the communication? I would like to test for the performance (in terms of latency and RTT) of thingies in a mesh network. Hence, I am looking for ways to

  1. measure and record the period (time) from when the message is sent from client (sender) to when the ACK is received by the server (receiver) in the mesh network
  2. retrieve and save these data for further processing and tabulating later

I had tried to look inside light_switch_proxy_server_nrf52832_xxAA_s132_6_0_0.emProject . I am thinking about using the function clock() from time.h to get the difference of the t_start and t_stop as the measured latency / period. But, to no avail.

I would appreciate any help and insights. Besides, thank you so much for your concern and time.

Best regards,

  • Hi Boon, 

    We have both timer and app_timer libraries in mesh application. You can use either of them. 

    You can also use one of our "hack" is to use the RTC0 counter directly as we have inside GPIOTE_IRQHandler(): 

       if( TIMER_DIFF(m_last_button_press, NRF_RTC0->COUNTER) > HAL_BUTTON_PRESS_FREQUENCY)

    You can start the timer when you start sending the reliable message and then catch the status update in client_status_cb() to get the time it take for one round trip communication. 

  • Hi Hung Bui! Thank you so much for your tips! Have a great Christmas holidays!

  • Hi Hung Bui,

    Firstly, Happy New Year!

    I have a short question. so with (*NRF_RTC0).COUNTER I could get the timestamp when the button is pressed, which is the time when the client send a message:

    t_start = NRF_RTC0->COUNTER;

    And then in the client_status_cb() I can get the timestamp when the acknowledgement from server to client telling that the message is received:

    __LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, "server status received \n");

    t_stop = clock();

    period = t_stop - t_start;

    switch (status)

    ...

    So the period that I acquired can be passed to e.g. RP3 to acquire the RTT, am I right?

    Best regards,

Related