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.

[参考译文] CC2564C:SPP 端口在连接后关闭

Guru**** 2810875 points

Other Parts Discussed in Thread: CC2564C

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1013436/cc2564c-spp-port-closing-after-connection

器件型号:CC2564C

e2e.ti.com/.../btsnoop_5F00_spp_5F00_not_5F00_working.loge2e.ti.com/.../btsnoop_5F00_spp_5F00_working.log

您好!

我尝试通过 SPP (串行蓝牙终端应用)将 Android 设备连接到 CC2564C、以 FreeRTOS SPPLE 演示为基础。 它很少工作、通常在从 Android 连接到设备后20秒、端口关闭。 我在 Android 6和10上进行了测试。 日志:

服务器已打开:服务器端口4、串行端口 ID 1。
存储了服务器端口上下文。

atPINCodeRequest:0xA450466DEC32
用:PINCodeResponse 进行响应
GAP_Authentication_Response ()、Pin Code Response Success。

SPP+LE>
atLinkKeyCreation:0xA450466DEC32
已存储链接密钥。

atLinkKeyRequest:0xA450466DEC32
GAP_Authentication_Response 成功。

SPP+LE>
SPP 开路指示、ID:0x0001、电路板:0xA450466DEC32。

SPP+LE>
SPP 端口状态指示:0x0001、状态:0x000B、中断状态:0x0000、长度:0x0000。

SPP 关闭端口、ID:0x0001

