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.

BLE stack tasks are out of sync

Other Parts Discussed in Thread: CC2541

Hi,

I'm working with CC2541 quite a while and noticed some strange behaviour which by idea shouldn't happen. I activate debug LED with HAL_SLEEP_DEBUG_LED to watch when uC is sleeping and when is active. So, I removed all application tasks, only basic stack remains and connected to device with CI = 1 sec. So, by Idea uC should wake up one time in 1 second, do some ble stack tasks and go to sleep again. You can observe by looking how LED blinks 1 time in 1 sec. But that never happens, blinking is more erratic, it wakes up more then it should. I assume that ble stack tasks are just not synchronized. So how to sync them if it possible?

  • Hi Dmitri,
    Note that the LED will be lit every time the CC2541 wakes up and stays so until it's back to sleep. This means that if you have periodic events or any other feature that require application processing (sensor interaction, serial communication etc.) , it will be lit then as well.

    Best Regards
    Joakim
  • I'm not a noob and understand this well, the problem was in RSSI

    GAPRole_SetParameter( GAPROLE_RSSI_READ_RATE, sizeof(uint16_t), &desired_rssi_read_interval );

    By idea it should be syncronized with connection interval, but it's not, it just a simple event in GAPRole_ProcessEvent

      if ( events & RSSI_READ_EVT )
      {
        // Only get RSSI when in a connection
        if ( gapRole_state == GAPROLE_CONNECTED )
        {
          // Ask for RSSI
          VOID HCI_ReadRssiCmd( gapRole_ConnectionHandle );
    
          // Setup next event
          if ( gapRole_RSSIReadRate )
          {
            VOID osal_start_timerEx( gapRole_TaskID, RSSI_READ_EVT, gapRole_RSSIReadRate );
          }
        }
        return ( events ^ RSSI_READ_EVT );
      }

    So, is there some way to syncronize it?

    Also that's not all, some event(s) also happens even if I disabled RSSI read. It can happen once from 2 to 10 sec and there are no way to find it with CC Debugger. It's not about my application, I took SimpleBLEPeripheral from examples cleaned it up and configured on low connection interval, and saw the same, some event happening.

  • Hi Joakim,

    Is there a way to synchronise task events with connection interval events? Essentially, the query is about sub-tasks running in the stack and can application task events be synchronised so that the CPU wake-up happens only once in a given duty cycle?  

    It seems to be linked to the TI BLE stack. Can someone in TI please answer this?

    Best,

  • Hi,
    You can use the HCI_EXT_ConnEventNoticeCmd to synchronize an event after connect event has occurred. More information is found in the Vendor Specific HCI Guide that is included with the stack installer.

    Best Regards
    Joakim