Distance measurement synchronization via GATT notification?

Hello, I am trying to use the distance measurement library (in NCS 2.8.0 using nrf52833), but instead of using "scanned" events for synchronization I would like to trigger the measurement from inside an connection by sending a GATT write and a notification.

The idea is that the initiator sends a GATT write to a peripheral, which then starts the DM in reflector role and sends a notification back to the initiator which would use this event to start DM in initiator role. Unfortunately the devices don't seem to be able to synchronize this way ("nrf_dm: dm_thread: Ranging failed (nrf_dm status: 1)").

My first question is, is this approach even feasible?

Can DM be done with an active connection?

If not, can you suggest other synchronization methods over BLE other than using scan events? Could disconnection events be used?

Thank you

Parents
  • Hi Bruno,

    That should be possible, but we have limited support on this. But there have been questions about this in the past.

    If not, can you suggest other synchronization methods over BLE other than using scan events? Could disconnection events be used?

    Using radio notifications for syncing is an idea. 

    I believe the nrf_dm sample allows you to connect to the GATT Direction and Distance Finding Service. Once connected, advertising and scanning are still active and used for synchronization. Maybe you can use this.

    Regards,

    Elfving

  • Hello, i have tried to use GATT notifications and analyzed the DM timing with the GPIOs. The main problem is that in a connection, all data is exchanged within the connection interval (7.5ms minimum). So notifications usually arrive within a delay of ~7ms. If i adapt CONFIG_DM_INITIATOR_DELAY_US=-7000 it sometimes works, but not reliably since sometimes it takes even longer for the notification to arrive. So I conclude that due to the latency within a connection, it is not feasible to use GATT read/write or notifications as a synchronization point.

    What is the idea of using radio notifications for syncing? The radio notifications would come before each connection interval, so what's the point? Please explain. (also the link is broken).

    Using advertising and scanning for synchronization is ok for a demo but not very useful for a product in my opinion. We need peripherals to consume as little power as possible, and not do any scanning as that is very energy demanding. So as mentioned in the other ticket, we can remove the scanning part in peripherals (I have also tested that) but then that would mean that it would start DM on any "scan" request, and in a real situation scan requests can happen any time from any device, and not only from DM capable NRF devices.

Reply
  • Hello, i have tried to use GATT notifications and analyzed the DM timing with the GPIOs. The main problem is that in a connection, all data is exchanged within the connection interval (7.5ms minimum). So notifications usually arrive within a delay of ~7ms. If i adapt CONFIG_DM_INITIATOR_DELAY_US=-7000 it sometimes works, but not reliably since sometimes it takes even longer for the notification to arrive. So I conclude that due to the latency within a connection, it is not feasible to use GATT read/write or notifications as a synchronization point.

    What is the idea of using radio notifications for syncing? The radio notifications would come before each connection interval, so what's the point? Please explain. (also the link is broken).

    Using advertising and scanning for synchronization is ok for a demo but not very useful for a product in my opinion. We need peripherals to consume as little power as possible, and not do any scanning as that is very energy demanding. So as mentioned in the other ticket, we can remove the scanning part in peripherals (I have also tested that) but then that would mean that it would start DM on any "scan" request, and in a real situation scan requests can happen any time from any device, and not only from DM capable NRF devices.

Children
Related