Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

CC2640R2 Porting Projects

From Texas Instruments Wiki
Jump to: navigation, search

Troubleshooting SDK Build Failures

It is important to utilize the specified toolchain and follow the build procedure as specified in the respective SDK's release notes and component user guide. The following information can be useful when troubleshooting build failures of BLE sample applications in the SimpleLink CC2640R2 SDK:

  • CCS:
    • No spaces in SDK install path, CCS Workspace path or Windows user name used in your %APPDATA% path. White spaces in these paths may result in pre-build failures.
    • Cygwin installations can interfere with the XDCTools prebuild process. If you have installed Cygwin, either directly or indirectly as part of another software package unrelated to the SDK or XDCTools, ensure that the these installations are not in your Windows PATH before a build is invoked. Other installations of Cygwin in your PATH may result in prebuild failures with minimal diagnostic output.
  • IAR
    • Ensure you do not have conflicting Custom Argument Variables (Global or Workspace) prior to opening a sample application in IAR.
    • If build failures are encountered, set your Build Output to "All" (right click on the build window for IAR 8.11.x +) and attach the build log to an E2E post. Please do not copy and paste the text to the body of the post as it is easier for us to open/search a file attachment. Thank you.

OAD Known Issues

For known issues that affect OAD applications, see the OAD_User's_Guide.

LE Secure Connections Recommended Parameters

The underlying ECC software used to generate the Public/Private Key pair and the DH Key check will lock the BLE-Stack task for approximately 160ms. This lock will occur twice during secure connections pairing. When using LE Secure Connections, it is recommend that a supervision timeout of at least 165ms to prevent the link from dropping. Additionally the application should be prepared to be preempted/blocked during this time.

