This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

central multilink example not building

Hi, All

I am trying the example here ...ncs\v1.9.1\zephyr\samples\bluetooth\central_multilink\ with nRF52833dk_nrf52833 board, however it doesn't build, and saying the  maximum conn number is outside of the valid range of [1. 20]. 

What is the range of CONFIG_BT_MAX_CONN? another example says 20, but why this one set it to 62?

Another question, when a central is connected to some peripherals,  is it still able to do scanning?

Thanks you!

Ping

Parents
  • Hello, Simon

    I am revisit the example here, and would like to ask a question, in call back function connected show below, I wonder why conn_connecting is set to NULL even there is no failure on connection, I am thinking of calling disconnect function to disconnect it if I need to, but if it is set to NULL, then, it is not possible, right? Also, may I create multiple connection reference variables like conn_connecting ? as I need to create multiple connections same time and freely disconnect them any time.

     

    static void connected(struct bt_conn *conn, uint8_t reason)
    {
    	char addr[BT_ADDR_LE_STR_LEN];
    
    	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
    
    	if (reason) {
    		printk("Failed to connect to %s (%u)\n", addr, reason);
    
    		bt_conn_unref(conn_connecting);
    		conn_connecting = NULL;
    
    		start_scan();
    		return;
    	}
    
    	conn_connecting = NULL;  //why set the conn_connectign to NULL here? how can I disconnect it?
    
    	conn_count++;
    	if (conn_count < CONFIG_BT_MAX_CONN) {
    		start_scan();
    	}
    
    	printk("Connected (%u): %s\n", conn_count, addr);

    Last question - don't think the following code in init_central() function in while (true) {} loop is ever be called, I wonder how does the program disconnect the connected multiple devices.

    		iterations--;
    		printk("Iterations remaining: %u\n", iterations);
    
    		printk("Disconnecting all...\n");
    		is_disconnecting = true;
    		bt_conn_foreach(BT_CONN_TYPE_LE, disconnect, NULL);

    Could you please explain a little bit? I am trying to connect second device without setting the first conn_connecting NULL, and it gave me an error code of -12, seems meaning ENOMEM - not enough core, does this mean it has run out of memory? It only had 1 connection.

    Thank you for your attention.

    Ping

Reply
  • Hello, Simon

    I am revisit the example here, and would like to ask a question, in call back function connected show below, I wonder why conn_connecting is set to NULL even there is no failure on connection, I am thinking of calling disconnect function to disconnect it if I need to, but if it is set to NULL, then, it is not possible, right? Also, may I create multiple connection reference variables like conn_connecting ? as I need to create multiple connections same time and freely disconnect them any time.

     

    static void connected(struct bt_conn *conn, uint8_t reason)
    {
    	char addr[BT_ADDR_LE_STR_LEN];
    
    	bt_addr_le_to_str(bt_conn_get_dst(conn), addr, sizeof(addr));
    
    	if (reason) {
    		printk("Failed to connect to %s (%u)\n", addr, reason);
    
    		bt_conn_unref(conn_connecting);
    		conn_connecting = NULL;
    
    		start_scan();
    		return;
    	}
    
    	conn_connecting = NULL;  //why set the conn_connectign to NULL here? how can I disconnect it?
    
    	conn_count++;
    	if (conn_count < CONFIG_BT_MAX_CONN) {
    		start_scan();
    	}
    
    	printk("Connected (%u): %s\n", conn_count, addr);

    Last question - don't think the following code in init_central() function in while (true) {} loop is ever be called, I wonder how does the program disconnect the connected multiple devices.

    		iterations--;
    		printk("Iterations remaining: %u\n", iterations);
    
    		printk("Disconnecting all...\n");
    		is_disconnecting = true;
    		bt_conn_foreach(BT_CONN_TYPE_LE, disconnect, NULL);

    Could you please explain a little bit? I am trying to connect second device without setting the first conn_connecting NULL, and it gave me an error code of -12, seems meaning ENOMEM - not enough core, does this mean it has run out of memory? It only had 1 connection.

    Thank you for your attention.

    Ping

Children
No Data
Related