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

Connection Parameter Selection for Central Device with 10 Peripheral Simultaneous Connections

Hi,

I am developing both Central and Peripheral devices with nRF52840. For consistency, both are using SDK 15.3.0 and S140 V7.

I am able to connect to peripherals and negotiate MTU ATT size of 247 and I am able to negotiate 2 Mbps phy. Logging on both peripheral and central devices confirm this is working.

My challenge is getting notification data from my peripherals to my central. If I set up (for example) 2 peripherals to notify my central device every 500 mSec with approx 160 bytes of data, all data comes into the BLE event handler (BLE_GATTC_EVT_HVX) within my central device just fine. If I double the data speed on peripherals (ie. 160 bytes every 250 mSec from each of the 2 devices), I only get BLE_GATTC_EVT_HVX events notifying me of incoming data from the first peripheral only.

I believe that I am not getting correct connection service intervals setup after peripheral connection.

For a scenario where a central is talking to 10 peripherals and getting notification data from each every 250 mSec, what would good connection interval, slave latency values be? I cannot seem to find a good reference for setup of connection intervals for multiple simultaneous peripheral connections to a central device - where each peripheral is notifying the central independently.

Note that my connection event length is 6 x 1.25 mSec or 7.5 mSec. This should be plenty long enough to get an MTU of 247 bytes transferred.

I have been using default min and max connection intervals of 7.5 and 30 mSec respectively and a slave latency of 0 (for both central and peripheral devices).

Suggestions for my scenario would be much appreciated.

Thanks in advance,

Mark J

  • Hi ,

    Providing my full central and peripheral project code would be a bad idea as it would include a lot of code. I will create a new central and new peripheral project - each set up to run on the nrf52 DK (pca10056). These will include the same BLE calls and will be setup to show how changing connection event times, etc are influencing throughput and leading to missing packets. I will just cut and paste into these projects from my current code.

    How can I send this code to you? I could include a Google Drive link in a dev zone reply and simply remove the code from the linked Google folder after you have retrieved it. Is there a better way?

    Regards,

    Mark J

  • Hi ,

    I have just realized that I have 2 nRF52 DKs that are rev pca10040 and not pca10056, so I will setup projects for these DKs. I assume that you can get access to pca10040 DKs - so this selection should not be an issue.

    Regards,

    Mark J

  • Mark J said:
    I assume that you can get access to pca10040 DKs

     Yes I can. 

    Please note that the pca10040 DKs are not nRF52840. They are nRF52832. 

    You can upload .zip folders here. Just drag'n'drop to the text box that you are writing to here. Alternatively, you can use insert->image/video/file-> and press "upload"

    After a DevZone update this no longer looks like a button, so I understand that it is not trivial, but it is:

    What you can do is to zip the project folder that you are working on. If it was the ble_app_hrs example, just zip that folder. It contains the main.c file, and the sdk_config.h file. If you have some custom files, please include them there, and make sure that the project file is linked to them. That is, if you unzip your folder into an unmodified SDK, please check that it compiles, and behaves the way that it does in your original project. If not, it means that you have modified files outside this project folder, and I will not see the same as you do. 

    Best regards,

    Edvin

  • Hi ,

    I am still porting code to ble_app_uart (peripheral) and ble_app_uart_c (central) pca10040 projects (ie replacing the code in this projects that is setup for pca10040 with my code). I am about 2/3 finished and will have working projects that you can run on nrf52 Dev Kits tomorrow. 

    When moving my code to these test projects, I noticed something that might by an issue. I have been assuming that the data processed within my central when each BLE_GATTC_EVT_HVX  event occurs is a single packet with length of 243 bytes or less. 

    case BLE_GATTC_EVT_HVX:
    {
      // Setup reusable vars.
      ble_gattc_evt_t const * p_gatt_evt = &p_ble_evt->evt.gattc_evt;
    
      // Process p_gatt_evt->params.hvx.data with length p_gatt_evt->params.hvx.len
      // Assume that processing is for a single BLE packet with length < max MTU size.
    
      break;
    }

    I have assumed that there will be a BLE_GATTC_EVT_HVX event generated for each notification that I send. Today I noticed that the p_gatt_evt->params.hvx.len is a uint16_t. If, on my peripheral, I call sd_ble_gatts_hvx() twice in rapid succession, each time with a hvx_params.p_len of 240 bytes, can I get a SINGLE event at my central (BLE_GATTC_EVT_HVX) that has a length of 480? This could explain my issue as I am casting p_gatt_evt->params.hvx.len to a uint8_t assuming it would always be 240 bytes or less. I could be getting more than 1 packet in a single BLE_GATTC_EVT_HVX event with a p_gatt_evt->params.hvx.len that is greater than 255. When this happens, I would ignore the data beyond 255 bytes.

    Please advise if multiple received packets can be consolidated into a single BLE_GATTC_EVT_HVX event.

    Thanks,

    Mark J

  • I assumed it would generate the same number of events as the number of sd_ble_gatts_hvx(). But you should check the

    p_ble_evt->evt.gattc_evt.params.hvx.len

    I suppose it may be that they are merged if they originate from one notification. (a notification may be larger than the MTU, I think). 

    BR,

    Edvin

Related