SimpleLink CC2640R2 SDK v1.40, 1.50

  • OSAL SNV cannot be relocated (fixed to pg 29 and 30) unless FEATURE_OAD is defined by the stack. This is because HalFlashGetAddress() will used a fixed offset.
  • If using NVS with the BLE-Stack, FEATURE_OAD must be defined in the stack project for the same reason as above. Adding NVS causes OSAL SNV to be relocate, which will cause a crash unless FEATURE_OAD is defined.
  • When porting from an earlier SDK release, please refer to the online migration guide depending on stack component: Bluetooth 4.2 (BLE-Stack 3.1.0) or Bluetooth 5 (BLE5-Stack 1.0.1).
  • When using CCS v7.3 or later, the SimpleLink CC2640R2 SDK will need to be downloaded from TI Resource Explorer (View -> TI Resource Explorer). This installation requirement is due to an issue with the packaging of the XDCTools version in the Windows SDK installer that is not compatible with newer CCS installations. Using the Windows SDK installer with CCS v7.3 or later may result in pre-build failures.
  • If attempting to use a sniffer to decrypt the traffic of a secure connections pairing, the debug key must be used. A #define has been created on the stack, it is called SC_HOST_DEBUG. However, this will not work out of the box. See the code snippet below to see the fix. After the fix is applied, the #define must be set in the preprocessor settings, rebuild stack, and then app to apply the fix fully. The key is to move the gapBond_useEccKeys variable inside the #ifdef as below.
  1. #ifdef SC_HOST_DEBUG
  2. // These are the "Debug Mode" keys as defined in
  3. static uint8 gapBond_useEccKeys = TRUE;
  4. static gapBondEccKeys_t gapBond_eccKeys =
  5. {
  6.   { 0xBD, 0x1A, 0x3C, 0xCD, 0xA6, 0xB8, 0x99, 0x58, 0x99, 0xB7, 0x40, 0xEB,
  7.    0x7B, 0x60, 0xFF, 0x4A, 0x50, 0x3F, 0x10, 0xD2, 0xE3, 0xB3, 0xC9, 0x74,
  8.    0x38, 0x5F, 0xC5, 0xA3, 0xD4, 0xF6, 0x49, 0x3F },
  9.  
  10.   { 0xE6, 0x9D, 0x35, 0x0E, 0x48, 0x01, 0x03, 0xCC, 0xDB, 0xFD, 0xF4, 0xAC,
  11.     0x11, 0x91, 0xF4, 0xEF, 0xB9, 0xA5, 0xF9, 0xE9, 0xA7, 0x83, 0x2C, 0x5E,
  12.     0x2C, 0xBE, 0x97, 0xF2, 0xD2, 0x03, 0xB0, 0x20 },
  13.  
  14.   { 0x8B, 0xD2, 0x89, 0x15, 0xD0, 0x8E, 0x1C, 0x74, 0x24, 0x30, 0xED, 0x8F,
  15.     0xC2, 0x45, 0x63, 0x76, 0x5C, 0x15, 0x52, 0x5A, 0xBF, 0x9A, 0x32, 0x63,
  16.     0x6D, 0xEB, 0x2A, 0x65, 0x49, 0x9C, 0x80, 0xDC }
  17. };
  18. #else
  19. static uint8 gapBond_useEccKeys = FALSE;
  20. static gapBondEccKeys_t gapBond_eccKeys =
  21. {
  22.   { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  23.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  24.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  25.   { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  26.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  27.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
  28.   { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  29.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  30.     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
  31. };
  32. #endif //SC_HOST_DEBUG
  • When using ROV Classic and auto sized heap, the ROV may generate an exception about reading from and INVALID address. This is related to this XDCTOOLS issue. CCS users are encouraged to use ROV2. For IAR and CCS users using ROV classic, a workaround may be applied by adding the highlighted lines to the package.xs file located at \kernel\tirtos\packages\ti\sysbios\heaps\package.xs.
  1. function init()
  2. {
  3.     /* Add HeapMem's primaryHeap addresses range to ROV's memory sections */
  4.     if (xdc.om.$name == "rov") {
  5.         var HeapMem = xdc.module('ti.sysbios.heaps.HeapMem');
  6. //        if (xdc.om['ti.sysbios.heaps'].HeapMem.$used) {
  7.             var Program = xdc.useModule('xdc.rov.Program');
  8.             var HeapMemCfg =  Program.getModuleConfig(HeapMem.$name);
  9.             if  (HeapMemCfg.primaryHeapBaseAddr != null) {
  10.                 var base = Program.getSymbolValue(HeapMemCfg.primaryHeapBaseAddr.substr(1));
  11.                 var end = Program.getSymbolValue(HeapMemCfg.primaryHeapEndAddr.substr(1));
  12.                 /* Retrieve the MemoryImage java object. */
  13.                 var Model = xdc.module("xdc.rov.Model");
  14.                 var memReader = Model.getMemoryImageInst();
  15.  
  16.                 /* retrieve the sections list and add a new section */
  17.                 var sections = memReader.getSections();
  18.                 sections.addSection(base, end-base);
  19.             }
  20. //        }
  21.             /* Retrieve the MemoryImage java object. */
  22.             var Model = xdc.module("xdc.rov.Model");
  23.             var memReader = Model.getMemoryImageInst();
  24.  
  25.             /* retrieve the sections list and add a new section */
  26.             var sections = memReader.getSections();
  27.             sections.addSection(0x20000000, 0x20005000);
  28.     }
  29. }
  • When using HeapTrack with the peripheral GAP Role, the run time task stack size may be overflown. This can be alleviated by changing the following lines in peripheral.c:115,117. A size of at least 750 is suggested for the peripheral gap role. The run time task stack sizes are profiled using the OSAL heapmgr and the user should profile their runtime stack settings for the selected heap configuration.
  1. #if defined __TI_COMPILER_VERSION__
  2. #define GAPROLE_TASK_STACK_SIZE       480 // multiples of 8 only
  3. #else  // IAR Compiler Used
  4. #define GAPROLE_TASK_STACK_SIZE       440 // multiples of 8 only
  5. #endif // defined __TI_COMPILER_VERSION__
  • When Enabling PTM on an Application Project - modifications have to be made to the file "icall_hci_tl.c" to allow utilizing PTM and the GAPBondMgr.

Add the following after icall_hci_tl.c:482

#elif defined (HCI_TL_PTM)
 
#if defined(GAP_BOND_MGR)uint32_t host_tl_defaultPasscode;// Passcode.static void host_tl_passcodeCB(uint8_t *deviceAddr, uint16_t connectionHandle,                                     uint8_t uiInputs, uint8_t uiOutputs);// Bond Manager Callbacksstatic const gapBondCBs_t host_tl_bondCB ={  (pfnPasscodeCB_t)host_tl_passcodeCB, //  Passcode callback  NULL                  //  Pairing state callback}; #endif //GAP_BOND_MGR 
static hciEntry_t hciTranslationTable[] =
  • When Enabling PTM on an Application Project - HCI_TL_Init API changed, replace the call to HCI_TL_Init in application code.

For example, in simple_peripheral.c, SimpleBLEPeripheral_init, replace

  // Register for Command Status information
  HCI_TL_Init(NULL, (HCI_TL_CommandStatusCB_t) SBP_sendToNPI, selfEntity);

with

  // Register for Command Status information
  HCI_TL_Init(NULL, (HCI_TL_CommandStatusCB_t) SBP_sendToNPI, NULL, selfEntity);
  • wchar_t warnings are suppressed for BLE libs in CCS projects since this data type is not used by the BLE stack. If porting from an earlier CC2640R2 SDK, please ensure you have the Linker configured to suppress the same warnings as provided in default SDK example projects. Suppressed diagnostics are specified in Project Properties -> Build -> ARM Linker -> Advanced Options -> Diagnostics. Refer to this post for more details.

Known Issues / Workarounds for BLE5v1.0.1

  • Unable to disable non-connectable advertising on multi_role.

To workaround this issue, on multi.c, comment out the assignment of gapRole_AdvEnabled to true when GAP_MAKE_DISCOVERABLE_DONE_EVENT is received.

// If advertising started
if (pMsg->opcode == GAP_MAKE_DISCOVERABLE_DONE_EVENT)
{
  //gapRole_AdvEnabled = TRUE;}
  • OSAL_SNV=2 is fixed at page 29 and 30. In SDKs prior to CC2640R2 SDK 1.40, as well as the ble5stack component of CC2640R2 SDK 1.40 OSAL_SNV=2 is not designed to be relocatable.

Instead, it is fixed at page 29 and 30. Moving the SNV_FLASH section to any page besides 29 and 30 will cause the device to crash in the stack initialization, specifically osal_snv_init().

One workaround is detailed here: https://e2e.ti.com/support/wireless_connectivity/bluetooth_low_energy/f/538/t/671397 Another workaround is to use the osal_snv.c implementation from the blestack component of the SDK. and to set FEATURE_OAD in the stack library project to prevent a hardcoded address from being used in HalFlashGetAddress().


Known Issues / Workarounds for BLEv3.1.0

  • Unable to disable non-connectable advertising on multi_role.

To workaround this issue, on multi.c, comment out the assignment of gapRole_AdvEnabled to true when GAP_MAKE_DISCOVERABLE_DONE_EVENT is received.

// If advertising started
if (pMsg->opcode == GAP_MAKE_DISCOVERABLE_DONE_EVENT)
{
  //gapRole_AdvEnabled = TRUE;}
  • OSAL_SNV=2 is fixed at page 29 and 30. In SDKs prior to CC2640R2 SDK 1.40, as well as the ble5stack component of CC2640R2 SDK 1.40 OSAL_SNV=2 is not designed to be relocatable.

Instead, it is fixed at page 29 and 30. Moving the SNV_FLASH section to any page besides 29 and 30 will cause the device to crash in the stack initialization, specifically osal_snv_init().

One workaround is detailed here: https://e2e.ti.com/support/wireless_connectivity/bluetooth_low_energy/f/538/t/671397 Be sure to set FEATURE_OAD in the stack library project to prevent a hardcoded address from being used in HalFlashGetAddress().

SimpleLink CC2640R2 SDK v1.35

  • IAR has changed the definition of the wchar_t in EWARM 8.11.x IDE versions which results in warnings with BLE SDKs that have specified dependencies to IAR EWARM 7.80.3 and earlier versions. TI has not tested these SDKs for compatibility to 8.11.x EWARM and recommends using the toolchain version listed in the SDK release notes.

Known Issues / Workarounds for BLE5v1.0.0

  • Unable to reconnect to a previously bonded device after a power cycle

To workaround this issue, add the following lines to the GAP_DEVICE_INIT_DONE_EVENT in the gapRole_processGAPMsg function in peripheral.c after right before gapRole_state = GAPROLE_STARTED;:

+ uint8_t gapAllowPrivacyMode = TRUE;
+ GAPBondMgr_SetParameter( GAPBOND_ALLOW_DEVICE_PRIVACY_MODE, sizeof(uint8_t), &gapAllowPrivacyMode );

Known Issues / Workarounds for BLEv3.0.1

  • CCCD Not Updated when Bonded Device Reconnects when using IAR EWARM IDE 7.80.3

To workaround this issue, deoptimizing GATTServApp_ProcessCCCWriteReq in gattservapp_util.c solves the issue. Deoptimize by inserting the following code above the function declaration:

 */
#pragma optimize=none
bStatus_t GATTServApp_ProcessCCCWriteReq( uint16 connHandle, gattAttribute_t *pAttr,
  • Crash when re-pairing with a device that lost its keys

To workaround this issue, modify the gapBondMgrAddBond and gapBondMgrEraseBonding functions in gapbondmgr.c in your stack project to use KEYLEN instead of sizeof(smIdentityInfo_t ) in osal_snv_read as seen below:

// Verify that that a previous bond had an IRK before attempting to
// remove it from the Controller's resolving list.

if ( (osal_snv_read(devIRKNvID(bondIdx), KEYLEN, oldIrk) == SUCCESS) &&
           (osal_isbufset( oldIrk, 0xFF, KEYLEN ) == FALSE) )
  • Error Linking with Observer and Broadcaster Build Config

When building a stack project with the build_config.opt set to use Observer and Broadcaster libraries, the linking will fail. In other words, setting HostConfig to

-DHOST_CONFIG=BROADCASTER_CFG+OBSERVER_CFG

will not allow a successful stack build. To obtain scanning and advertising functionality, use

-DHOST_CONFIG=PERIPHERAL_CFG+OBSERVER_CFG
,
-DHOST_CONFIG=CENTRAL_CFG+BROADCASTER_CFG
, or
-DHOST_CONFIG=PERIPHERAL_CFG+CENTRAL_CFG


SimpleLink CC2640R2 SDK v1.30

  • IAR has changed the definition of the wchar_t in EWARM 8.11.x IDE versions which results in warnings with BLE SDKs that have specified dependencies to IAR EWARM 7.80.3 and earlier versions. TI has not tested these SDKs for compatibility to 8.11.x EWARM and recommends using the toolchain version listed in the SDK release notes.

Known Issues / Workarounds for BLEv3.0.1

  • Crash when re-pairing with a peer device that lost its bonding keys

To workaround this issue, modify the gapBondMgrAddBond and gapBondMgrEraseBonding functions in gapbondmgr.c in your stack project to use KEYLEN instead of sizeof(smIdentityInfo_t ) in osal_snv_read as seen below:

// Verify that that a previous bond had an IRK before attempting to
// remove it from the Controller's resolving list.

if ( (osal_snv_read(devIRKNvID(bondIdx), KEYLEN, oldIrk) == SUCCESS) &&
           (osal_isbufset( oldIrk, 0xFF, KEYLEN ) == FALSE) )