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.

LAUNCHXL-CC2640R2: SimpleBLEPeripheral_performPeriodicTask only executes with Bluetooth Connection

Part Number: LAUNCHXL-CC2640R2

Dear experts,

Our cutsomers has query below:

I am trying to configure my CC2650-LAUNCH board to blink the red LED every 5 seconds using the simple_peripheral project as a starting point. Currently I am able to get it working so long as I am connected to the board using the LightBlue app from my iPhone.

My SimpleBLEPeripheral_performPeriodicTask currently looks like this:

static void SimpleBLEPeripheral_performPeriodicTask(void)
{
#ifndef FEATURE_OAD_ONCHIP
  uint8_t valueToCopy;

  // Call to retrieve the value of the third characteristic in the profile
  if (SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, &valueToCopy) == SUCCESS)
  {
    // Call to set that value of the fourth characteristic in the profile.
    // Note that if notifications of the fourth characteristic have been
    // enabled by a GATT client device, then a notification will be sent
    // every time this function is called.
    SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR4, sizeof(uint8_t),
                               &valueToCopy);
  }

  PIN_Handle handle = PIN_open(&ledState, BoardGpioInitTable);
  PIN_Status val = PIN_setConfig(handle, PIN_BM_GPIO_OUTPUT_VAL, Board_RLED | PIN_GPIO_HIGH);
  PIN_setOutputValue(&ledState, Board_RLED, 1);
  Task_sleep(3000);
  PIN_close(&ledState);

#endif //!FEATURE_OAD_ONCHIP
}

where ledState was defined near the top of simple_peripheral.c as:

PIN_State  ledState;

My initial thought was that the call to ICall_wait within SimpleBLEPeripheral_taskFxn was blocking further calls as would be suggested by the comments left above the call. I changed the ICall_wait argument from ICALL_TIMEOUT_FOREVER to ICALL_TIMEOUT_PREDEFINE (defined to be 5000), but to no avail. It seems as if I need to use ICall_signal as mentioned in the comments, but I am unsure of how to retrieve the relevant ICall_SyncHandle it takes as an argument. I have tried looking through the code and online, but have not found the appropriate function or variable yet.

Any pointers to how to properly get the board to perform periodic tasks without a bluetooth connection would be greatly appreciated.

 

 
Best Regards,
William