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

I would like to have an example about HCI packet format

I have questions about the HCI packet format

With the start packet, the Ack number in the header section = 000 What should it be filled in the data packet and stop packet ?

In the start packet, Seq number = 1. Should the Seq number in data packet = n+1 ? so the maximum Seq number will be 7 ? => start (1),2,3,4,5,6,stop(7)

Is the byte3 = 0x4E wrong ? that should be 0xAE in Figure 2 of Packet format

Every packet type of data packet = 0x02, 0x00, 0x00, 0x00 ?

  1. The payload length of header is the high 4 bits in the byte3 + byte4 = 12bits ? Is the low 4 bits of byte3 always 0xE ?

  2. Is the data packet and stop packet have the header section ?

Could you give us more detailed info about HCI transmission?

thanks

Snap1.jpg

  • In general, the HCI format used by the bootloader is the one specified in the Bluetooth Core Specification, Volume 4, Part D, so you can take a look at that for a more detailed explanation of the different header fields. Most of your questions are answered there, but I've found the exact quotes for each part:

    1. "The acknowledge number must be set to the sequence number of the next reliable packet this device expects to receive."

    2. "Each new reliable packet will be assigned a sequence number which will be equal to the sequence number of the previous reliable packet plus one modulo eight. A packet will use the same sequence number each time it is retransmitted."

    3. Yes, this seems to be wrong. When actually doing an upload, I see 0x8E actually, which makes sense, considering that the packet is 8 bytes long.

    4. The start packet is 0x02, the data packet is 0x03, and the stop packet is 0x04.

    5. As you can see in section 4.5, this packet type is one of the numbers defined there, and 0x0E = 0d14 is Vendor Specific.

    6. Yes, as far as I've understood, all packets should have a header.

    I've also attached a logic trace showing a successfull upload of the heart rate application, which may be useful to refer to. It can be opened with the tool available here.

    hci-bootloader.logicdata

  • Thanks, I got it , I will check Bluetooth Core Specification, Volume 4, Part D for more detail.

    thanks again for detail reply

  • Are you sure about point 3 ? What is payload length in packet header. I didn't understand of Core 4.2, because description is vague. I count 20bytes in start packet according this

Related