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.

RE: Multiple SPP Connections

Other Parts Discussed in Thread: CC2564

Hi Stonestreet One,
I succeed to connect my CC2564 module to 7 phones following your instruction, but, I want to run 7 Apps on one phone, and these 7 Apps are all connect to CC2564 module simultaneously, I failed, only one App can be connected. that's why? thanks in advance!

Best regard!
Gerry Li
  • Hi Gerry,

    I've split your thread from: e2e.ti.com/.../253037 for better tracking.

    From the description of your problem, it looks like some issue with your phone app. Are all the 7 Apps sharing one ACL connection ? Please note that only one ACL connection can exist between two BR/EDR Controllers (as per the Bluetooth Specification). At the profile level, there can be multiple connections...

    Regards,
    Gigi Joseph.
  • Hi Joseph Gigi
    I have same question about CC2564B. I run 2 Apps on one phone,and 2 Apps are all connect to CC2564 module simultaneously.But,CC2564B can not. I succeed to connect CC2564B to 2 phones. that's why? thanks!

    Regards
  • I suceed to connect CC2564B to the first SPP APP of one phone,then I use second SPP APP of same phone to connect CC2564B.This operation is not successful.
    This is the LOG received by HCI UART of STM32.

    > 32
    < 33
    > 02 01 20 0C 00 08 00 01 00 02 0F 04 00 01 00 42 00
    < 02 01 20 10 00 0C 00 01 00 03 0F 08 00 44 00 42 00 00 00 00 00
    < 02 01 20 10 00 0C 00 01 00 04 05 08 00 42 00 00 00 01 02 F9 03
    > 04 13 05 01 01 00 02 00 02 01 20 10 00 0C 00 01 00 04 10 08 00 44 00 00
    > 00 01 02 00 01
    < 02 01 20 12 00 0E 00 01 00 05 10 0A 00 42 00 00 00 00 00 01 02 00 01
    > 02 01 20 0E 00 0A 00 01 00
    > 05 05 06 00 44 00 00 00 00 00
    > 04 13 05 01 01 00 01 00
    > 02 01 20 26 00 22 00 44 00 06 00 00 00 1D 35 11 1C 00 00 11 01 00 00 10 00 80 00 00 80 5F 9B 34 FB 00 F0 35 05 0A 00 00 FF FF 00
    < 02 01 20 90 00 8C 00 42 00 07 00 00 00 87 00 84 35 82 35 3F 09 00 00 0A 00 01 00 00 09 00 01 35 03 19 11 01 09 00 04 35 0C 35 03 19 01 00 35 05 19 00 03 08 01 09 01 00 25 19 53 65 72 69 61 6C 20 50 6F 72 74 20 53 65 72 76 65 72 20 50 6F 72 74 20 31 35 3F 09 00 00 0A 00 01 00 01 09 00 01 35 03 19 11 01 09 00 04 35 0C 35 03 19 01 00 35 05 19 00 03 08 01 09 01 00 25 19 53 65 72 69 61 6C 20 50 6F 72 74 20 53 65 72 76 65 72 20 50 6F 72 74 20 31 00
    > 04 13 05 01 01 00 01 00
    > 02 01 20 0C 00 08 00 01 00 06 11 04 00 44 00 42 00
    < 02 01 20 0C 00 08 00 01 00 07 11 04 00 44 00 42 00
    > 04 13 05 01 01 00 01 00
    > 30
    < 31

     I hope this is helpful !  Thank you very much!

    Best regard!
    zhao%20zhang72

  • Hi Gigi Joseph,
    I don't thinks the issue was caused by phone App, for I tested with CC2564 module from my competitor, 7 Apps are all connected to this module successfully, same phone, same App, just different CC2564 modules.

    Regards!
    Gerry
  • Hi Gerry,

    It's very hard to debug with partial logs.
    Can you share the snoop logs from the phone side for better understanding.

    Regards,
    Gigi Joseph.
  • 5025.Log.rarGigi,

    Attached pls find the log for this case.

     

    Description:

    Use MTK Smart phone install two SPP apps. First is to connect with CC2564, then is to connect with another BT module.

    let's know if any more need, thanks.

     

    Regards,

    Andy

  • Hi Andy,

    Can you please advise which format this log is?

    Regards,
    Gigi Joseph.
  • Gigi,

    Sorry for the late reply, we paid a little time for this discussion with customer.

    This log is captured by the end customer, while they captured it with MTK smart phone, but it is hard to open it as customer only review it with smart phone.

    Meanwhile, we captured it with BPA-600, attached.

    Regards,

    Andy6765.Log.rar

  • BTW, there are two log we captured, one is ok with CC2564 module, another is for this issue based on customer CC2564 board.

    Regards,
    Andy
  • Hi Andy,

    I reviewed the logs.
    In "OK with module.cfa" logs, please check Frame# 9012.
    It's as below:

    ***
    SDP:
    Link: 1
    Role: Slave
    Address: 7
    PDU ID: SDP_ServiceSearchAttributeResponse
    Transaction ID: 0x0001
    Parameter Length: 432
    Attribute List Byte Count: 429
    Service Record Attributes
    Attribute List
    Attribute: Service Record Handle
    Service Record Handle: 0x 00 01 00 06
    Attribute: Service Class ID List
    UUID: Serial Port
    Attribute: Protocol Descriptor List
    UUID: L2CAP
    UUID: RFCOMM
    Channel Number: 6
    Attribute: Language Base Attribute ID List
    Language Identifier: ENGLISH
    Character Encoding: 0x006a
    Language base ID: 0x0100
    Attribute: Service Name
    String: SPP Service
    Attribute List
    Attribute: Service Record Handle
    Service Record Handle: 0x 00 01 00 05
    Attribute: Service Class ID List
    UUID: Serial Port
    Attribute: Protocol Descriptor List
    UUID: L2CAP
    UUID: RFCOMM
    Channel Number: 5
    Attribute: Language Base Attribute ID List
    Language Identifier: ENGLISH
    Character Encoding: 0x006a
    Language base ID: 0x0100
    Attribute: Service Name
    String: SPP Service
    Attribute List
    Attribute: Service Record Handle
    Service Record Handle: 0x 00 01 00 04
    Attribute: Service Class ID List
    UUID: Serial Port
    Attribute: Protocol Descriptor List
    UUID: L2CAP
    UUID: RFCOMM
    Channel Number: 4
    Attribute: Language Base Attribute ID List
    Language Identifier: ENGLISH
    Character Encoding: 0x006a
    Language base ID: 0x0100
    Attribute: Service Name
    String: SPP Service
    Attribute List
    Attribute: Service Record Handle
    Service Record Handle: 0x 00 01 00 03
    Attribute: Service Class ID List
    UUID: Serial Port
    Attribute: Protocol Descriptor List
    UUID: L2CAP
    UUID: RFCOMM
    Channel Number: 3
    Attribute: Language Base Attribute ID List
    Language Identifier: ENGLISH
    Character Encoding: 0x006a
    Language base ID: 0x0100
    Attribute: Service Name
    String: SPP Service
    Attribute List
    Attribute: Service Record Handle
    Service Record Handle: 0x 00 01 00 02
    Attribute: Service Class ID List
    UUID: Serial Port
    Attribute: Protocol Descriptor List
    UUID: L2CAP
    UUID: RFCOMM
    Channel Number: 2
    Attribute: Language Base Attribute ID List
    Language Identifier: ENGLISH
    Character Encoding: 0x006a
    Language base ID: 0x0100
    Attribute: Service Name
    String: SPP Service
    Attribute List
    Attribute: Service Record Handle
    Service Record Handle: 0x 00 01 00 01
    Attribute: Service Class ID List
    UUID: Serial Port
    Attribute: Protocol Descriptor List
    UUID: L2CAP
    UUID: RFCOMM
    Channel Number: 1
    Attribute: Language Base Attribute ID List
    Language Identifier: ENGLISH
    Character Encoding: 0x006a
    Language base ID: 0x0100
    Attribute: Service Name
    String: SPP Service
    Bytes for continuation length: 0
    ***

    There are six RFCOMM channels registered for SPP. The remote device apps will connect to each of these ports. Whereas in "Issue with CC2564.cfa" case, it's as below:

    ***
    SDP:
    Link: 1
    Role: Master
    Address: 1
    PDU ID: SDP_ServiceSearchAttributeResponse
    Transaction ID: 0x0000
    Parameter Length: 70
    Attribute List Byte Count: 67
    Service Record Attributes
    Attribute List
    Attribute: Service Record Handle
    Service Record Handle: 0x 00 01 00 00
    Attribute: Service Class ID List
    UUID: Serial Port
    Attribute: Protocol Descriptor List
    UUID: L2CAP
    UUID: RFCOMM
    Channel Number: 1
    Attribute: Service Name
    String: Serial Port Server Port 1
    Bytes for continuation length: 0
    ***

    There's only one channel available for SPP.
    It looks to me that you're not using the same software.

    Regards,
    Gigi Joseph.
  • Hi Joseph Gigi,

    No, they are not the same software. we test our CC2564 board based on "CC256X BT\CC256x STM32 Bluetopia SDK\v4.0.2.2\NoOS\STM3240G-EVAL\Samples\SPPLEDemo",

    I don't what's the SDK of competitor's module, I just see MCU EFM32G210F128 on the module. thanks!

    There's only one channel available for SPP.

    Best Regards!

    Gerry Li

  • Hi Gerry,

    The default SPPLEDemo app registers 1 port. But you can easily extend to 7 ports (memory permitting) by calling SPP_Open_Server_Port() & SPP_Register_Generic_SDP_Record() recursively.

    Regards,
    Gigi Joseph.
  • Hi Joseph Gigi,

    ret_val = SPP_Open_Server_Port(BluetoothStackID, ServerPortNumber, SPP_Event_Callback, (unsigned long)0);

             If I call this function seven times, how to set the ServerPortNumber parameter?

             SPP_Register_Generic_SDP_Record(BluetoothStackID, ServerPortID, ServiceName, &SPPServerSDPHandle);

             how to set the ServerPortID parameter?

    Regards,

  • Hi,

    What is the problem?

    ***
    for (i=0;i<7;i++){
    ret_val = SPP_Open_Server_Port(BluetoothStackID, i+1, SPP_Event_Callback, (unsigned long)0);
    //if success
    ServerPortID = ret_val;
    ret_val = SPP_Register_Generic_SDP_Record(BluetoothStackID, ServerPortID, ServiceName, &SPPServerSDPHandle);
    }
    ***

    Please note from the documentation: "The port number *MUST* be between SPP_PORT_NUMBER_MINIMUM and SPP_PORT_NUMBER_MAXIMUM."

    Regards,
    Gigi Joseph.
  • Hi Joseph Gigi,
    I have the same problem with Li Gerry.

    ***
    for (i=0;i<7;i++){
    ret_val = SPP_Open_Server_Port(BluetoothStackID, 1, SPP_Event_Callback, (unsigned long)0);
    //if success
    ServerPortID = ret_val;
    ret_val = SPP_Register_Generic_SDP_Record(BluetoothStackID, ServerPortID, ServiceName, &SPPServerSDPHandle);
    }
    ***
    I use the above code, I can successfully connect seven different mobile phones。But I use the following code, only successfully connected to a mobile phone
    ***
    for (i=0;i<7;i++){
    ret_val = SPP_Open_Server_Port(BluetoothStackID, i+1, SPP_Event_Callback, (unsigned long)0);
    //if success
    ServerPortID = ret_val;
    ret_val = SPP_Register_Generic_SDP_Record(BluetoothStackID, ServerPortID, ServiceName, &SPPServerSDPHandle);
    }
    ***
    So I don't understand why.

    Regards,

    zhao%20zhang72
  • HI Joseph Gigi,

    zhang zhao is my customer, let me clarify the issue.

    SPP_Open_Server_Port(BluetoothStackID, ServerPort, SPP_Event_Callback, (unsigned long)0);

    1)  if I call SPP_Open_Server_Port() 7 times, and ServerPort is from 1~7,  

    then:

    a> tested with PC: 7 Apps(running on one PC with BLE dongle) can all be connected to my board successfully.

    b> tested with 7 smartphone: only one (the first one) phone can be connected to my board successfully.

    c> tested with 7 Apps in one smartphone: only one (the first one) App can be connected to my board successfully.

    2)  if I call SPP_Open_Server_Port() 7 times, and ServerPort =1 each time, 

    then:

    a> tested with PC: only one Apps(running on one PC with BLE dongle) can all be connected to my board successfully.

    b> tested with 7 Apps in 7 smartphones: all the 7 APPs(running in different phones) can be connected to my board successfully.

    c> tested with 7 Apps in 1 smartphone:  only one (the first one) App can be connected to my board successfully.

    All the above reappears using "STM3240G-EVA + CC256XQFNEM"  thanks!

    my target is: tested with 7 Apps in 1 smartphone:  all the App can be connected to my board successfully.

    note: all the phone mentioned above is Android phone, core version >= android 4.3

    Best Regards!

    Gerry Li

  • Hi Joseph Gigi,

    Here I attached the log from CC2564 TXD_DBG pin, FYI.

    you can download it and open it by Logger.exe.cc2564_log.zip

     

    Best Regards!

    Gerry Li

  • Gigi,

    We appreciated your support for this case.

    As this case is pending for this issue, customer has placed first order and wait for production, would you kindly check this issue again and let's know if any more information need?

    Again, this issue is we need run 7 APPs in one smart phone, need each APPs could connect CC2564 individually, how to modified it based on TI stack?

    Based on current SDK, we can only run one APPs in one smart phone, but could not support with more APPs..

    Regards,

    Andy

  • Hi Andy,

    Can you tell me which app are you running on the smartphone so I can try it on my setup?

    Regards,
    Gigi Joseph.
  • Also, can you share the snoop log from the Android phone?
  • Joseph,

    Just double check it with you.

    For Apps, Gerry has post it fyi.

    For Log from Android smart phone, we have capture the log with BPA-600, while this air log is for both CC2564 and Smart phone works, should include how Android works.. Pls find it attached.  

    Or do you need the log from Android smart phone output? For example, the MTK platform smart phone, it should output the log, while that's what you want.

    Thanks and Regards

    Andy.Log - issue.rar

  • Hi,

    Never mind about the snoop logs, I could get it myself.
    Thanks for the apps!I can now understand what you're saying.

    The problem is not with the CC256x device or stack as the Android phone is not even sending the connect request over the air.
    The logcat log on the android phone is as below (for the second connection):


    ***
    01-28 16:40:53.707  3243 12961 E bt-rfcomm: RFCOMM_CreateConnection - already opened state:2, RFC state:4, MCB state:5
    01-28 16:40:53.707  3243 12961 E bt-btif : bta_jv_rfcomm_connect, RFCOMM_CreateConnection failed
    01-28 16:40:53.707  3243 12986 W bt-btif : invalid rfc slot id: 7
    ***

    So it seems there is a bug with the bluedroid stack in allowing multiple SPP connections to the same device or it could be a problem with the individual apps not connecting to the correct channel. 
    You would need to check this on some Android forums.

    I performed the same tests with the BlueZ stack running on my PC and could connect all 7 ports running on my STM32  + CC256xB.
    So, quite obviously, the problem is on the smartphone side.

    I am attaching the PC snoop log for reference.multiple_spp_connection.log


    Regards,
    Gigi Joseph.

  • Dear Joseph,

    Appreciate you help very much!  I'm disty FAE and I'm working with Andy for this issue.

    I'm agree with you(about "So it seems there is a bug with the bluedroid stack in allowing multiple SPP connections to the same device or it could be a problem with the individual apps not connecting to the correct channel. ").

    But, there is a CC2564 module from market that can support multiple SPP connection from many Apps with one android phone. so, for the bug you mentioned above, do we have any way to workaround it? do you have any suggestions?  thanks a lot!

     

    BTW, I cannot open the log file you attached. would you help provide .txt version If you are convenient.

     

    Best Regards!

    Gerry Li

  • Hi Gerry,

    But, there is a CC2564 module from market that can support multiple SPP connection from many Apps with one android phone. so, for the bug you mentioned above, do we have any way to workaround it? do you have any suggestions? thanks a lot!
    >>> I am not familiar enough with the bluedroid stack to suggest a work around. Perhaps you can share or check for yourself the logcat logs and identify what is different in the phone side that makes the multiple connection possible

    BTW, I cannot open the log file you attached. would you help provide .txt version If you are convenient.
    >>> The logs are in btsnoop format. You can use the Capture File Viewer from FTSE or wireshark to open the logs. Exporting to text format is not a good option.

    Regards,
    Gigi Joseph.