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

ble connection sequence

HI,

I am developing an application which requires BLE connection. I am concerned about the energy consumed by the device during the connection.

I understand that once the connection is established there will be EXHANGE MTU and Discovery sequence ? Is this mandatory ? How can we keep the connection sequence to minimal ?

I am attaching the log file from sniffer and I observe many packets between master(nRF Connect) and slave ? Is this normal ? Can we optimize this if we develop our own master/client application?

3817.connection_seq.pcapng

922	24.448893	d0:f3:6a:70:44:e2	Broadcast	LE LL	63	ADV_IND
923	24.449419	76:22:79:fe:79:08	d0:f3:6a:70:44:e2	LE LL	60	CONNECT_IND
924	24.457836	Master_0x50657557	Slave_0x50657557	LE LL	32	Control Opcode: LL_VERSION_IND
925	24.458115	Slave_0x50657557	Master_0x50657557	ATT	33	Rcvd Exchange MTU Request, Client Rx MTU: 512
926	24.502837	Master_0x50657557	Slave_0x50657557	LE LL	32	Control Opcode: LL_VERSION_IND
927	24.503115	Slave_0x50657557	Master_0x50657557	ATT	33	Rcvd Exchange MTU Request, Client Rx MTU: 512
928	24.503401	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
929	24.503631	Slave_0x50657557	Master_0x50657557	ATT	33	Rcvd Exchange MTU Request, Client Rx MTU: 512
930	24.503917	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
931	24.504147	Slave_0x50657557	Master_0x50657557	LE LL	32	Control Opcode: LL_VERSION_IND
932	24.547837	Master_0x50657557	Slave_0x50657557	LE LL	35	Control Opcode: LL_FEATURE_REQ
933	24.548140	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
934	24.548369	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, Server Supported Features, Handles: 0x0001..0xffff
935	24.592837	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, Server Supported Features, Handles: 0x0001..0xffff
936	24.593155	Slave_0x50657557	Master_0x50657557	LE LL	35	Control Opcode: LL_FEATURE_RSP
937	24.593458	Master_0x50657557	Slave_0x50657557	ATT	33	Sent Exchange MTU Response, Server Rx MTU: 512
938	24.637838	Master_0x50657557	Slave_0x50657557	ATT	33	Sent Exchange MTU Response, Server Rx MTU: 512
939	24.638124	Slave_0x50657557	Master_0x50657557	ATT	35	Rcvd Error Response - Attribute Not Found, Handle: 0x0001 (Unknown)
940	24.638426	Master_0x50657557	Slave_0x50657557	LE LL	38	Control Opcode: LL_CONNECTION_UPDATE_IND
941	24.682838	Master_0x50657557	Slave_0x50657557	LE LL	38	Control Opcode: LL_CONNECTION_UPDATE_IND
942	24.683164	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
943	24.683394	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Group Type Request, GATT Primary Service Declaration, Handles: 0x0001..0xffff
944	24.727837	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Group Type Request, GATT Primary Service Declaration, Handles: 0x0001..0xffff
945	24.728155	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
946	24.772837	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
947	24.773067	Slave_0x50657557	Master_0x50657557	ATT	44	Rcvd Read By Group Type Response, Attribute List Length: 2, Generic Access Profile, Generic Attribute Profile
948	24.817838	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Group Type Request, GATT Primary Service Declaration, Handles: 0x000e..0xffff
949	24.818156	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
950	24.862838	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
951	24.863069	Slave_0x50657557	Master_0x50657557	ATT	52	Rcvd Read By Group Type Response, Attribute List Length: 1, Unknown
952	24.907838	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Include Declaration, Handles: 0x0001..0x0009
953	24.908156	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
954	24.952838	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
955	24.953068	Slave_0x50657557	Master_0x50657557	ATT	35	Rcvd Error Response - Attribute Not Found, Handle: 0x0001 (Generic Access Profile)
956	24.997839	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Characteristic Declaration, Handles: 0x0001..0x0009
957	24.998157	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
958	25.050338	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
959	25.050569	Slave_0x50657557	Master_0x50657557	LE LL	53	L2CAP Fragment Start
960	25.051014	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
961	25.057840	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
962	25.058070	Slave_0x50657557	Master_0x50657557	ATT	33	Rcvd Read By Type Response, Attribute List Length: 4, Device Name, Appearance, Peripheral Preferred Connection Parameters, Central Address Resolution
963	25.065340	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Characteristic Declaration, Handles: 0x0009..0x0009
964	25.065659	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
965	25.072842	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
966	25.073073	Slave_0x50657557	Master_0x50657557	ATT	35	Rcvd Error Response - Attribute Not Found, Handle: 0x0009 (Generic Access Profile: Central Address Resolution)
967	25.080343	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Include Declaration, Handles: 0x000a..0x000d
968	25.080661	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
969	25.087844	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
970	25.088074	Slave_0x50657557	Master_0x50657557	ATT	35	Rcvd Error Response - Attribute Not Found, Handle: 0x000a (Generic Attribute Profile)
971	25.095344	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Characteristic Declaration, Handles: 0x000a..0x000d
972	25.095662	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
973	25.102846	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
974	25.103076	Slave_0x50657557	Master_0x50657557	ATT	39	Rcvd Read By Type Response, Attribute List Length: 1, Service Changed
975	25.110346	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Characteristic Declaration, Handles: 0x000c..0x000d
976	25.110664	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
977	25.117846	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
978	25.118077	Slave_0x50657557	Master_0x50657557	ATT	35	Rcvd Error Response - Attribute Not Found, Handle: 0x000c (Generic Attribute Profile: Service Changed)
979	25.125346	Master_0x50657557	Slave_0x50657557	ATT	35	Sent Find Information Request, Handles: 0x000d..0x000d
980	25.125649	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
981	25.132846	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
982	25.133077	Slave_0x50657557	Master_0x50657557	ATT	36	Rcvd Find Information Response, Handle: 0x000d (Generic Attribute Profile: Service Changed: Client Characteristic Configuration)
983	25.140347	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Include Declaration, Handles: 0x000e..0xffff
984	25.140665	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
985	25.147847	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
986	25.148077	Slave_0x50657557	Master_0x50657557	ATT	35	Rcvd Error Response - Attribute Not Found, Handle: 0x000e (Unknown)
987	25.155348	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Characteristic Declaration, Handles: 0x000e..0xffff
988	25.155666	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
989	25.162849	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
990	25.163080	Slave_0x50657557	Master_0x50657557	ATT	53	Rcvd Read By Type Response, Attribute List Length: 1, Unknown
991	25.170348	Master_0x50657557	Slave_0x50657557	ATT	37	Sent Read By Type Request, GATT Characteristic Declaration, Handles: 0x0010..0xffff
992	25.170666	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
993	25.177849	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
994	25.178079	Slave_0x50657557	Master_0x50657557	ATT	35	Rcvd Error Response - Attribute Not Found, Handle: 0x0010 (Unknown: Unknown)
995	25.185350	Master_0x50657557	Slave_0x50657557	ATT	35	Sent Find Information Request, Handles: 0x0011..0xffff
996	25.185652	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
997	25.192850	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
998	25.193080	Slave_0x50657557	Master_0x50657557	ATT	36	Rcvd Find Information Response, Handle: 0x0011 (Unknown: Unknown: Client Characteristic Configuration)
999	25.200351	Master_0x50657557	Slave_0x50657557	ATT	35	Sent Find Information Request, Handles: 0x0012..0xffff
1000	25.200654	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
1001	25.207852	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
1002	25.208082	Slave_0x50657557	Master_0x50657557	ATT	35	Rcvd Error Response - Attribute Not Found, Handle: 0x0012 (Unknown: Unknown: Unknown)
1003	25.215352	Master_0x50657557	Slave_0x50657557	LE LL	38	Control Opcode: LL_CONNECTION_UPDATE_IND
1004	25.215678	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
1005	25.222852	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
1006	25.223082	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
1007	25.230351	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
1008	25.230582	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
1009	25.237851	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
1010	25.238082	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
1011	25.245350	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
1012	25.245581	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
1013	25.252850	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU
1014	25.253080	Slave_0x50657557	Master_0x50657557	LE LL	26	Empty PDU
1015	25.260349	Master_0x50657557	Slave_0x50657557	LE LL	26	Empty PDU

