HCI Commands question(2)

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
user_3572401
Level 3
Level 3
First like received

I have read WICED-HCI-Control-Protocol.pdf,

I have some questions.

hci2.PNG

could you tell me how to understand the codes?mifoWICED Studio Bluetooth ForumsHCI Commands question(1)

0 Likes
1 Solution
SheetalJ
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 500 likes received

The HCI commands has a standard format as shown in following figure:

pastedImage_1.png

For example, lets take the snapshot you have attached.

01 18 FC 06 00 00 xx xx xx xx

Here 01 specifies this is a command. Next two bytes specifies (18 FC) opcode which has two fields- OCF and OGF. Next byte (06) specifies length of parameters followed.

In response to the command, there will be an event from device whose format is almost similar.

04 0E 04 01 18 FC 00

Here 04 specifies this is an event. Next byte (0E) is opcode. Next byte (04) specifies the length of event parameters followed.

For detailed explanation, refer Bluetooth spec v5.0: https://www.bluetooth.org/mwg-internal/de5fs23hu73ds/progress?id=_xLgCs-cFPOfk1HXk4RS2cO4CcSMZKfQOzt... section 5 HCI DATA FORMATS.

View solution in original post

0 Likes
10 Replies
SheetalJ
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 500 likes received

The HCI commands has a standard format as shown in following figure:

pastedImage_1.png

For example, lets take the snapshot you have attached.

01 18 FC 06 00 00 xx xx xx xx

Here 01 specifies this is a command. Next two bytes specifies (18 FC) opcode which has two fields- OCF and OGF. Next byte (06) specifies length of parameters followed.

In response to the command, there will be an event from device whose format is almost similar.

04 0E 04 01 18 FC 00

Here 04 specifies this is an event. Next byte (0E) is opcode. Next byte (04) specifies the length of event parameters followed.

For detailed explanation, refer Bluetooth spec v5.0: https://www.bluetooth.org/mwg-internal/de5fs23hu73ds/progress?id=_xLgCs-cFPOfk1HXk4RS2cO4CcSMZKfQOzt... section 5 HCI DATA FORMATS.

0 Likes

I have some more question to your answer.

1.(18 FC) opcode which has two fields- OCF and OGF

   Between [18] and [FC],which is OCF?which is OGF?

2.How dose the [18] and [FC] come?

3.To[04 0E 04 01 18 FC 00]

   I have known [04] specifies HCI Event packet,

   but I can't understand how does [0E] come.

   Can you tell me?

4.Can you give me the opecode list of  [04 HCI Event packet]?

   I didn't find the list from Internet.

5.To[https://www.bluetooth.org/mwg-internal/de5fs23hu73ds/progress?id=_xLgCs-cFPOfk1HXk4RS2cO4CcSMZKfQOzt...]

    This page is not exits,could you give me else URL that can get more information about HCI.

6.I read WICED-HCI-Control-Protocol.pdf,

HCI3.PNG

why [01 18 FC 06 00 00 xx xx xx xx] and [04 0E 04 01 18 FC 00] does not have 0x19 exist in them?

0 Likes

Ans 1,2,3,5 - You can download the Bluetooth spec from this link: https://www.bluetooth.com/specifications/bluetooth-core-specification

Choose version 5.0. Here you can find detailed explanation for OCF, OGF fields, packet structure in chapter 5.

Ans 4 - The opcode list can be found here: List of HCI Commands

Ans 6 - This value is specific for WICED HCI commands, that is why 19 is not used when we use standard HCI commands. There are some vendor specific commands used, so for WICED chips, 0x19 is the value used to specify that it is a WICED HCI command.

Hi Shij,

>This command is specific for WICED HCI commands, that is why 19 is not used when we use standard HCI commands.

>There are some vendor specific commands used, so for WICED chips, 0x19 is the value used to specify that it is a WICED HCI command.

You mean if they would like to use WICED HCI command, first byte should be set 0x19 instead of 0x01?

Thank you.

--TAK

0 Likes

goto-t_2353976

Yes, first byte should be 0x19 followed by 01.

Regards,

Sheetal

0 Likes

Hi Shij,

OK , Thanks.

>Zhang

Do you have any questions?

--TAK

0 Likes

>Yes, first byte should be 0x19 followed by 01.

you mean the real packet that be sent by client control,it should be[19 01 18 FC 06 00 00 xx xx xx xx].

Am I right?shjlgoto-t_2353976​@user_437857088

0 Likes

I think there is some confusion with standard HCI and WICED HCI commands.

Whenever you are using WICED HCI command, for example wmbt (WICED Manufacturing Bluetooth Test tool), you will have to use some WICED HCI commands, these commands will start with value 19.

Whether as, 01 18 FC 06 00 00 xx xx xx xx is a standard HCI command like reset, so it wont have 19 in it.

>You mean if they would like to use WICED HCI command, first byte should be set 0x19 instead of 0x01?

Ans. Yes, first byte should be 0x19 followed by 01.

Here the question was specifically asked about using WICED HCI command, to which the answer is yes.

1.shjl,I am confused with your answer.

>>You mean if they would like to use WICED HCI command, first byte should be set 0x19 instead of 0x01?

>Ans. Yes, first byte should be 0x19 followed by 01.

goto-t's answer is 0x19 instead of 0x01.It means WICED HCI command will be [19 18 FC 06 00 00 xx xx xx xx ]

Your answer is first byte should be 0x19 followed by 01.It means WICED HCI command will be

[19 01 18 FC 06 00 00 xx xx xx xx].

goto-t's answer and your answer are different two answer.

But you also say [Yes] to goto-t.

could you make it more clearly with which is correct?

2.My question beforeHCI Commands question(1) ,you say will give me answer in here(HCI Commands question(2)).

>Ans 1,2,3,5 - You can download the Bluetooth spec from this link: https://www.bluetooth.com/specifications/bluetooth-core-specification

Choose version 5.0. Here you can find detailed explanation for OCF, OGF fields, packet structure in chapter 5.

I have read this,but I can't understand.what does exactly the packet's ->[19 01 18 FC 06 00 00 xx xx xx xx]meaning.

So could you teach me what it is mean?Especially 18 and FC,How to explain them.

Ad for this case,what is the Command/ Event Code?what is the Group code?

1.PNGshjlmifogoto-t_2353976user_437857088user_140663973

0 Likes

Let me clarify you some points:

1. There are two concepts: standard HCI commands and WICED HCI commands.

When you are using standard HCI command, for example, 01 18 FC 06 00 00 xx xx xx xx, here you dont have to use 0x19. Use this command as it is.

When you are using WICED HCI command, for example, 19 10 08 05 00 xx xx xx xx xx (reference: /20719-B1_Bluetooth/wiced_tools/wmbt/ReadMe.txt). Here 19 stands for HCI_WICED_PKT. 19 is followed by command code. List of these codes is given in /doc/WICED-HCI-Control-Protocol.pdf. Then comes the group code, list is given in the same pdf, followed by packet length.

2. Now, when we talk about standard HCI commands, for example, 01 18 FC 06 00 00 xx xx xx xx. As shown in the figure of my first response, first value 01 indicates that this is a command.For OCF and OGF, I would again suggest you to go through chapter 5. HCI Data Formats (page no. 728) in BT spec version 5.0. You can also google these terms.

Command/event code, Group code are the opcodes assigned for particular operations. The lists are given in the same pdf.

I hope this makes things clear to you.