BLE-Stack 3.02.00 to BLE-Stack 3.02.01

This section will describe a way to migrate a project from BLE-Stack 3.02.00 to a BLE-Stack 3.02.01.

For this migration guide, simple_peripheral from BLE-Stack 3.02.00 will be ported over to BLE-Stack 3.02.01. Because the directory structure is nearly identical between the two releases, the recommended approach is to start with a BLE-Stack 3.02.01 project that contains the same base functionality as the porting target project and merge in any custom functionality.

If you choose to not start with an example project from BLE-Stack 3.02.01 and instead wish to port your project by going to Properties>General>Products and selecting the new version of the CC2640R2F SDK that you wish to point to, be careful to examine what files are linked and what files are copied into your workspace from the SDK and adjust your project accordingly. For example, if you are migrating code based on the Project Zero for CC2640R2F, be sure to reference the new ble_user_config.c, ble_user_config.h and board files from the target SDK. The ble_user_config.c and ble_user_config.h are linked to the project, therefore, you need to copy those files into the new SDK.

  1. Choose a BLE-Stack 3.02.01 example project that contains your target project’s base functionality.

    For reference, see available sample projects that start with simple_peripheral

    In this example, we’re going to use simple_peripheral as the starting BLE-Stack 3.02.01 sample project.

  2. Transfer all modified application files from BLE-Stack 3.02.00 into the BLE-Stack 3.02.01 example project.

    In this example, the following files from BLE-Stack 3.02.01 were moved into simple_peripheral BLE-Stack 3.02.00 example:

    • simple_peripheral.c
    • simple_peripheral.h
  3. A generic ATT retransmission module is introduced in BLE-Stack 3.02.01, which will take care of retransmission mechanism of unsent responses. Please do the following in simple_peripheral.c to take advantage of the new module.

    Include att_rsp.h.

    #include "att_rsp.h"
    

    Remove the globals and functions for handling ATT retransmission from user application code.

    // Globals used for ATT Response retransmission
    static gattMsgEvent_t *pAttRsp = NULL;
    static uint8_t rspTxRetry = 0;
    
    static void SimplePeripheral_sendAttRsp(void);
    static void SimplePeripheral_freeAttRsp(uint8_t status);
    

    Inside function SimplePeripheral_processGATTMsg, replace pMsg->hdr.status == blePending with attRsp_isAttRsp(pMsg) and remove the following code.

    // First free any pending response
    SimplePeripheral_freeAttRsp(FAILURE);
    
    // Hold on to the response message for retransmission
    pAttRsp = pMsg;
    

    Replace the function SimplePeripheral_processConnEvt with the following code block:

    /*********************************************************************
     * @fn      SimplePeripheral_processConnEvt
     *
     * @brief   Process connection event.
     *
     * @param pReport pointer to connection event report
     */
    static void SimplePeripheral_processConnEvt(Gap_ConnEventRpt_t *pReport)
    {
    
      if( CONNECTION_EVENT_REGISTRATION_CAUSE(FOR_ATT_RSP))
      {
        // The GATT server might have returned a blePending as it was trying
        // to process an ATT Response. Now that we finished with this
        // connection event, let's try sending any remaining ATT Responses
        // on the next connection event.
        // Try to retransmit pending ATT Response (if any)
        if (attRsp_sendAttRsp() == SUCCESS)
        {
            // Disable connection event end notice
            SimplePeripheral_UnRegistertToAllConnectionEvent (FOR_ATT_RSP);
        }
      }
    
    }
    

    Replace all SimplePeripheral_freeAttRsp(bleNotConnected); with attRsp_freeAttRsp(bleNotConnected);

    Under function SimplePeripheral_connEvtCB replace ICall_freeMsg(pReport); with ICall_free(pReport); . This will avoid potential memory corruption.

  4. If necessary, update the project to use the newer TI-RTOS drivers that are supplied with the SimpleLink CC2640R2 SDK.

  5. Refer to the Upgrade and Compatibility Information for additional information and the TI-RTOS examples included with SimpleLink CC2640R2 SDK.

    For additional information on how BLE-Stack 3.02.01 uses TI-RTOS see TI-RTOS (RTOS Kernel) Overview

    For any utilized TI Drivers, review TI-RTOS Kernel Users Guide and Driver APIs.