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.

CC2540: when upgrading cc2540 BLE 1.4.0 to 1.4.1, the peripheral central can only receive one package, then stuck and disconnected.

Part Number: CC2540

Hi all, 

Recently, I was upgrading code from BLE 1.3.2 to BLE 1.4.0 and then BLE1.4.1. However, after I upgraded from BLE 1.4.0 to BLE 1.4.1, I found the central can only receive one package, then stuck and disconnected but the peripheral continuously sending  20byte data packages to the central and I read the data packages from simpleBLECentralPRocessGATTMSG at the central. I have tested it in BLE 1.3.2 and BLE 1.4.0, there was no problem. 

I have used the package sniffer to read the package,where I indeed found only one package was sent and then the screen was frozen for a while then disconnected and started scanning again. 

I have also tried to connect the peripheral using the lightblue, where I can continuously receive the package. 

Please help on where to do next.

Thank you very much.

The code I wrote is in side simpleBLEcentralProcessGATTMsg : (I have added "GATT_bm_free( &pMsg->msg, pMsg->method )" at the end of simpleBLEcentralProcessGATTMsg according to the simplecentral  file in BLE1.4.1)

if ( pMsg->method == ATT_HANDLE_VALUE_NOTI ||
       pMsg->method == ATT_HANDLE_VALUE_IND )
  {
    if (pMsg->msg.handleValueNoti.handle ==0x004C) // 0x004D is the handle for the notification, 0x004C is the handle for the characteristic
    {
        attHandleValueNoti_t noti14; 
        noti14.handle = pMsg->msg.handleValueNoti.handle;
        noti14.len = pMsg->msg.handleValueNoti.len;
        
                   
        osal_memcpy(&noti14.pValue, &pMsg->msg.handleValueNoti.pValue, noti14.len);
        osal_memcpy(&char14buffer, &noti14.pValue, noti14.len); 
        
        USBIO_WriteTransport(char14buffer,20); 
        USBPrintString("Receive14:");        
    } 

  • Hello B.Fan,

    Please see the porting guide on the BLE Wiki. One glaring omission is you are not using GATT_bm_alloc to allocate a GATT buffer from the heap for the Noti value. This was one of the changes made between BLE 1.4.0 and 1.4.1+.

    Best wishes