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: HCI packets getting corrupted

Part Number: CC2564C
Other Parts Discussed in Thread: CC2564

  

1. Our project is STM32+CC2564C, using SPPdemo communication, the packaging parameters are: 1010 2020 3030, after the communication distance is long, the software of the host computer will suddenly not receive feedback during the communication process,
2. We captured the HCI data and found that the data in the HCI data output by CC2564 has errors, which should be caused by the data transmission in the air. The STM32 application layer also did not receive etPort_Data_Indication
3. Does this kind of error have corresponding event information transmitted to the PC software? Or Bluetopia will send the corresponding error event to the SPP_Event_Callback application layer. There seems to be no error event information in the SPP_Event_Type_t structure.
typedef enum
{
etPort_Open_Indication, /*!< Indicate that a Remote Port Open connection has been made. */
etPort_Open_Confirmation, /*!< Confirm that a Port Open request has been responded to or errored out. */
etPort_Close_Port_Indication, /*!< Indicate that a port has been closed (unregistered). */
etPort_Status_Indication, /*!< Indicate that a change in port status has been received. */
etPort_Data_Indication, /*!< Indicate that data has arrived on a port. */
etPort_Transmit_Buffer_Empty_Indication, /*!< Indicate when the Transmit Buffer is Empty (only if the Transmit Buffer was completely full or the SPP_Purge_Buffer() function was called with the option to flush the buffer). */
etPort_Line_Status_Indication, /*!< Indicate that a change in line status has been received. */
etPort_Send_Port_Information_Indication, /*!< Indicate that a remote device's port parameters have been received (start of negotiation of parameters). */
etPort_Send_Port_Information_Confirmation, /*!< Confirm that a response has been received to a send port parameters command.*/
etPort_Query_Port_Information_Indication, /*!< Indicate that a request to send current port parameters has been received. */
etPort_Query_Port_Information_Confirmation, /*!< Confirm that a response has been received to a request to send current port parameters. */
etPort_Open_Request_Indication /*!< Indicate that a Remote Port Open request has been received. */
} SPP_Event_Type_t;

4. HCI receives data error and fails to decode and send the corresponding event information to SPP_Event_Callback of STM32. Is there an error message in this case? How to send the error message to the PC host and let it resend the data?

  • Supplementary information: The correct packet header should look like this:  0x02 0x01 0x20 0xFC    0x03    0xF8 0x03 0x83 0x00 0x0B 0xFF 0xE4 0x07 0x00....
    The actual data from CC2564 to STM32 data line is:                                       0x02 0x01 0x20 0xFC    0x00    0xF8 0x03 0x83 0x00 0x0B 0xFF 0xE4 0x07 0x00....
    The length information is wrong, and then the decoder does not send the callback information to SPP_Event_Callback.

  • Hey Xudong,

    Can you take HCI logs according to this guide

    4. HCI receives data error and fails to decode and send the corresponding event information to SPP_Event_Callback of STM32. Is there an error message in this case? How to send the error message to the PC host and let it resend the data?

    Can you explain where you receive the HCI data error? Do you see HCI packet errors on the STM32/CC2564C setup or on the PC? Any logs or error codes you share will be helpful.

    Thanks,

    Jacob

  • Error_220905.rar

    Hello,

      The attachment is a captured Log, because the problem occurs sometimes, 1 or 2 times in an hour.

  • AutoSave Session 01 - #0076.rar

    Hello,

      Jacob, we have found the problem of data error, because the baud rate of HCI is 4M, and the data error problem has not been found when it is reduced to 2M.
    There is one more question, how to increase the Credit of RFCOMM. I see that the API function of RFCOMM includes RFCOMM_Send_Credits. Is there an example of using this function?

    During the communication process, due to the wireless packet loss of data, the credit on the PC side is insufficient, and the data is stopped. Is there any way to actively increase the credit on the PC side?

      Our application is that the PC communicates with the Bluetooth module through the virtual serial port. The communication takes about an hour, and sometimes two hours, the data on the PC side cannot be sent. The PC side must disconnect the serial port connection and reconnect it to communicate normally. We want to Find a way to continue communication without disconnecting the serial port.

      The attachment is the log file before and after the communication interruption, the log of the whole process is there, if you need, I will upload all of them.

  • Hi Xudong,

    I did see an error in your Error_220905.lgr file:

    Sounds like you root caused it to be due to the fact that you are using 4 Mbps baud rate, which is our max. Glad you were able to decrease the baud rate.

    There is one more question, how to increase the Credit of RFCOMM. I see that the API function of RFCOMM includes RFCOMM_Send_Credits. Is there an example of using this function?

    We don't have an example, but have you seen the documentation for the function?

       /*! @brief The following function is used to send credits to an RFCOMM
        * channel that is currently open.
        * @param BluetoothStackID Unique identifier assigned to this Bluetooth
        * Protocol Stack via a call to BSC_Initialize
        * @param TEI Terminal Endpoint Identifier of channel.
        * @param DLCI Data Link Connection Identifier of channel.
        * @param Credits Number of credits to issue to the receiver (cannot be zero).
        * @return If the request was successfully submitted to the lower layer for
        * delivery zero is returned.  If an error occurred while submitting
        * the Credits, a negative value is returned that identifies the
        * reason for the failure.  It must be noted that this function is
        * only available for those channels that have been configured to use
        * Credit Based Flow control.
        * \note If this function returns the Error Code:
        *
        *             BTPS_ERROR_INSUFFICIENT_BUFFER_SPACE
        *
        *          then this is a signal to the caller that the requested
        *          data could NOT be sent because the requested data could
        *          not be queued in the Outgoing Data Queue.  The caller
        *          then, must wait for the
        *
        *             etTransport_Buffer_Empty_Indication
        *
        *          Event before trying to send any more data.
        */
    BTPSAPI_DECLARATION int BTPSAPI RFCOMM_Send_Credits(unsigned int BluetoothStackID, Word_t TEI, Byte_t DLCI, Byte_t Credits);

    You may also want to look into RFCOMM_Send_Data_With_Credits().

    Thanks,
    Jacob

  • Hello,

      Jacob,

       1. I looked into this API, but I can't get the TEI and DLCI parameters so I can't use it. Can you tell me how to get these two parameters?

       2. If not, then can you tell me how to get the channel ID(LCID) of the connected device?  

        BTPSAPI_DECLARATION int BTPSAPI L2CA_Data_Write(unsigned int BluetoothStackID, Word_t LCID, Word_t Data_Length, Byte_t *Data);