BLE-Stack 3.02.00 (SDK 2.20) to BLE-Stack 3.02.01 (SDK 2.30)¶
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 CC2640R2 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 the CC2640R2, 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.
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.
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
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
, replacepMsg->hdr.status == blePending
withattRsp_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);
withattRsp_freeAttRsp(bleNotConnected);
Under function
SimplePeripheral_connEvtCB
replaceICall_freeMsg(pReport);
withICall_free(pReport);
. This will avoid potential memory corruption.If necessary, update the project to use the newer TI-RTOS drivers that are supplied with the SimpleLink CC2640R2 SDK.
Refer to the Core SDK release notes 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 (SYS/BIOS) User’s Guide and TI Drivers API Reference.