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

BLE data write delay

FormerMember
FormerMember

Hello, all

I have a problem with ble data exchanging.

I have programmed an application which controls servo motors through phone application.

At the connection, ble data is sent immediately by clicking phone app button,

but the problem is that it lasts only few seconds.

After 3~4 sec, data exchanging has a delay and operates like a queue.


please watch this link.

As you can see, data exchange has delay 3~4 sec later and it operates past event even I don't click app button.


So I found solution but it also has another problem.

I set CONN_SUP_TIMEOUT to MSEC_TO_UNITS(10000, UNIT_10_MS) from MSEC_TO_UNITS(4000, UNIT_10_MS)

data exchanging has no delay permanently, but after 1~2 minute the connection is disconnected.


Here is the link.

Unlike first video, there is no delay but after 1-2 minute the connection is lost.


I also changed value of MIN_CONN_INTERVAL and MAX_CONN_INTERVAL, but the result has delay or disconnection event.

How do I exchange ble data without delay and diconnection event?

Parents
  • FormerMember
    0 FormerMember

    I find how to fix it.

    The problem is MAX_CONN_PARAMS_UPDATE_COUNT.

    MAX_CONN_PARAMS_UPDATE_COUNT is basically set to 3

    and NEXT_CONN_PARAMS_UPDATE_DELAY is set to 30.

    So after about 1m 30s, the ble_conn_params timeout event call on_conn_params_evt() and operate sd_ble_gap_disconnect().

    The solution is that set sd_ble_gap_disconnect() comment or remove in on_conn_params_evt().

    But I dont understand why it wasnt disconnceted if I set MIN_CONN_INTERVAL to 450, MAX_CONN_INTERVAL to 550 and CONN_SUP_TIMEOUT to 4000. It should be disconnected after 1m 30s technically but woldnt, only make delay and operate past data.

    Now I set MIN_CONN_INTERVAL, MAX_CONN_INTERVAL and CONN_SUP_TIMEOUT to whatever I want, I dont get delay and disconnection.

  • @TY: If you have a look at the trace, you can find that the peripheral sent a connection parameter update request 5 seconds after the connection. This is due to the FIRST_CONN_PARAMS_UPDATE_DELAY is set to 5 seconds in the application.

    In this case the phone accepted the request and change the connection interval to 650ms. This explains why you see it's slower to send write request as you captured in your clips.

    So it's due to the longer connection interval.

    I would need to see the trace when the connection terminated after 1m30s to besure why, but most likely it was because the phone reject the connection parameter request and then the connection parameter negotiation module on the nRF5 tried 3 times and then gave up and did a disconnection, as you found in the code.

    My suggestion is to find the connection max and min interval that the phone will accept. (if you request too low connection interval, the phone will reject that).

Reply
  • @TY: If you have a look at the trace, you can find that the peripheral sent a connection parameter update request 5 seconds after the connection. This is due to the FIRST_CONN_PARAMS_UPDATE_DELAY is set to 5 seconds in the application.

    In this case the phone accepted the request and change the connection interval to 650ms. This explains why you see it's slower to send write request as you captured in your clips.

    So it's due to the longer connection interval.

    I would need to see the trace when the connection terminated after 1m30s to besure why, but most likely it was because the phone reject the connection parameter request and then the connection parameter negotiation module on the nRF5 tried 3 times and then gave up and did a disconnection, as you found in the code.

    My suggestion is to find the connection max and min interval that the phone will accept. (if you request too low connection interval, the phone will reject that).

Children
No Data
Related