Simultanious data reading from connected devices to central.

Hi,

I am working in Nrf52832, Zephyr as central for connecting multiple peripheral devics. I want to read the multiple devices data at a same time. I am using common discovery function for all devices. And I use delayed work queue for conntion update. Give some instruction for simultanous data reading?

Athulya

Parents
  • Hi Athulya,

    You will not be able to read data at the exact same time, but it is for instance possible for a central to be connected to multiple peripheral devices at the same time, and read a characteristic from each, one after another (within the limitations of having to wait for a connection event on each of the links). In practice, you would just read from each one, and the stack would handle the details for you.

    Perhaps you can elaborate a bit on what you are doing, what you want to do, and in what way you are having problems with it?

    Einar

  • Hi

    Thank you for your response. Any sample code formultiple data reading?  Here I give scaning and connection parameters.

    struct bt_le_scan_param scan_param = {
          .type = BT_LE_SCAN_TYPE_ACTIVE,
          .options = BT_HCI_LE_SCAN_FILTER_DUP_DISABLE,
          .interval = SCAN_INTERVAL,
          .window = SCAN_WINDOW,
      };
      
      struct bt_conn_le_create_param create_param = {
    		.options = BT_CONN_LE_OPT_NONE,
    		.interval = INIT_INTERVAL,
    		.window = INIT_WINDOW,
    		.interval_coded = 0,
    		.window_coded = 0,
    		.timeout = 0,
    	};
    	struct bt_le_conn_param conn_param = {
    		.interval_min = CONN_INTERVAL,
    		.interval_max = CONN_INTERVAL,
    		.latency = CONN_LATENCY,
    		.timeout = CONN_TIMEOUT,
    	};

  • Looking at this briefly it does not look like you are trying to make more than one connection? Perhaps I misunderstood what you want to do. Can you elaborate on what you want to do, what you are implementing it the way you are, and in what way it is not working?

  • I try to make more than one connection and I want to data from each connected devices simultaneously. But Now I get result like this.

    But actually I want both the data are simultaneously.

  • What do you mean by simultaniously? There is only one radio, and one CPU, so it canot happen at exactly the same time. And the BLE connections will have connection events, and the communication with every peer has to start at that event. So there is no way to get this done exactly at the same time.

    But it is possible to be connected at multiple peripherals at the same time, which I see from the code and the log here that you are not. For that, I suggest you take a look at the multilink central sample that I linked to. Essentially, when connected, just start scanning again and you can be connected to multiple peripherals at once (provided the connection parameters have enough slack,  you configure support for more peripherals as in the sample, and you handel it (as in the sample).

  • How to work multiple notification in central side 

    Athulya

  • Hi,

    I am looking more at your code now, and I see I was too quick earlier. You do connect to multiple devices, and from what I can see, you subscribe from notifications from all of them. And from the printout from earlier I see you also get notifications from at least two of them (that is all that log shows).

    I do not see the source of all the lines in the log in the code, so it has probably evolved a bit, but form what I can see it does not seem like you disconnect o stop subscribing to notifications on the first when you connect to the second, so I would expect you to still get notifications from the first when connected to the second. Does that noe happen? And is that the case? If so, can you check that there is no disconnect?

Reply
  • Hi,

    I am looking more at your code now, and I see I was too quick earlier. You do connect to multiple devices, and from what I can see, you subscribe from notifications from all of them. And from the printout from earlier I see you also get notifications from at least two of them (that is all that log shows).

    I do not see the source of all the lines in the log in the code, so it has probably evolved a bit, but form what I can see it does not seem like you disconnect o stop subscribing to notifications on the first when you connect to the second, so I would expect you to still get notifications from the first when connected to the second. Does that noe happen? And is that the case? If so, can you check that there is no disconnect?

Children
No Data
Related