我还在连接来自成功和失败尝试的 btssnoop 日志(代码仍然相同)。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您是否会看到 SPPDemo 的相同问题、SPPDemo 是一个更简单的 SPP 演示、它没有启用 LE 支持等功能?

    此致、

    Michael

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的、我看到与 SPPDemo 完全相同。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    在我的 STM32 FreeRTOS 设置上运行 SPPDemo 时、我没有看到同样的问题-我的 Android 手机能够毫无问题地连接到 CC2564C。 有关我运行的命令、请参阅以下日志:

    OpenStack().
    Bluetooth Stack ID: 1
    Device Chipset: Unknown (greater 4.1)
    BTPS Version  : 4.2.1.0
    PLAT Version  : 1.0
    App Name      : SPPDemo
    App Version   : 0.3
    Project Type  : 6
    FW Version    : 12.23
    Local BD_ADDR: 0x985DAD120381
    
    ******************************************************************
    * Command Options: Server, Client, Help                          *
    ******************************************************************
    
    Choose Mode>server
    
    ******************************************************************
    * Command Options: Inquiry, DisplayInquiryList, Pair,            *
    *                  EndPairing, PINCodeResponse, PassKeyResponse, *
    *                  UserConfirmationResponse,                     *
    *                  SetDiscoverabilityMode, SetConnectabilityMode,*
    *                  SetPairabilityMode,                           *
    *                  ChangeSimplePairingParameters,                *
    *                  GetLocalAddress, GetLocalName, SetLocalName,  *
    *                  GetClassOfDevice, SetClassOfDevice,           *
    *                  GetRemoteName, SniffMode, ExitSniffMode,      *
    *                  Open, Close, Read, Write,                     *
    *                  GetConfigParams, SetConfigParams,             *
    *                  GetQueueParams, SetQueueParams,               *
    *                  Loopback, DisplayRawModeData,                 *
    *                  AutomaticReadMode, SetBaudRate, Send          *
    *                  Help, Quit                                    *
    ******************************************************************
    
    Server>open 1
    Server Opened: 1.
    
    Server>getlocalname
    Name of Local Device is: SPPDemo.
    
    Server>setdiscoverabilitymode 2
    Discoverability: General.
    
    Server>setconnectabilitymode 1
    Connectability Mode: Connectable.
    
    Server>setpairabilitymode 1
    Pairability Mode Changed to pmPairableMode.
    
    Server>
    atPINCodeRequest: 0xC418E98E28EA
    Respond with: PINCodeResponse
    
    Server>pincoderesponse 0000
    GAP_Authentication_Response(), Pin Code Response Success.
    
    Server>
    atLinkKeyCreation: 0xC418E98E28EA
    Link Key Stored.
    
    Server>
    atLinkKeyRequest: 0xC418E98E28EA
    
    GAP_Authentication_Response success.
    
    Server>
    SPP Open Indication, ID: 0x0001, Board: 0xC418E98E28EA.
    HCI Connection Handle: 0x0001.
    
    Server>
    SPP Port Status Indication: 0x0001, Status: 0x000B, Break Status: 0x0000, Length: 0x0000.
    
    Server>
    SPP Data Indication, ID: 0x0001, Length: 0x000D.
    
    Server>read 11
    Read: 13.
    Message: hello world
    
    Read: 0.
    
    Server>
    HCI Mode Change Event, Status: 0x00, Connection Handle: 1, Mode: Sniff, Interval: 792
    
    Server>

    您使用哪款 Android 应用进行测试? 我使用的是"蓝牙终端 HC-05"。 如果您使用该应用程序、您是否会获得不同的结果?


    此致、

    Michael

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    我使用的是"串行蓝牙终端"。 我下载了您建议的应用程序、第一次尝试时它可以正常工作、但第二次尝试时它不能正常工作。 我尝试了几次、有时它可以工作、有时不工作、我真的不知道为什么。 您是否多次尝试这样做?

    此外、我还必须添加、我不通过键入命令来打开服务器、但我在应用程序的某个线程中执行此操作:

    void SPPMainThread()
    {
    
       int                           Result;
       BTPS_Initialization_t         BTPS_Initialization;
       HCI_DriverInformation_t       HCI_DriverInformation;
       HCI_HCILLConfiguration_t      HCILLConfig;
       HCI_Driver_Reconfigure_Data_t DriverReconfigureData;
    
       /* Configure the UART Parameters.                                    */
       HCI_DRIVER_SET_COMM_INFORMATION(&HCI_DriverInformation, 7, VENDOR_BAUD_RATE, cp3Wire);
       HCI_DriverInformation.DriverInformation.COMMDriverInformation.InitializationDelay = 100;
    
       /* Set up the application callbacks.                                 */
       BTPS_Initialization.MessageOutputCallback = DbgPrintfCallback;
    
       /* Initialize the application.                                       */
       if((Result = InitializeApplication(&HCI_DriverInformation, &BTPS_Initialization)) > 0)
       {
    	   /* Register a sleep mode callback if we are using HCILL Mode.     */
    	   if((HCI_DriverInformation.DriverInformation.COMMDriverInformation.Protocol == cpHCILL) || (HCI_DriverInformation.DriverInformation.COMMDriverInformation.Protocol == cpHCILL_RTS_CTS))
    	   {
    		   HCILLConfig.SleepCallbackFunction        = Sleep_Indication_Callback;
    		   HCILLConfig.SleepCallbackParameter       = 0;
    		   DriverReconfigureData.ReconfigureCommand = HCI_COMM_DRIVER_RECONFIGURE_DATA_COMMAND_CHANGE_HCILL_PARAMETERS;
    		   DriverReconfigureData.ReconfigureData    = (void *)&HCILLConfig;
    
    		   /* Register the sleep mode callback.  Note that if this        */
    		   /* function returns greater than 0 then sleep is currently     */
    		   /* enabled.                                                    */
    		   Result = HCI_Reconfigure_Driver((unsigned int)Result, FALSE, &DriverReconfigureData);
    		   if(Result > 0)
    		   {
    			   /* Flag that sleep mode is enabled.                         */
    			   DbgPrintf(("Sleep is allowed.\r\n"));
    		   }
    	   }
    
        ServerMode(NULL);
        BTPS_Delay(500);
        ParameterList_t server_params;
        server_params.NumberofParameters = 1;
        server_params.Params[0].intParam = 1;
        OpenServer(&server_params);
    
          /* Loop forever and process UART characters.                      */
          while(1)
          {
        	  BTPS_Delay(200);
          }
       }
    }

    也许我错过了一些东西...

    此致、

    Marek

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Marek:

    借助蓝牙终端 HC-05应用程序、我可以反复连接至 SPPDemo、而不会出现任何问题。

    您使用的是自己的定制板、还是使用的是 TI EVM?

    此致、

    Michael

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    IM 使用带 CC2564C 和 STM32F7的定制板(我将 Bluetopia 从 F4移植到 F7)。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    您是否可以使用 EVM 测试代码、以确保您的定制板不会出现问题? 如果您使用的是 STM32F4、您还可以查看修改后的移植层是否是问题的原因。

    此致、

    Michael