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

Duplicating same data when interval is long

Hello,

I'm writing codes which have 1 Hz sampling rates from ADC input below.

#define SAMPLE_LEVEL_MEAS_INTERVAL     APP_TIMER_TICKS(1000, APP_TIMER_PRESCALER)

Based on my observation, the sampling rates of ADC is correct but a problem is I'm receiving BLE data at around 15 ms, which means I receive 66 - 67 of same data before the data point is changed.

Does anyone have any idea why it happens?

Parents
  • Hi

    I assume that the data is sent during a connection, and not in advertising packets.

    This will happen for instance if the connection interval is set to 15 ms and you send the data on every connection event.

    While the peripheral can suggest what connection parameters to use, the final decision is made by the central. This means you do not have full control over the connection interval.

    It is totally fine to have a higher frequency for connection events than the frequency of the data to be transmitted (i.e. to have a smaller connection interval). One way to send the data is to use notifications. The way that works is that the central enables notifications for a specific characteristic. Every time the value changes the peripheral sends a notification with the new value on the next connection event. Notifications is covered in BLE Characteristics, a beginner's tutorial.

    Regards, Terje

Reply
  • Hi

    I assume that the data is sent during a connection, and not in advertising packets.

    This will happen for instance if the connection interval is set to 15 ms and you send the data on every connection event.

    While the peripheral can suggest what connection parameters to use, the final decision is made by the central. This means you do not have full control over the connection interval.

    It is totally fine to have a higher frequency for connection events than the frequency of the data to be transmitted (i.e. to have a smaller connection interval). One way to send the data is to use notifications. The way that works is that the central enables notifications for a specific characteristic. Every time the value changes the peripheral sends a notification with the new value on the next connection event. Notifications is covered in BLE Characteristics, a beginner's tutorial.

    Regards, Terje

Children
No Data
Related