This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ATT and GATT command format

Other Parts Discussed in Thread: CC2540

Hi All,

I am writing a software for controlling a CC2540 with Hosttestrelase from PC (similar to Linuxhosttest2). The TI BLE Vendor Specific HCI Reference Guide 1.2.1 says that the general command format is:

- 0x01 (command),
- opcode in 2 octets,
- param_len in 1 octet,
- parameters in param_len octet(s).

However, the format of the ATT and GATT commands is:

- opcode in 2 octets,
- connectionHandle in 2 octets,
- command parameters.

The LinuxHostTest seems to create command in the following format:

- 0x01 (command),
- opcode in 2 octets,
- data_length in 1 octet,
- connection handle in 2 octets,
- parameters in (data_length-2) octets.

Does anyone know, which is the correct way of creating such commands?

Thanks,
Gergo

  • Hi Gergo,

    In the TI BLE Vendor Specific HCI Guide (pdf supplied with the BLE stack), section 8 describes the one byte preceding HCI messages. This byte describes the type of the following message.

    From Table 1 page 10, 0x01 can be seen to describe a Command Packet, and this must be sent first when issuing commands, like in the LinuxHostTest you describe.

    Best Regards,

    Aslak Normann

  • Hi Aslak,

    Thanks for you reply. 

    I can see that the first byte tells that it's a command or an event (or something else). However, in the general command packet this is followed by the opcode, the length of the params and the params (page 11). On page 126 the table suggests that in case of GATT (and ATT) commands the opcode is followed by the connection handle and the command params.

    In LinuxHostTest2 the length parameter is between the opcode and the connection handle. This format is appropriate according to the general command packet, but I guess it isn't compatible with the format of GATT and ATT parameters (page 126). Which format is OK?

    Thanks, 
    Gergo 

  • Hi Gergo,

    I didn't notice that discrepancy. After looking at the pages you mention and looking at a GATT command sent using BTool, I think it is probable that the documentation on page 126 is wrong, whereas the format described on page 11 is correct. That is, the length specifier must follow the opcode, then additional parameters, as you found in the Linux application.

    Best Regards,
    Aslak 

  • Hi Aslak,

    Thanks, now it's clear.

    Is there any elegant way to report such things? I found other problems (but no so serious ones), and I would gladly help to make the documentation better.

    Best regards,
    Gergo

  • Hi Gergo,

    Yes, there is. We call it the E2E Community forum :)

    We monitor these forums continuously, especially posts beginning with e.g. "I think there may be a mistake in...". Thank you for bringing this to our attention, and feel free to post comments on confusing or wrong documentation at any time.

    BR
    Aslak