HCI command Header and Footer

40 views
Skip to first unread message

Justin John

unread,
Aug 26, 2021, 6:47:09 AM8/26/21
to btstack-dev
Hi Matthias,
I am using btstack bluetooth classic on msp430 with TI cc256xB controller.
I am running SSP profile and wanted to know what does the header and footer after the data packet that is received over bluetooth represent.
For e.g. Over the bluetooth I am sending 7D-7D-0A-0C-28-4E-A3-20-03-00-07-FA-03-00-FD-FB and when it receives on the serial port I observe following.
0x32-0x02-0x01-0x20-0x19-0x00-0x15-0x00-0x42-0x00-0x0B-0xFF-0x21-0x02-0x7D-0x7D-0x0A-0x0C-0x28-0x4E-0xA3-0x20-0x03-0x00-0x07-0xFA-0x03-0x00-0xFD-0x86-0x04-0x13-0x05-0x01-0x01-0x00-0x01-0x00-0x30-0x33-0x30-0x32-0x04-0x13-0x05-0x01-0x01-0x00-0x01-0x00-0x30


The actual data is marked in RED. The GREEN and BLUE are the ones that get appended. 
I wanted to know where can I read about the details of additional data that gets pre and post appended? I need this because I am seeing occasional packet drop.

Thanks,
Justin John

Matthias Ringwald

unread,
Aug 28, 2021, 2:55:11 PM8/28/21
to btsta...@googlegroups.com
Hi Justin

Bluetooth is a protocol stack, so an SPP/RFCOMM payload will be send in an RFCOMM packet, as payload of an L2CAP packet, in one ore more HCI ACL packets, which then will be sent over the UART if H4 is used.
The easiest way to parse it is to enable BTstack's HCI packet logger, see manual. The debug UART output can be converted into a .pklg file which can be opened and analyzed in Wireshark.
I'll break you example data down below a bit.

> On 26 Aug 2021, at 12:47, Justin John <johnm...@gmail.com> wrote:
>
> Hi Matthias,
> I am using btstack bluetooth classic on msp430 with TI cc256xB controller.
> I am running SSP profile and wanted to know what does the header and footer after the data packet that is received over bluetooth represent.
> For e.g. Over the bluetooth I am sending 7D-7D-0A-0C-28-4E-A3-20-03-00-07-FA-03-00-FD-FB and when it receives on the serial port I observe following.

> 0x32-
That's probably TI's eHCILL and is a Wake up message

> 0x02-
HCI Packet type: ACL

> 0x01-0x20-0x19-0x00-
ACL header: it contains packet boundary flags, the HCI con handle and the len of the l2cap data

> 0x15-0x00-0x42-0x00-
L2CAP header: first len, then the channel id

> 0x0B-0xFF-0x21-0x02-
RFCOMM header

> 0x7D-0x7D-0x0A-0x0C-0x28-0x4E-0xA3-0x20-0x03-0x00-0x07-0xFA-0x03-0x00-0xFD
RFCOMM Payload, 0xFB seems to have got lost somewhere

> -0x86-
RFCOMM tail byte, a checksum

> 0x04-
HCI Packet Type: Event

> 0x13-0x05-0x01-0x01-0x00-0x01-0x00-
HCI Event Num Packets Complete: 0x01 one packet for handle 0x0001

> 0x30-0x33-0x30-0x32
eHCILL wake/sleep/ or similar

> -0x04
HCI Packet Type: ACL
> -0x13-0x05-0x01-0x01-0x00-0x01-0x00
HCI Event Num Packets Complete: 0x01 one packet for handle 0x0001

> -0x30
eHCILL message.

Cheers
Matthias

>
>
> The actual data is marked in RED. The GREEN and BLUE are the ones that get appended.
> I wanted to know where can I read about the details of additional data that gets pre and post appended? I need this because I am seeing occasional packet drop.
>
> Thanks,
> Justin John
>
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to btstack-dev...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/btstack-dev/9022a6e9-136e-4024-b9b8-c52a767f3aa6n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages