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.

CC2564 BLE acl data packet format error?

Other Parts Discussed in Thread: CC2564

Dear Sir/Madam,

I am using CC2564 for BLE application, now the firmware works good, My Android Phone(4.3) can find my BLE device, but when I try to connect, the result is bad.

I captured the packet format as following(NOTE it's little endian) , hope some Tier could explain where the bug is?

1, When the Phone try to connect with BLE device, I get the HCI data packet on CC2564

01 24: (connection handle=0x0401, pb flag= 10b bc flag=00b)
0B 00 (param length)
00 07 (l2cap acl data len)
04 00 (l2cap cid att=0x0004)
10 (read by group type request)
01 00 (start handle)
ff ff (end handle)
00 28 (primary service uuid).

2, So, on CC2564 I give a response

01 04 (connection handle, I try many time to add pb flag as 1 2 3, no way)
0B 00 (paramlength)
07 00 (l2cap acl data len)
04 00 (l2cap cid att=0x0004)
11 (read by group type response)
01(server count)
01 10(start handle 0x1001)
0B 10(group end handle 0x100B)
11 18(service uuid)

3, Then the controller give a event to say how many packet haved been transmated.

13 (event code: num of packet complete event)
05 (param len)
01 (number of conn_handle)
01 04 (first connection handle 0x0401)
01 00 (completed packet, 0x0001)

This event make me disappointed and angry, It said only 1 byte completed, so on Android Phone side, timeout !!!

Another strange thing is that On CC2564, it don't receive connection complete event before acl data transmition, so my another question is how the connection handle 0x401 was generated? I don't mask that event also.

God bless CC2564!

  • Hi Yuandan,

    Could you please let me know what is the app you are using on you Android phone to connect to CC2564?

    So that I can try it for myself and get back to you.

  • The App I used is a very simple tool written by myself as attached. For your convenience, I don't attach source code.

    If you need source code, let me know.

    1, This app include two activity(screen), in the first one, click the switch button, it will search nearby BLE device. Then you can click one item in the list devices.

    2, In the second activity, you can click the "connectGatt" switch button, it will do the connection process, I don't do much thing here, I just call Android BluetoothDevice class connectGatt() method.

    mGattServer = mDevice.connectGatt(mContext, false, new LeGattCallbackImpl()); the LeGattCallbackImpl is the callback functions.

    public class LeGattCallbackImpl extends BluetoothGattCallback{
        final static String TAG = "MyTag";

        @Override
        public void onConnectionStateChange(BluetoothGatt gatt, int status,
                int newState) {
            super.onConnectionStateChange(gatt, status, newState);
            Log.i(TAG, "onConnectionStateChange:" + "status = " + status + ", newState=" + newState );
        }

        @Override
        public void onServicesDiscovered(BluetoothGatt gatt, int status) {
            // TODO Auto-generated method stub
            super.onServicesDiscovered(gatt, status);
            Log.i(TAG, "onServicesDiscovered:" + "status = " + status);
        }

    In the logcat, it show onConnectionStateChange..., it works, but due to timeout reason, it didn't reach the onServicesDiscovered.

    Be sure, your Android version must be 4.3 or later, because BLE is a new feature addded by Google in 4.3.

  • Hi Yuandan,

    Thank for providing the APP.

    I have tried initiating connection from your app to CC2564. I was not able to establish the connection.

    Instead  I have downloaded “BLE Explorer (Alpha)” app from Play Store. I was able to establish the connection successfully, Without any problem. And even was able to send the notification from the CC2564 to my android phone(Nexus 4 – with Android version must be 4.4 ).

    So I suspect that there is some problem in your APP.

  • Thanks for your tips. I will try that App.

    Also, what is the logcat output when you used my App? If the output include "onServicesDiscovered" string, so I think that's success, because the Activity don't give any response. Please help to check it.

  • Hi,

    I use the BLE explorer(alpha) to test, the result is same, CC2564 can't not send Service data to Android Phone, although the Activity display "Connected", that's only mean the LMP layer success, but HCI ACL data can't be send.

    I also update my App, you can try the new http://code.google.com/p/haiii/downloads/detail?name=iFere.apk&can=2&q=#makechanges , now I add the connection result on screen. So, it's the same as BLE explorer.

    Now I advise to check the following checklist.

    1, Does my bts initialization OK? My answer is: Because the CC2564 can be finded, so I think the bts is ok.

    2, Does my LE advertise parameter OK? Because the CC2564 can be finded, so I think the parameter is OK

    3, Dose my LE advertise data OK? Because the CC2564 local name is OK, and also can be finded, so I think it's ok, but what's the trueth?

    4, Dose my responding data format OK? The responsing data is very simple, so I think there is no extra problem.

    Also, could you help the debug step by step on your CC2564, find what happened when CC2564 receive "gatt discovery all primary service"? And find how you response?

    Yuandan

  • Hi Yuandan,

     

    Let me give you an example of what I did? Let’s take the Heart rate demo:

    ON the CC256x terminal  once I have the console ready I have run the below two commands:

    LE>RegisterHRS 1

    Successfully registered HRP Service.

    LE>AdvertiseLE 1

       GAP_LE_Advertising_Enable success.

     

    Initiate the connection from you android phone.

    And after the connection was successful, I have click on the Heart rate Measurement on the BLE app of my phone to register the service,  I have run the below command and I could see

    //once the connection is successful you will see the below: 

    LE>

    etLE_Connection_Complete with size 18.

       Status:       0x00.

       Role:         Slave.

       Address Type: Public.

       BD_ADDR:      0x10683F59E8A1.

     

    LE>

    etGATT_Connection_Device_Connection with size 12:

       Connection ID:   1.

       Connection Type: LE.

       Remote Device:   0x10683F59E8A1.

       Connection MTU:  23.

    //send notification 

    LE>NotifyHeartRate 80 1 2 1 0

    HRS_Notify_Heart_Rate_Measurement success.

     

    LE>NotifyHeartRate 79 1 2 1 0

    HRS_Notify_Heart_Rate_Measurement success.

     

    To see if I receive any update on my android phone and I could see the data on my android phone.

    Please see http://processors.wiki.ti.com/index.php/CC256x_MSP430_Bluetopia_Basic_HRPDemo_APP

  • Can you show me the command "AdvertiseLE 1" corresponding data packet bytes content?

     

  • Hi Yuandan,

    Please check the AdvertiseLE() method in the HRPDemo.c file.

  • Sorry, because I don't have MSP430 Bluetopia EVM, so I only take a look in the C file, and finded that in that function, it then call GAP_LE_Advertising_enalbe(...) function, but I can't find the source of it.

    Could you please send me GAP_LE_Advertising_eanble() implementation? Then I can check exactly what the difference is between the demo code with my code?

     

     

  • I think the implementation should be in the libBluetopia.a, it's disclosed, but I only need  GAP_LE_Advertising_eanble() function, especially about how the parameter "ConnectabilityParameters" is processed.

                      ConnectabilityParameters.Connectability_Mode   = LE_Parameters.ConnectableMode;
                      ConnectabilityParameters.Own_Address_Type      = latPublic;
                      ConnectabilityParameters.Direct_Address_Type   = latPublic;
                      ASSIGN_BD_ADDR(ConnectabilityParameters.Direct_Address, 0, 0, 0, 0, 0, 0);

                      /* Now enable advertising.                            */
                      ret_val = GAP_LE_Advertising_Enable(BluetoothStackID, TRUE, &AdvertisingParameters, &ConnectabilityParameters, GAP_LE_Event_Callback, 0);

    I don't know how to process the highlight color param when send advertising cmmand.

     

  • I had download that before. But the mentioned function is in a library which is not open source.

    Another way you can help me is that you can capture the HCI ACL data after call AdvertiseLE command, this may be easy for you, and is all what I want. so I can compare whether my data packet format is wrong, or else, I need to check somewhere initialization process.

  • Hi, Sundeep

    The link you specified only show CC2564 as a client(master), it discover nearby devices and then connect to it. But what I want is to make CC2564 as a server(slave), it should first set advertise parameters and then set advertise data, I need to know exactly what the packets is for this two comand? 

    If you have the EVM board, could you capture these packets data at the UART of MCU, because the CC2564 communicate with MCU by UART port.

    Thanks.

     

  • Hi Yuandar,

    The link I provided is for a case where we use two CC256x devices (one running as server and the other as client). So the advertising data that you see in the link is indeed the advertising parameters that is set by the same app running as server. So you can directly take the advertising parameters from that and use it for your app.

    Just for my understanding, what stack are you using on the CC256x side?