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

Maximum period for non interruptible measurement with NRF51 and S110

I am developing a hand-arm vibration sensor for read-out via BLE

Development platform NRF51822 and S110

I'd like advice on how to configure the softdevice and the two wire bus to enable periodic measurements at a 1ms time interval

The application requires a sequence of measurements at fixed 1ms repeat interval over a duration of a few seconds.  Each measurement requires a read over the two wire bus

I want to synchronize the two wire read with the softdevice operations so both play nicely together

The S110 v2 softdevice manual shows examples of timeslot usage (Page 25 sect 9.7.1 Fig 7

 )

https://infocenter.nordicsemi.com/topic/struct_nrf51/struct/s110.html?cp=4_7_0

How can I sequence timeslots at regular intervals?

How do I ensure that the read of the two wire bus occurs within the period of the timeslot?

What is the maximum length of slot?

What is the best way to hibernate softdevice operations for a period of ~1-2s?

Many thanks for any guidance.  Most helpful would be any steers on how to adapt the two wire and HRM BLE examples in the SDK.

Cheers

Rob

 

Parents
  • Hi northernLight,

    Good questions

    How can I sequence timeslots at regular intervals?

    The radio scheduler is simple in that perspective. It can only answer the application if it can grant one future request (one shot request). It does not support a request to grant you timeslot at regular intervals as that would be unfair to a higher priority situation popping up in conflict with your already approved timeslot (if it allows application to do one request for multiple timeslots)

    So in short, the application has to figure out a way (using timer) to request the timeslot every 1ms and sees if the radio scheduler approves it. If it is approved you start the TWI transaction, else you lost that timeslot. There is no way to guarantee an application that it will be approved a timeslot every 1ms as BLE traffic is higher priority than the app and there is no bypassing that priority.

    How do I ensure that the read of the two wire bus occurs within the period of the timeslot?

    Ah, so you are using nRF51, without the EasyDMA (which is in nRF52 devices), it is hard to guarantee that you will have your multi word transaction complete within 1ms. This is because the transaction involves CPU to read and write data and CPU time, like you know, cannot be taken as granted resource in applications running on lower priority. You can configure the TWI driver to run on APP_PRIORITY_HIGH, which will improve things timing wise, but still far from guarenteeing that the transaction would be complete within 1ms.

     

    What is the maximum length of slot?

    nrf_soc.h should tell you the minimum and maximum time that goes to request function. I think the minimum is 100us and the maximum is 100 ms

    What is the best way to hibernate softdevice operations for a period of ~1-2s?

    In BLE even if there is no data being transferred in a connection, the empty packets are being transfered to the peer to keep the connection alive. If you want total BLE silence for about 1 to 2 s, then you need to disconnect the devices or use a maximum connection interval with a big slave latency so that the empty packets are not transferred for that time and the connection is still alive. This will come with a negative effect that when you want to send your sensor data, that data throughput will also be really low.

  • Susheel,

    Thankyou for providing such a detailed and clear reply.  It has really helped me understand the capabilities of the softdevice and how best to develop my design.  Two questions:

    What API parameter controls the slave latency?

    For example how should I modify the HRM example to investigate the effect of using a long time between updates of the read-out?

    Cheers

    Rob

Reply Children
No Data
Related