Use Multi-NUS in one central device to get two peripheral's data

Hi,

I have used the sample given in blog , however, my purpose is to get data from two device "IMU1" and "IMU2", using callback "static uint8_t ble_data_received " to print out, I am using the coded_phy in NCS 2.91 with nRF21540 DK to be the central device.

My main.c is 

My config is:

The result is

I cannot even get IMU1 data, I have test in anther central device code served for one peripheral, it works well, the code is:

Could you please help me get data form 2 nus peripheral with coded_phy? Thank you so much!

  • Hi Zhou, 
    Have you make sure you handle each connection with correct bt_conn conn id ? 
    From what I can see here you are assigning them to the same pointer: default_conn

    Each connection should be assigned to a different "conn", so that you can use them later on. Or you can compare them with the "conn" in each of the BLE event. 

    Please try to test with one single peripheral and make sure it works fine before testing with 2 peripherals.