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

Connection Interval

Hi everyone,

I'm new to working with Bluetooth/

My problem is that the connection interval time sent by the central device does not converge with the time I see using an oscilloscope or a configured timer for 1 ms.
The principle of operation of my program is that the peripheral device sleeps for a certain time and wakes up at a specified interval. The central device at this time is trying to connect to it. Using the timer, I count the time from when the device woke up to the time of the BLE_GAP_EVT_CONNECTED event and to the time of the BLE_GAP_EVT_CONN_PARAM_UPDATE event. The time difference between these events is about 600 ms. I can not understand why such a difference in time. Maybe I did not correctly understand the meaning of the parameters MIN_CONN_INTERVAL and MAX_CONN_INTERVAL? If so, then how can you reduce the time for a full connection, so that the BLE_GAP_EVT_CONN_PARAM_UPDATE event occurs as soon as possible.

To check what the actual value is transmitted by the central device, you can make a breakpoint during the execution of the program at the time of the BLE_GAP_EVT_CONN_PARAM_UPDATE event, which I actually did.

According to the received data, the central device set the value of the maximum and minimum interval of 7.5 ms.In the peripheral device, I have the following parameters:

MIN_CONN_INTERVAL    MSEC_TO_UNITS (7.5, UNIT_1_25_MS)

MAX_CONN_INTERVAL   MSEC_TO_UNITS (30, UNIT_1_25_MS)

SLAVE_LATENCY            1

CONN_SUP_TIMEOUT   MSEC_TO_UNITS (250, UNIT_10_MS)

I also read that the connection interval can vary from 7.5 ms to 4 s, maybe this value is the connection interval for my central device?

Chip: BT840F (analog nRF52840);

SDK: nRF5_SDK_15.2.0;

Softdevice: s132_nrf52_6.1.0_softdevice;

Phone: Xiaomi Redmi 5+.

Thanks in advance for your help.

Parents
  • What source code did you use? Was it one of the SDK example projects, in that case which one? This way I can try to recreate the problem.

    Best regards,

    Simon

  • Hi

    About the logs. If I understand you correctly, on the side of the smartphone I am not getting at the moment. Only in the manner described above, I get a report.

    "Also, why are you waiting to transfer data until you get the last conn_params_update event? That shouldn't be necessary."

    The last event I do not expect. As soon as I get to the BLE_GAP_EVT_CONN_PARAM_UPDATE event, I immediately start the data transfer. Due to the fact that for the first time the time interval parameters are set to 7.5 ms, the data does not come to the phone. Only with the following parameters data is received.

    About time_conn [0-3]. I set up a timer at 1 ms intervals and start it when the peripheral device wakes up.

Reply
  • Hi

    About the logs. If I understand you correctly, on the side of the smartphone I am not getting at the moment. Only in the manner described above, I get a report.

    "Also, why are you waiting to transfer data until you get the last conn_params_update event? That shouldn't be necessary."

    The last event I do not expect. As soon as I get to the BLE_GAP_EVT_CONN_PARAM_UPDATE event, I immediately start the data transfer. Due to the fact that for the first time the time interval parameters are set to 7.5 ms, the data does not come to the phone. Only with the following parameters data is received.

    About time_conn [0-3]. I set up a timer at 1 ms intervals and start it when the peripheral device wakes up.

Children
  • Can you try to start sending data immediately after ble_evt_connected? You will likely get NRF_ERROR_INVALID_STATE in the beginning, but just keep trying until you get NRF_SUCCESS. This means that notifications aren't enabled, or that ATT_MTU exchange is running. It should not be necessary to wait until conns_params_update to send data.

    Filya said:
    Only with the following parameters data is received.

     What following parameters are you referring to?
    Yes, the time_conn are timers, but where in your code have you defined them/their values?

    Best regards,

    Simon

Related