Parents
  • Hello!

    When establishing a connection some packets will be sent back and forth between the central and peripheral to configure the connection properly.

    In the simplest case this could be just a connection request packet from the central to the peripheral, but often more packet exchanges are needed.

    For example an MTU exchange, which sets the Maximum Transmission Unit, allowing for more data per packet.

    The discovery sequence on the other hand is done before establishing a connection, and involves the central unit choosing what advertising peripheral to connect to.

    All this is mandatory to set up a connection, but shouldn't be of great concern when it comes to energy consumption, as it only happens once at the beginning of a connection.

    Then there are all the empty packets you have observed being sent between the central and peripheral.

    These are sent regularly in order to keep the BLE connection alive, at a frequency set by the connection interval, which is decided by the central in the initial connection request.

    The connection interval seems to be set to a low value in your application since these packets are sent pretty frequently. It can be set to as high as a few seconds I believe.

    Setting a higher connection interval will likely make your application consume less power since it's sending fewer packets, but you might also find your application less responsive if you set it too high.

    Hope this clears up some of your questions.

    Best regards,

    Einar

Reply
  • Hello!

    When establishing a connection some packets will be sent back and forth between the central and peripheral to configure the connection properly.

    In the simplest case this could be just a connection request packet from the central to the peripheral, but often more packet exchanges are needed.

    For example an MTU exchange, which sets the Maximum Transmission Unit, allowing for more data per packet.

    The discovery sequence on the other hand is done before establishing a connection, and involves the central unit choosing what advertising peripheral to connect to.

    All this is mandatory to set up a connection, but shouldn't be of great concern when it comes to energy consumption, as it only happens once at the beginning of a connection.

    Then there are all the empty packets you have observed being sent between the central and peripheral.

    These are sent regularly in order to keep the BLE connection alive, at a frequency set by the connection interval, which is decided by the central in the initial connection request.

    The connection interval seems to be set to a low value in your application since these packets are sent pretty frequently. It can be set to as high as a few seconds I believe.

    Setting a higher connection interval will likely make your application consume less power since it's sending fewer packets, but you might also find your application less responsive if you set it too high.

    Hope this clears up some of your questions.

    Best regards,

    Einar

