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.

CC2640R2F: How to remove connection params updates sent from simple_peripheral project

Part Number: CC2640R2F

CC2640R2 (BLE5)

Note: The following instructions have been written for SDK 3_40_00_10 but can be adapted to quite any SDK version (that is why I provided the sources but also the diff files)

At the end of this instruction, you will get a project which is not anymore able to send requests to update the connection parameters. The project will still be able to answer a connection request.
The goal is to save flash space and CPU time.

How to do this?

 

  1. Import the project you want (the OOB ble5_simple_peripheral or the project where you have already removed the display function, the secondary advertisement and the auto PHY functionalities [see here])
  2.  Do the following in simple_peripheral.c

    • Remove SimplePeripheral_processParamUpdate() function. Remove the call to the function (you can basically remove all the treatment of the events SP_SEND_PARAM_UPDATE_EVT and GAP_LINK_PARAM_UPDATE_EVENT)
    • Modify the spConnRec_t structure to remove the elements pParamUpdateEventData and pUpdateClock. Remove the code using those elements too.
    • Remove the list paramUpdateList (and the code referring to). As a result you can remove the functions SimplePeripheral_clearPendingParamUpdate()
    • Remove the definition of the struct spConnHandleEntry_t
    • Remove the inclusion of the list library: #include <ti/drivers/utils/List.h>

 

>> Here are the diff file and the file you are supposed to get if you also removed the display, the secondary advertisement and the auto PHY functionalities:

simple_peripheral_remove_connection_params_update.diff
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
--- C:\ti\simplelink_cc2640r2_sdk_3_40_00_10\examples\rtos\CC2640R2_LAUNCHXL\ble5stack\simple_peripheral\src\app\simple_peripheral_without_autoPHY.c Wed Feb 12 13:02:31 2020
+++ C:\ti\simplelink_cc2640r2_sdk_3_40_00_10\examples\rtos\CC2640R2_LAUNCHXL\ble5stack\simple_peripheral\src\app\simple_peripheral_SIMPLE.c Wed Feb 12 15:55:05 2020
@@ -59,8 +59,6 @@
#include <intrinsics.h>
#endif
-#include <ti/drivers/utils/List.h>
-
#include <icall.h>
#include "util.h"
#include <bcomdef.h>
@@ -208,19 +206,10 @@
uint8_t data[];
} spClockEventData_t;
-// List element for parameter update and PHY command status lists
-typedef struct
-{
- List_Elem elem;
- uint16_t connHandle;
-} spConnHandleEntry_t;
-
// Connected device information
typedef struct
{
uint16_t connHandle; // Connection Handle
- spClockEventData_t* pParamUpdateEventData;
- Clock_Struct* pUpdateClock; // pointer to clock struct
} spConnRec_t;
/*********************************************************************
@@ -267,9 +256,6 @@
// Per-handle connection info
static spConnRec_t connList[MAX_NUM_BLE_CONNS];
-
-// List to store connection handles for queued param updates
-static List_List paramUpdateList;
// GAP GATT Attributes
static uint8_t attDeviceName[GAP_DEVICE_NAME_LEN] = "Simple Peripheral";
@@ -370,7 +356,6 @@
static uint8_t SimplePeripheral_addConn(uint16_t connHandle);
static uint8_t SimplePeripheral_getConnIndex(uint16_t connHandle);
static uint8_t SimplePeripheral_removeConn(uint16_t connHandle);
-static void SimplePeripheral_processParamUpdate(uint16_t connHandle);
static uint8_t SimplePeripheral_clearConnListEntry(uint16_t connHandle);
#ifdef PTM_MODE
void simple_peripheral_handleNPIRxInterceptEvent(uint8_t *pMsg); // Declaration
@@ -843,18 +828,6 @@
SimplePeripheral_updateRPA();
break;
#endif // PRIVACY_1_2_CFG
-
- case SP_SEND_PARAM_UPDATE_EVT:
- {
- // Extract connection handle from data
- uint16_t connHandle = *(uint16_t *)(((spClockEventData_t *)pMsg->pData)->data);
-
- SimplePeripheral_processParamUpdate(connHandle);
-
- // This data is not dynamically allocated
- dealloc = FALSE;
- break;
- }
default:
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
   3157.simple_peripheral_SIMPLE.C

Build and test your program. Everything should build and work smoothly.