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.

SPPBLEServer stops sending notifications to BLE device

Other Parts Discussed in Thread: CC2640

Hi,

I came across a problem with the SPPBLEServer I am using to bridge between the CC2640 serial port and an iPhone running a BLE application.

This exhibits as the serial -> BLE blocking when I try to send "too much" data through (e.g. a couple of hundred characters).

I've tracked this down to SPPBLEServer.c, SPPBLEServer_taskFxn(), SBP_UART_DATA_EVT

What happens is that the sending of the notification with SerialPortService_SetParameter() fails.

Rather than retry the code stops, which has the effect that the failed message remains queued up until more serial Rx data is received, at which time the messages are correctly transmitted from the queue to the BLE device

A fix that works for me is

//Send the notification
retVal = SerialPortService_SetParameter(SERIALPORTSERVICE_CHAR_DATA, pMsg->length, pMsg->data); 

if(retVal != SUCCESS)
{
  LCD_WRITE_STRING_VALUE("NotiFAIL:", retVal, 10, LCD_PAGE4);
  LCD_WRITE_STRING_VALUE("Data length:", pMsg->length, 10, LCD_PAGE5);
  LCD_WRITE_STRING(pMsg->data, LCD_PAGE6);

  // AJL - Don't block on notification send failure...
  if(!Queue_empty(appUARTMsgQueue))
  {
    // Wake up the application to flush out any remaining UART data in the queue.
    Semaphore_post(sem);
  }
}
  • Hi Alex,

    That looks like a good fix. The code was a bit conservative by using a delay until the next RX packet to retransmit for the NOT SUCCESSFUL case for the notification. Also any other event should trigger a retransmit as well such as a periodic event that gets handled in the task function.  

    Best wishes

  • Thanks for coming back to me Zahiq. Great example for what I'm sure is something a lot of other developers need to do. The problem came out for me because I'm running a text terminal over the bridge so wasn't seeing the full response output until I entered the next command.

    I hope the suggestion is of some use :)

    Cheers, Alex