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.

CC2541: Advertising process stopped in ImageB

Part Number: CC2541

Hello,

I'm using SimpleBLEBroadcaster project. If I use the standalone project, all works fine, but if I ported it to OAD ImageB project, it stopped after one time sending  advertising packet. The code is

HCI_EXT_AdvEventNoticeCmd(beacon_TaskID, SBP_ADV_CB_EVT);

....

uint16 SimpleBLEBroadcaster_ProcessEvent( uint8 task_id, uint16 events )
{
....
  if ( events & SBP_ADV_CB_EVT ) 
  {       
      advComplete = 1;  

      return ( events ^ SBP_ADV_CB_EVT ); 
  }

if ( events & SBP_PERIODIC_EVT )
  {    
    // Restart timer
    if ( SBP_PERIODIC_EVT_PERIOD )
    {
      osal_start_timerEx( beacon_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD );
    }

    // Perform periodic application task
    performPeriodicTask();
    
    return (events ^ SBP_PERIODIC_EVT);
  }
....
}

static void performPeriodicTask( void )
{
   new_adv_enabled_status = TRUE;        
            
   //change the GAP advertisement status to enabled
   GAPRole_SetParameter(GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &new_adv_enabled_status);

   ....

    if(advComplete) // <- this flag is 0 always
    {                         
        advComplete = 0;     

        ....
    }
}

So I have two problem:

1. After change the GAP advertisement status to enabled device send only one packet;

2. SBP_ADV_CB_EVT event is not appear.

Can anyone explain what is wrong?

Thanks,

Alex.

  • Can you post all the additional code you added into the project?
  • Now I'm using  this code

    void beacon_Init( uint8 task_id )
    {
      beacon_TaskID = task_id;
    
      // Setup the GAP Broadcaster Role Profile
      {
          // For other hardware platforms, device starts advertising upon initialization
          uint8 initial_advertising_enable = TRUE;//FALSE;//TRUE;
    
        // By setting this to zero, the device will go into the waiting state after
        // being discoverable for 30.72 second, and will not being advertising again
        // until the enabler is set back to TRUE
        uint16 gapRole_AdvertOffTime = 0;
        
    #if 1 // AlexM 251116
        uint8 advType = GAP_ADTYPE_ADV_NONCONN_IND;   // use non-connectable advertisements
    #else    
        uint8 advType = GAP_ADTYPE_ADV_SCAN_IND; // use scannable unidirected advertisements
    #endif
    
        // Set the GAP Role Parameters
        GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable ); // Alexm 241216 Wait for delay 
        GAPRole_SetParameter( GAPROLE_ADVERT_OFF_TIME, sizeof( uint16 ), &gapRole_AdvertOffTime );
        
        GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, sizeof ( scanRspData ), scanRspData );
        GAPRole_SetParameter( GAPROLE_ADVERT_DATA, sizeof( advertData ), advertData );
    
        GAPRole_SetParameter( GAPROLE_ADV_EVENT_TYPE, sizeof( uint8 ), &advType );
      }
    
      // Set advertising interval
      {
        uint16 advInt = DEFAULT_ADVERTISING_INTERVAL;
    
        GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MIN, advInt );
        GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MAX, advInt );
        GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MIN, advInt );
        GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MAX, advInt );
      }
      // Setup a delayed profile startup
      osal_set_event( beacon_TaskID, SBP_START_DEVICE_EVT );      
    }

    Device send 1 or 2 advertising packets and stopped. SBP_PERIODIC_EVT is not come also.

  • The same code works without OAD?
  • Can you read back the image before and after OAD to compare? Since you mentioned the code is the same, then the hex image should be pretty much the same.

    If that's not the problem, then there might be something wrong with your BIM.
  • Yes, you are right, I found bag in my BIM. Thanks!