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.

BT SPP Send Behavior



TI team,

         I have couple of questions regarding the BT_spp_send function. I hope you can help.

  1. When BT_spp_send() is executed, sdk_error_handler() goes into an endless-loop condition sometimes.  In this case, sdk_error_code is 22(SDK_BT_MEM_ALLOC_FAIL) . What could be causing this error? How can I debug it? What should I change?
  2. If BT_spp_send() is called consecutively, should it be called in the callback routines named “API_RESULT appl_spp_notify_cb()” or “API_RESULT appl_spp_l2cap_tx_queue_flow_cb()”? From our experiments, we observe the following: When BT_spp_send() returns API_SUCCESS and then BT_spp_send() is called next with 70 byte data transfer, it becomes SDK_BT_MEM_ALLOC_FAIL at 4th transfer.  For example,   70byte(OK) --> 70byte(OK) --> 70byte(OK) --> failed.
  3. BT_spp_send() may return SPP_ERR_INVALID_STATE  . What is the condition that would return this state? What should I check under this state?

Thank you for you help,

 

  • 1 & 2 :

    If BT_spp_send() is failing frequently, it typically points to incorrect handling of RTS. The BT controller is unable to send anything back to the MSP430 leading to memory allocation failures since the application is still trying to pump data to the controller. As part of the demo application, RTS is enabled only as part of the Idle hook and is disabled elsewhere.

    You can try the following:

    a. Check if RTS is being handled correctly as part of the application customizations

    b. Try to increase the number of allocated BT buffers as part of heap_bt.c to see if this makes any difference. However, note that this should not be required since we have validated the SDK behavior with 110 bytes of payload.

     

    3:

    SPP_ERR_INVALID_STATE is returned for the following conditions:

    a. If BT_spp_start() is called without required initialization

    b. If BT_spp_connect() is called without required initialization

    c. If BT_spp_disconnect() is called without required initialization

    d. If BT_spp_send() is called without required initialization

    Please initialize SPP and then call the required SPP API functions.

  • Another help needed using the api BT_spp_send():

    i wanna send a test array with measured signal values. They including also negativ values.

    i take a look at the API :

    API_RESULT BT_spp_send (

       IN SPP_HANDLE spp_handle,

       IN UCHAR *data,

       IN UINT16 data_len

    )

    with UCHAR *data I can only send values between 0...255. And i didnt understand, why data so send is 1Byte and data length of data send is 2Byte.

    What kind of modifications are needed to send value of e.g. short int.?

    I am working on the demo accel-app...

    regards,

  • UCHAR data Signifies byte information and payload could be anything, but it needs to be encoded before transmission and decoded after receives.

    ex. To transmit short int data(X = 0x1234)

     in transmission,

    data[0] = X / 0x100; /* MSB of variable 'X' */

    data[1] = X % 0x100; /* LSB of variable 'X' */

    in Receiver,

    Y = (int)(data[0] * 0x100) + data[1];

    So application data signals needs to be encoded and decoded based on the application data range.

     

    Regards

  • I have problem with decoding data < 256, especially sending zero ... the receviing data is diffrent according to data >= 256

    any idea about this?

  • Kire,

    Could you provide more details on the issue? Could you put an example of what you are getting vs what you are expecting?

    Regards,

    Miguel

  • Hi Kire,

    Could you please give us more details about "I have problem with decoding data < 256, especially sending zero ... the receviing data is diffrent according to data >= 256"

    anyway decoding and encoding logic is based on the developer and an application.Here our question is " In the bluetooth(stack) level are you getting any data/byte corruption or missing" ?

    Thanks
    Senthil.