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:在 cp3Wire HCI 配置上更新 UART 波特率时出现问题

Guru**** 2392115 points
Other Parts Discussed in Thread: CC2564C

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

https://e2e.ti.com/support/wireless-connectivity/bluetooth-group/bluetooth/f/bluetooth-forum/1060050/cc2564c-problems-with-updating-uart-baudrate-on-cp3wire-hci-configuration

器件型号:CC2564C

您好!

我将 Bluetopia 用于 STM32 v4.2.1.1、并将自定义电路板用于 STM32F7和 CC2564C (我已经为 F7移植了 Bluetopia)。 由于 PCB 设计以及我想使用 OOF 流控制、我想使用 cp3WIre 类型的连接。 到目前为止、一切都正常、但我正在努力更新 UART 波特率。 每次我调用 VS_Update_UART_Baud_rate ()时,我都会成功,但是主机更改其波特率,而控制器则不会更改,这会导致以后出现错误。 我尝试分析使用逻辑分析仪发送的内容、它看起来也很奇怪:在调用 HCI_Send_Raw_Command (VS_Update_UART_Baud_rate ()的一部分)之后、从主机发送的最后一条命令的第一个字节(0xC0)看起来像使用旧波特率发送的、其余字节则更新了:

然后 CC 以旧波特率进行响应:

我需要添加该内容、例如 cpHCILL 配置、更新 UART 可以正常工作。

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

    void MainThread()
    {
    
       int                           Result;
       BTPS_Initialization_t         BTPS_Initialization;
       HCI_DriverInformation_t       HCI_DriverInformation;
       HCI_HCILLConfiguration_t      HCILLConfig;
       HCI_Driver_Reconfigure_Data_t DriverReconfigureData;
    
       HCI_3WireLinkConfiguration_t HCI3WireLinkConfig;
       HCI_3WireConfiguration_t		HCI3WireConfig;
    
       /* 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"));
    		   }
    	   }
    
    
    	   HCI3WireLinkConfig.SupportOOFFlowControl = TRUE;
    	   HCI3WireLinkConfig.SupportCRC = TRUE;
    	   HCI3WireLinkConfig.SlidingWindowSize = 0x2;
    
    	   memset(&HCI3WireConfig,0, sizeof(HCI3WireConfig));
    	   HCI3WireConfig.LinkConfiguration = HCI3WireLinkConfig;
    	   HCI3WireConfig.SleepCallbackFunction = Sleep_Indication_Callback;
    	   HCI3WireConfig.Flags = 0x01;
    
    	   DriverReconfigureData.ReconfigureCommand = HCI_COMM_DRIVER_RECONFIGURE_DATA_COMMAND_CHANGE_3WIRE_PARAMETERS;
    	   DriverReconfigureData.ReconfigureData    = (void *)&HCI3WireConfig;
    
    	   Result = HCI_Reconfigure_Driver((unsigned int)Result, TRUE, &DriverReconfigureData);
    
    	   if(Result == 0)
    	   {
    		   /* OOF flow control is enabled.                         */
    		   DbgPrintf(("OOF flow control is allowed.\r\n"));
    	   }
    
    	   HCI_COMMReconfigureInformation_t HCICOMMConfig;
    	   HCICOMMConfig.ReconfigureFlags = HCI_COMM_RECONFIGURE_INFORMATION_RECONFIGURE_FLAGS_CHANGE_XON_XOFF;
    	   HCICOMMConfig.UseXonXoff = TRUE;
    	   HCICOMMConfig.XonValue = 0x11;
    	   HCICOMMConfig.XoffValue = 0x13;
    
    	   DriverReconfigureData.ReconfigureCommand = HCI_COMM_DRIVER_RECONFIGURE_DATA_COMMAND_CHANGE_COMM_PARAMETERS;
    	   DriverReconfigureData.ReconfigureData    = (void *)&HCICOMMConfig;
    
    	   Result = HCI_Reconfigure_Driver(1, FALSE, &DriverReconfigureData);
    
    	   if(Result == 0)
    	   {
    		   /* COMM parameters for OOF flow control changed.                         */
    		   DbgPrintf(("COMM parameters changed.\r\n"));
    	   }
    
    
    	   	   unsigned char buffer[1] = {0x11};
    	   	   BTPS_Delay(500);
    	   	   HCITR_COMWrite(1, 1, buffer);
    	   	   BTPS_Delay(500);
    
       	   int ret_val = VS_Update_UART_Baud_Rate(1, 3686400);
    
       	   if(!ret_val) {
       		   Display(("VS_Update_UART_Baud_Rate (%d): Success.\r\n", 3686400);
       	   } else {
       		   Display(("VS_Update_UART_Baud_Rate: Failure %d.\r\n", ret_val));
       	   }
    
    
       	BTPS_Delay(1000);
    
    	ClientMode(NULL);
    	StartScanning(NULL);
          while(1)
          {
        	 BTPS_Delay(100);
          }
      }
    }

    IM 附加部分代码。

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

    尊敬的 Marek:

    很抱歉耽误你的时间。 您是否尝试将波特率设置为3686400 (3.7Mbps)?  

    您能否尝试从一个适用于 cpHCILL 的示例(可能是 SPPDemo)开始、然后只将此行更改为 cp3Wire?

    HCI_DRIVER_SET_COMM_information (&HCI_DriverInformation、7、VENDOR_BAUD_RATE、cp3Wire);

    谢谢、
    Jacob