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.

Compiler/CC2541: BLE Advertise but can not be connectable

Part Number: CC2541

Tool/software: TI C/C++ Compiler

I am working on cc2541 using 1.4.2 stack.I am using SimpleBLEPeripheral.
I want BLE advertise but can not be connectable 

// Setup the GAP
VOID GAP_SetParamValue( TGAP_CONN_PAUSE_PERIPHERAL, DEFAULT_CONN_PAUSE_PERIPHERAL );

// Setup the GAP Peripheral Role Profile
{

// For other hardware platforms, device starts advertising upon initialization
uint8 initial_advertising_enable = 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;

uint8 enable_update_request = DEFAULT_ENABLE_UPDATE_REQUEST;
uint16 desired_min_interval = DEFAULT_DESIRED_MIN_CONN_INTERVAL;
uint16 desired_max_interval = DEFAULT_DESIRED_MAX_CONN_INTERVAL;
uint16 desired_slave_latency = DEFAULT_DESIRED_SLAVE_LATENCY;
uint16 desired_conn_timeout = DEFAULT_DESIRED_CONN_TIMEOUT;

// Set the GAP Role Parameters
GAPRole_SetParameter( GAPROLE_ADV_NONCONN_ENABLED, sizeof( uint8 ), &initial_advertising_enable );
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_PARAM_UPDATE_ENABLE, sizeof( uint8 ), &enable_update_request );
GAPRole_SetParameter( GAPROLE_MIN_CONN_INTERVAL, sizeof( uint16 ), &desired_min_interval );
GAPRole_SetParameter( GAPROLE_MAX_CONN_INTERVAL, sizeof( uint16 ), &desired_max_interval );
GAPRole_SetParameter( GAPROLE_SLAVE_LATENCY, sizeof( uint16 ), &desired_slave_latency );
GAPRole_SetParameter( GAPROLE_TIMEOUT_MULTIPLIER, sizeof( uint16 ), &desired_conn_timeout );

I am using this GAPROLE_ADV_NONCONN_ENABLED to stop connection but device still can be connect. How can i stop connection?

  • Hi,
    That's strange, are you able to sniff the communication and verify that the device is sending non-connectable advertisements?
  • Hello Muqarrab Rahman,
    Try this:
    uint8 initial_advertising_enable = FALSE;
    GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable );
    uint8 nonconn_advertising_enable = TRUE;
    GAPRole_SetParameter( GAPROLE_ADV_NONCONN_ENABLED, sizeof( uint8 ), &nonconn_advertising_enable );

    Also makes sure PLUS_BROADCASTER is not defined in your project.
  • Thanks  !

    Now Device is non connectable but its name is also not showing (That i am setting).How can i fix that?

  • The name is by default put in scanRspData in the example. You will need to update the advertData.
  • I have successfully changed the name in scanRspData before these settings:

    uint8 initial_advertising_enable = FALSE;
    GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable );
    uint8 nonconn_advertising_enable = TRUE;
    GAPRole_SetParameter( GAPROLE_ADV_NONCONN_ENABLED, sizeof( uint8 ), &nonconn_advertising_enable );
    Also makes sure PLUS_BROADCASTER is not defined in your project.

    after these settings device name show N/A. How can i update the advertData(and what should i have to update)?
  • For example:

    static uint8 advertData[] =
    {
      // Flags; this sets the device to use limited discoverable
      // mode (advertises for 30 seconds at a time) instead of general
      // discoverable mode (advertises indefinitely)
      0x02,   // length of this data
      GAP_ADTYPE_FLAGS,
      DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,
      
      // complete name
      0x14,   // length of this data
      GAP_ADTYPE_LOCAL_NAME_COMPLETE,
      0x53,   // 'S'
      0x69,   // 'i'
      0x6d,   // 'm'
      0x70,   // 'p'
      0x6c,   // 'l'
      0x65,   // 'e'
      0x42,   // 'B'
      0x4c,   // 'L'
      0x45,   // 'E'
      0x50,   // 'P'
      0x65,   // 'e'
      0x72,   // 'r'
      0x69,   // 'i'
      0x70,   // 'p'
      0x68,   // 'h'
      0x65,   // 'e'
      0x72,   // 'r'
      0x61,   // 'a'
      0x6c,   // 'l'
    };

  • Thank You ! Problem Solved.