Children
  • Hi, 

    Thank you for your reply.

    The discovery sequence on the other hand is done before establishing a connection, and involves the central unit choosing what advertising peripheral to connect to.

    Oh sorry, I meant GATT database discovery which happens after the connection. Is this really needed if the client already knows the UUID of the characteristic being used ? Can client read/write using the UUID without the handle ?

  • Hi,

    There are many options in the Zephyr Bluetooth GATT API, maybe this function can suit your needs?

    What code are you currently running? Have you based your application on a sample?

    -Einar

  • What code are you currently running? Have you based your application on a sample?

    \examples\ble_peripheral\ble_app_template - My application is based on ble_app_template.

    I am just analysing the energy consumed during the connection.  

  • Right, I assumed you were using NCS, but you're using the nRF5 SDK?

    The ble app template is for an advertising peripheral, so I assume you're using nRF Connect as your central unit when testing to connect to your devkit?

    In that case, your DK will only do what the central tells it to, it's always the central unit that initiates things like GATT database discovery etc, so if you want to test with your own custom application at both ends that might be easier to do with two devkits for example.

    Also, as I already mentioned, this initial setup communication is not what you should be worried about when it comes to your application's power consumption.

    -Einar

  • In that case, your DK will only do what the central tells it to, it's always the central unit that initiates things like GATT database discovery etc, so if you want to test with your own custom application at both ends that might be easier to do with two devkits for example

    That's clear, thank you.

    Also, as I already mentioned, this initial setup communication is not what you should be worried about when it comes to your application's power consumption.

    That's correct, but my system is based on energy harvesting and hence this is very important for me. Also do you think if there is any way to transfer data (2-3 MB) between two devices without a connection ? Because, connection procedure seems to be very power hungry for us.  Is there any proprietary protocol available ?

Related