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

Proxy connexion time

Hi everyone,

I use the nrf5_SDK_for_Mesh_v4.1.0_src, I would like to reduce the time it takes for a device to connect to a bluetooth module as a proxy. For the moment this delay is minimum 5 seconds and sometimes the connection is so slow that it takes more than 20 seconds for me to connect.

I tried to modify the MIN_CONN_INTERVAL parameters.
and MAX_CONN_INTERVAL but it doesn't change much.
My goal would be to be able to connect to a proxy service in maximum 2 seconds! Is it possible?
What do I have to change in the code to do so?

Could someone please help me on this?

Parents Reply Children
  • Hi, 

    Is it technicaly possible to have a connection time below 2 seconds? 

    On the advertising interval and connection interval, i never changed anything! i left the default values.

    Please let me know! 

    Thank you

  • Yes. It is possible. but it depends on the advertising interval.

     

    Soter Giga said:
    On the advertising interval and connection interval, i never changed anything! i left the default values.

     What are those? What example did you start with?

    How is it going with that sniffer trace?

  • i used the light switch example! 

    Values are : 

    /** Minimum acceptable connection interval. */
    #ifndef MIN_CONN_INTERVAL
    #define MIN_CONN_INTERVAL               MSEC_TO_UNITS(150,  UNIT_1_25_MS)  
    #endif
    
    /** Maximum acceptable connection interval. */
    #ifndef MAX_CONN_INTERVAL
    #define MAX_CONN_INTERVAL               MSEC_TO_UNITS(250,  UNIT_1_25_MS)  
    #endif
    

    Is those values right?

    I didn't use the sniffer yet

  • Soter Giga said:
    Is those values right?

     Where are those defines used in your project? 

    The peripheral doesn't really decide the connection interval. The peripheral can request an interval, but the central decides in the end. A sniffer trace will reveal what sniffer trace you actually have.

  • I have the same issue and since this did not have a posted solution I figured that i would jump in.

    I setup the sniffer and applied a MAC filter and an empty PDU filter. Below is a screenshot of a time when it took more than 16 seconds to connect. It appears that the device is advertising fairly often and some devices are requesting the scan response, but it appears that when the device trying to make a proxy connection finds it, the connection is made very quickly.

    No.	Time	Source	PHY	Protocol	Length	Delta time (µs end to start)	SN	NESN	More Data	Event counter	Info
    18981	10061.463	fb:23:fb:c2:7c:9b	LE 1M	LE LL	12	150µs				0	SCAN_REQ
    18982	10061.464	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    18983	10061.464	df:a8:66:b5:51:c9	LE 1M	LE LL	26	301µs				0	ADV_IND
    18984	10061.465	df:a8:66:b5:51:c9	LE 1M	LE LL	26	498µs				0	ADV_IND
    18985	10061.466	6e:e3:45:3f:b4:30	LE 1M	LE LL	12	147µs				0	SCAN_REQ
    18986	10061.466	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    18987	10063.467	df:a8:66:b5:51:c9	LE 1M	LE LL	26	2000446µs				0	ADV_IND
    18988	10063.467	c3:dd:20:1e:4c:9b	LE 1M	LE LL	12	151µs				0	SCAN_REQ
    18989	10063.468	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    18990	10063.468	df:a8:66:b5:51:c9	LE 1M	LE LL	26	301µs				0	ADV_IND
    18991	10065.473	df:a8:66:b5:51:c9	LE 1M	LE LL	26	2004588µs				0	ADV_IND
    18992	10066.312	df:a8:66:b5:51:c9	LE 1M	BT Mesh Beacon	30	839329µs				0	Secure Network Beacon
    18993	10067.477	df:a8:66:b5:51:c9	LE 1M	LE LL	26	1164775µs				0	ADV_IND
    18994	10067.478	c3:dd:20:1e:4c:9b	LE 1M	LE LL	12	150µs				0	SCAN_REQ
    18995	10067.479	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    18996	10067.480	df:a8:66:b5:51:c9	LE 1M	LE LL	26	301µs				0	ADV_IND
    18997	10067.480	fb:23:fb:c2:7c:9b	LE 1M	LE LL	12	150µs				0	SCAN_REQ
    18998	10067.481	df:a8:66:b5:51:c9	LE 1M	LE LL	24	149µs				0	SCAN_RSP
    18999	10069.483	df:a8:66:b5:51:c9	LE 1M	LE LL	26	2002979µs				0	ADV_IND
    19000	10069.484	7a:3e:9f:0a:f9:4f	LE 1M	LE LL	12	150µs				0	SCAN_REQ
    19001	10069.484	df:a8:66:b5:51:c9	LE 1M	LE LL	26	723µs				0	ADV_IND
    19002	10069.485	df:a8:66:b5:51:c9	LE 1M	LE LL	26	498µs				0	ADV_IND
    19003	10069.486	78:a5:a8:38:fe:96	LE 1M	LE LL	12	150µs				0	SCAN_REQ
    19004	10069.486	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    19005	10071.491	df:a8:66:b5:51:c9	LE 1M	LE LL	26	2005099µs				0	ADV_IND
    19006	10071.492	df:a8:66:b5:51:c9	LE 1M	LE LL	26	498µs				0	ADV_IND
    19007	10073.495	df:a8:66:b5:51:c9	LE 1M	LE LL	26	2003150µs				0	ADV_IND
    19008	10073.496	ee:0e:a3:0e:d3:67	LE 1M	LE LL	12	150µs				0	SCAN_REQ
    19009	10073.496	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    19010	10075.496	df:a8:66:b5:51:c9	LE 1M	LE LL	26	1999498µs				0	ADV_IND
    19011	10075.497	ee:0e:a3:0e:d3:67	LE 1M	LE LL	12	151µs				0	SCAN_REQ
    19012	10075.498	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    19013	10075.499	df:a8:66:b5:51:c9	LE 1M	LE LL	26	301µs				0	ADV_IND
    19014	10075.499	6e:e3:45:3f:b4:30	LE 1M	LE LL	12	148µs				0	SCAN_REQ
    19015	10075.500	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    19016	10075.500	df:a8:66:b5:51:c9	LE 1M	LE LL	26	301µs				0	ADV_IND
    19017	10075.521	df:a8:66:b5:51:c9	LE 1M	BT Mesh Beacon	30	22049µs				0	Secure Network Beacon
    19018	10077.504	df:a8:66:b5:51:c9	LE 1M	LE LL	26	1982234µs				0	ADV_IND
    19019	10077.504	cc:e9:c6:5c:a9:9a	LE 1M	LE LL	12	151µs				0	SCAN_REQ
    19020	10077.505	df:a8:66:b5:51:c9	LE 1M	LE LL	24	149µs				0	SCAN_RSP
    19021	10077.506	df:a8:66:b5:51:c9	LE 1M	LE LL	26	301µs				0	ADV_IND
    19022	10077.506	7b:3e:8f:82:f9:89	LE 1M	LE LL	12	150µs				0	SCAN_REQ
    19023	10077.507	df:a8:66:b5:51:c9	LE 1M	LE LL	24	150µs				0	SCAN_RSP
    19024	10081.509	df:a8:66:b5:51:c9	LE 1M	LE LL	26	4003383µs				0	ADV_IND
    19025	10081.510	5c:e4:3c:9b:80:82	LE 1M	LE LL	34	150µs				0	CONNECT_IND
    19028	10081.535	Master_0x50657c51	LE 1M	LE LL	6	150µs	1	0	False	0	Control Opcode: LL_VERSION_IND
    19029	10081.564	Master_0x50657c51	LE 1M	LE LL	6	29411µs	1	1	False	1	Control Opcode: LL_VERSION_IND
    19032	10081.595	Slave_0x50657c51	LE 1M	LE LL	6	150µs	0	1	False	2	Control Opcode: LL_VERSION_IND
    19033	10081.623	Master_0x50657c51	LE 1M	LE LL	9	29642µs	1	1	False	3	Control Opcode: LL_FEATURE_REQ
    19034	10081.624	Slave_0x50657c51	LE 1M	L2CAP	16	151µs	1	0	False	3	Connection Parameter Update Request
    19035	10081.653	Master_0x50657c51	LE 1M	L2CAP	10	29489µs	0	0	False	4	Connection Parameter Update Response (Accepted)
    19036	10081.654	Slave_0x50657c51	LE 1M	LE LL	9	150µs	0	1	False	4	Control Opcode: LL_FEATURE_RSP
    19037	10081.683	Master_0x50657c51	LE 1M	LE LL	12	29538µs	1	1	False	5	Control Opcode: LL_CONNECTION_UPDATE_IND
    

    There is only this device and the provisioner on this network and the secure network beacon fires every 10 seconds as expected. There are several advertisements made by the device (MAC DF:A8:66:B5:51:C9) and as soon as the provisioner (MAC 5C:E4:3C:9B:80:82) the connecting is made very quickly. Is this just because the scanning windows on both devices are just missing each other, or is there another reason like excessive traffic on these channels causing the provisioner to not see the device?

    Above was also listed to try and change the preprocessor definitions of MIN_CONN_INTERVAL and MAX_CONN_INTERVAL. From my understanding, these are the min and max values that can be accepted for connections after the device has been found and is in an active connection, rather than a value that controls the rate at which the device advertises. BEARER_ADV_INT_DEFAULT_MS seems to have more to do with the advertisement frequency, but it is set to 20ms and that is far quicker than I see advertisements on the sniffer. MESH_ADV_INTERVAL_DEFAULT also seems to be another place where an advertising rate can be set. I found references in this thread: https://devzone.nordicsemi.com/f/nordic-q-a/52057/change-advertisement-interval---ble-mesh.

    I still haven't found what exactly controls the advertising rate for the proxy connection after provisioning, but it seems to advertise quite often according to the sniffer. What is causing the slow connection time? sometimes it's 5 seconds and sometimes it's over 30 seconds. What can be done to improve the performance?

Related