Hi,
I analyzed the failed connection attempt with 'NO SECURITY' option. I presented the commands and events to Chatgpt, so I am not sure that the results are correct. Chatgpt made some complaints about advertising interval settings, so this could be the reason. I can check AT+ADVI0 to AT+ADVIF only in two days, I'm travelling at the moment.
Here are the Chatgpt results. Could you pls. comment on.
THX
Cheers
Detlef
I analyzed the failed connection attempt with 'NO SECURITY' option. I presented the commands and events to Chatgpt, so I am not sure that the results are correct. Chatgpt made some complaints about advertising interval settings, so this could be the reason. I can check AT+ADVI0 to AT+ADVIF only in two days, I'm travelling at the moment.
Here are the Chatgpt results. Could you pls. comment on.
THX
Cheers
Detlef
Code:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>< HCI OGF=08 OCF=0A 0000 01 0A 20 01 00ChatGPT:You're sending an HCI command to enable or disable advertising on a Bluetooth Low Energy (BLE) device.?? Opcode Breakdown:OGF = 0x08 ? LE Controller CommandsOCF = 0x0A ? HCI_LE_Set_Advertise_EnableOpcode = (OGF << 10) | OCF = 0x200A`?? Raw Command Packet:01 0A 20 01 00Byte(s)Meaning01HCI Command Packet (packet type)0A 20Opcode = 0x200A = HCI_LE_Set_Advertise_Enable01Parameter length = 1 byte00Advertising Enable = 0x00 = Disable advertising ?>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>< HCI OGF=08 OCF=0D 0000 01 0D 20 19 60 00 60 00 - 00 00 CC 35 9C 93 72 84 0010 00 18 00 28 00 00 00 11 - 01 00 00 00 00ChatGPT:You're sending the HCI command:HCI_LE_Create_Connection (OGF = 0x08, OCF = 0x0D)This is the main command used to initiate a connection to a BLE peripheral. Let’s decode the whole thing.?? Raw Command:01 0D 20 19 60 00 60 00 00 00 CC 35 9C 93 72 84 00 18 00 28 00 00 00 11 01 00 00 00 00?? Header BreakdownByte(s)Meaning01HCI Command Packet0D 20Opcode = 0x200D = HCI_LE_Create_Connection19Parameter Length = 25 bytes?? Parameter Breakdown (25 bytes):OffsetBytesFieldValue / Notes060 00Scan Interval = 0x0060 = 96 × 0.625 ms = 60 ms260 00Scan Window = 0x0060 = 60 ms400Initiator Filter Policy = 0 (Whitelist not used)500Peer Address Type = 0 (Public)6CC 35 9C 93 72 84Peer Address = 84:72:93:9C:35:CC1200Own Address Type = 0 (Public)1318 00Conn Interval Min = 0x0018 = 30 × 1.25ms = 37.5 ms1528 00Conn Interval Max = 0x0028 = 40 × 1.25ms = 50 ms1700 00Conn Latency = 01900 11Supervision Timeout = 0x1100 = 4352 ? ?? likely endian confusion2101 00Min CE Length = 0x00012300 00Max CE Length = 0x0000>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Event 0E = 01 0C 20 00 0000 04 0E 04 01 0C 20 00ChatGPT:You're looking at the HCI Command Complete Event for the command:?? HCI_LE_Set_Scan_Response_DataOpcode: 0x200C (OCF = 0x0C, OGF = 0x08)?? Raw Packet Breakdown:04 0E 04 01 0C 20 00Byte(s)FieldValue04Packet IndicatorHCI Event Packet0EEvent Code0x0E = Command Complete04Parameter Length4 bytes follow01Num_HCI_Command_PacketsController can accept 1 more0C 20Command Opcode0x200C = HCI_LE_Set_Scan_Response_Data00Status0x00 = Success ?? TL;DRYou successfully set the scan response data.No errors, and the controller accepted your HCI_LE_Set_Scan_Response_Data command.You're now good to go to start advertising, and if a scanner sends a scan request, your controller will respond with the scan response data you set.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Event 0E = 01 0A 20 0C 0000 04 0E 04 01 0A 20 0CChatGPT:You're looking at an HCI Command Complete Event for the BLE command:?? HCI_LE_Set_Advertise_EnableOpcode: 0x200A (OGF = 0x08, OCF = 0x0A)?? Raw Event:04 0E 04 01 0A 20 0C?? Byte-by-Byte Breakdown:Byte(s)FieldValue04Packet TypeHCI Event Packet0EEvent Code0x0E = Command Complete04Parameter Length4 bytes follow01Num_HCI_Command_Packets1 (Controller can accept 1 more)0A 20Opcode0x200A = HCI_LE_Set_Advertise_Enable0CStatus0x0C = ? Command Disallowed?? What’s the Problem?The status 0x0C means:Command Disallowed — the controller was not in a state to accept this command.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Event 0F = 00 01 0D 20 0000 04 0F 04 00 01 0D 20ChatGPT:You're seeing an HCI Command Status Event, which indicates the controller has received a command and is processing it asynchronously.?? Raw Event:r04 0F 04 00 01 0D 20?? Byte-by-Byte Breakdown:Byte(s)FieldValue04Packet TypeHCI Event Packet0FEvent Code0x0F = Command Status04Parameter Length4 bytes00Status0x00 = ? Success (command accepted)01Num_HCI_Command_PacketsController can accept 1 more0D 20Opcode0x200D = HCI_LE_Create_Connection?? What It Means:This event confirms your HCI_LE_Create_Connection command (opcode 0x200D) was accepted and is being processed.It’s not the final result — you’ll get a Connection Complete event (Event 0x3E, subevent 0x01) later when the controller finishes the connection attempt (success or failure).? TL;DR:HCI_LE_Create_Connection command was received without errorController is now trying to establish a BLE connectionWait for an LE Connection Complete event (0x3E 01 ...) to know the result>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Event 3E = 01 00 40 00 00 00 CC 35 9C 93... 0000 04 3E 13 01 00 40 00 00 - 00 CC 35 9C 93 72 84 27 0010 00 00 00 11 01 00ChatGPT:You're now seeing the LE Meta Event ? specifically the subevent 0x01, which is the:?? LE Connection Complete EventThis tells you that a BLE connection was successfully established with a peer device.?? Raw Event:04 3E 13 01 00 40 00 00 00 CC 35 9C 93 72 84 27 00 00 00 11 01 00?? Byte-by-Byte Breakdown:Byte(s)FieldValue / Meaning04Packet TypeHCI Event Packet3EEvent CodeLE Meta Event (0x3E)13Parameter Length19 bytes follow01Subevent Code0x01 = LE Connection Complete00Status0x00 = Success ?40 00Connection Handle0x004000Role0x00 = Central (initiator)00Peer Address Type0x00 = PublicCC 35 9C 93 72 84Peer Address84:72:93:9C:35:CC27 00Conn Interval0x0027 = 39 × 1.25ms = 48.75 ms00 00Conn Latency0 (no slave latency)00 11Supervision Timeout0x1100 ? Little-endian = 0x0011 = 17 × 10ms = 170 ms01Master Clock Accuracy0x01 = 20–50 ppm? TL;DR:You've successfully connected to a BLE peripheral ??FieldValueRoleCentral (you initiated)Peer Address84:72:93:9C:35:CCConn Interval48.75 msLatency0Supervision Timeout170 msConn Handle0x0040You’ll now use connection handle 0x0040 for all further ACL data (like ATT/GATT reads, writes, etc.).>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>< HCI OGF=08 OCF=22 0000 01 22 20 06 40 00 FB 00 - 00 08ChatGPT:You're sending the command:?? HCI_LE_Remote_Connection_Parameter_Request_ReplyOpcode: 0x2022 (OGF = 0x08, OCF = 0x22)This is used to accept a Remote Connection Parameter Request from a BLE peripheral during an established connection.?? Raw Command Packet:01 22 20 06 40 00 FB 00 00 08?? Breakdown:Byte(s)FieldValue / Meaning01HCI Command Packet22 20Opcode = 0x2022 = HCI_LE_Remote_Connection_Parameter_Request_Reply06Parameter length = 6 bytes?? Too short!40 00Connection Handle = 0x0040FB 00Connection Interval Min = 0x00FB = 313.75 ms00 08?? This is cut off and ambiguous — looks like part of the next parameter?? Problem:The Remote Connection Parameter Request Reply command requires 12 bytes of parameters:? Required Format (12 bytes):FieldSizeDescriptionConnection_Handle2BLE connection handleConn_Interval_Min2Min connection interval (×1.25 ms)Conn_Interval_Max2Max connection interval (×1.25 ms)Conn_Latency2Peripheral latency (number of events to skip)Supervision_Timeout2Timeout (×10 ms)Min_CE_Length2OptionalMax_CE_Length2OptionalYour command has only 6 bytes, so it's incomplete and will fail or be ignored by the controller.? Example Correct Command (12 bytes):Let’s say you want:Conn Interval: 50–100 ms ? 0x0028–0x0050Latency: 0 ? 0x0000Supervision Timeout: 2000 ms ? 0x00C8CE Length: 0hex01 22 20 0C // HCI command header40 00 // Connection Handle: 0x004028 00 50 00 // Conn Interval Min/Max: 50–100 ms00 00 // Latency = 0C8 00 // Supervision Timeout = 2000 ms00 00 00 00 // Min/Max CE Length = 0?? TL;DRYou're trying to reply to a remote connection parameter request, but the payload is incomplete.The command requires 12 bytes, but you've only provided 6.You need to add:Max intervalLatencyTimeoutCE length values>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>< CHANNEL 0004 Opcode = 02 0000 02 40 00 07 00 03 00 04 - 00 02 F7 00ChatGPT:You're looking at a raw HCI ACL Data Packet on channel 0x0004, which is the ATT (Attribute Protocol) channel in Bluetooth Low Energy (BLE). This packet contains a GATT Write Request.?? Full Raw Packet:02 40 00 07 00 03 00 04 00 02 F7 00?? Breakdown by Sections:?? HCI ACL Header (first 5 bytes):BytesDescription02HCI Packet Type = ACL Data (0x02)40 00Connection Handle = 0x004007 00Data Total Length = 7 bytes?? L2CAP Header (next 4 bytes):BytesDescription03 00L2CAP Payload Length = 3 bytes04 00Channel ID = 0x0004 = ATT (Attribute Protocol)?? ATT Payload (last 3 bytes):BytesDescription02ATT Opcode = 0x02 = Write RequestF7 00Attribute Handle = 0x00F7 (little-endian)?? Problem:The Write Request is incomplete — it's missing the value that should be written to the attribute.A valid Write Request looks like:scssOpcode (1 byte) + Handle (2 bytes) + Value (n bytes)But you only have:Opcode = 0x02Handle = 0x00F7No value? TL;DR:You sent a GATT Write Request to handle 0x00F7, but forgot the value to write.To fix it, you need to append the data value. For example, to write the single byte 0x01:hex02 F7 00 01 ? Write 0x01 to handle 0x00F7This would change the packet to:02 40 00 08 00 04 00 04 00 02 F7 00 01>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Event 0E = 01 22 20 00 40 00 0000 04 0E 06 01 22 20 00 40 - 00ChatGPT:You're looking at an HCI Command Complete Event related to the HCI_LE_Remote_Connection_Parameter_Request_Reply command.?? Raw Event:04 0E 06 01 22 20 00 40 00?? Breakdown by Field:Byte(s)FieldValue / Meaning04HCI Event Packet0EEvent Code0x0E = Command Complete06Parameter Length6 bytes of parameters follow01Num_HCI_Command_Packets1 (Controller can accept 1 more command)22 20Opcode0x2022 = HCI_LE_Remote_Connection_Parameter_Request_Reply00Status0x00 = Success ?40 00Connection Handle0x0040 (The connection handle to which the parameters apply)? TL;DR:Command Completed successfully.The HCI_LE_Remote_Connection_Parameter_Request_Reply was successfully processed.The connection handle for this reply is 0x0040, which matches the connection established earlier.This indicates that the remote connection parameter reply was successfully sent for the connection handle 0x0040.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Event 13 = 01 40 00 01 00 0000 04 13 05 01 40 00 01 00ChatGPT:You're looking at an HCI LE Meta Event with a subevent code 0x01, which indicates:LE Connection Complete EventThis event informs you that a connection has been successfully established with a peer device. Let's break it down.?? Raw Event:04 13 05 01 40 00 01 00?? Breakdown by Field:Byte(s)FieldValue / Meaning04HCI Event Packet13Event Code0x13 = LE Meta Event05Parameter Length5 bytes of parameters follow01Subevent Code0x01 = LE Connection Complete40 00Connection Handle0x0040 (Connection handle)01Role0x01 = Peripheral (device is acting as a peripheral)00Status0x00 = Success ?? TL;DR:Connection Complete Event was successfully received.Connection Handle = 0x0040 (you can now interact with the connection using this handle).Role = Peripheral (0x01), meaning this device is acting as a peripheral in the connection.Status = 0x00 indicates that the connection was successful.This confirms that the connection attempt was successful, and you can now proceed with GATT operations like reading, writing, or discovering services.>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Event 05 = 00 40 00 3E 0000 04 05 04 00 40 00 3EChatGPT:You're seeing an HCI Event with the event code 0x05, which is the Disconnection Complete Event. This event occurs when a Bluetooth device has been successfully disconnected.?? Raw Event:04 05 04 00 40 00 3E?? Breakdown by Field:Byte(s)FieldValue / Meaning04HCI Event Packet05Event Code0x05 = Disconnection Complete Event04Parameter Length4 bytes of parameters follow00Status0x00 = Success ?40 00Connection Handle0x0040 (the connection handle of the disconnected connection)3EReason0x3E = User Requested? TL;DR:Disconnection Complete Event.Connection Handle = 0x0040 indicates which connection was terminated.Status = 0x00 means the disconnection was successful.Reason = 0x3E means the disconnection was user requested.?? What’s Happening:The device with connection handle 0x0040 has been disconnected successfully, and the reason for the disconnection was user-initiated. This could mean the disconnection was triggered either by the user or via a disconnect command in your BLE stack.If you intend to reconnect, you can now initiate a new connection or wait for the peer to reconnect (if applicable).>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Statistics: Posted by DetlefS — Sun Apr 13, 2025 9:11 pm