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

Notification timing not correct.

Hello Devzone,

I've been working on a system to set notifications on time ready for transmission.

The client sends a WWR package to my peripheral and I want my peripheral to send a notification back in the same connection interval.

The client and peripheral both have a 7.5ms min and max connection interval.

To my knowledge a notification has to be set before the transmission moment occurs.

My approach is to have one free running timer captured as soon as I get the WWR message, I'll add that captured value with x (roughly 6ms in timer ticks) to a new compare register to create an event to set a notification ready for the next connection interval.

When the compare event strikes I do a sd_ble_gatts_hvx(....) and set my notification ready.

I've added a picture to help understand what I'm trying to achieve. 

The problem I'm having is that the notification is not send as I pictured here.

Instead the notification is set at the right time but instead of being transmitted in the following connection interval, it is being transmitted in the connection interval after the intended interval.

I've tried changing the time for when the notification is set ready for transmission but this either resulted in ERROR_NO_RESOURCES or in the same behavior.

When I change the WWR and notification time so it is transmitted every 15ms instead of 7.5ms I get the following behavior.

This is really bugging me and I cannot find what I'm doing wrong here.  

Can anyone help me with my struggles?

Kind regards

Related