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: CC2541 Whitelist problem

Part Number: CC2541

Tool/software: TI C/C++ Compiler

  I have a problem to use whitelist on CC2541.

  I want to make a connection that the device(phone) which as a master can't scan and connect CC2541 which as a slave only if the device is added into whitelist of CC2541.

 Now, I set the advertiser filter scan parameters is GAP_FILTER_POLICY_WHITE.    //Allow Scan Request and Connect from White List Only.

 After a external trigger, I change advertiser filter scan parameters is GAP_FILTER_POLICY_ALL.    // Allow Scan Request from Any, Allow Connect Request from Any (default). And I reenable advert.

 But my phone(Android) can't find the CC2541. If I set default advertiser filter scan parameter is GAP_FILTER_POLICY_ALL, my phone can scan CC2541.

/* this code in init */
uint8 adv_filter_policy = GAP_FILTER_POLICY_WHITE;
GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), &adv_filter_policy );

/* this code in external trigger */
uint8 u8AdvErt = FALSE;
uint8 adv_filter_policy = GAP_FILTER_POLICY_ALL;
Start_PeripheralTimer(SBP_BINDING_EVT, BINDING_EVT_TIME);

GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &u8AdvErt );

GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), &adv_filter_policy );

u8AdvErt = TRUE;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &u8AdvErt );

/* this code in init */ 
uint8 adv_filter_policy = GAP_FILTER_POLICY_WHITE;
GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), &adv_filter_policy );

/* this code in external trigger */
uint8 u8AdvErt = FALSE;
uint8 adv_filter_policy = GAP_FILTER_POLICY_ALL;

GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &u8AdvErt );

GAPRole_SetParameter( GAPROLE_ADV_FILTER_POLICY, sizeof( uint8 ), &adv_filter_policy );

u8AdvErt = TRUE;
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &u8AdvErt );

Another question:

How to get phone's MAC addr? I found some advices to use GAPBondMgr_ResolveAddr( uint8 addrType, uint8 *pDevAddr, uint8 *pResolvedAddr ) this function, but what's the para of *pDevAddr?

  • Hi,

    You should first connect to the device first with GAP_FILTER_POLICY_ALL, then after external trigger use GAP_FILTER_POLICY_WHITE and add the device to the whitelist. See here for example:
    e2e.ti.com/.../417407


    You should be able to get the MAC address after you connect your phone. The GAPBondMgr API is further described here:
    file:///C:/Texas%20Instruments/BLE-CC254x-1.4.2.2/Documents/GAPBondManagerhtml/d3/df7/group___g_a_p_r_o_l_e_s___b_o_n_d_m_g_r___a_p_i.html#ga914829de70ba2b068ae387e364757a08

    Best wishes
  • If I set my CC2541 into GAP_FILTER_POLICY_ALL mode first, and after add the phone to the whitelist change the mode into GAP_FILTER_POLICY_WHITE, how can I add another phone? I think my problem is why I can't change the advertising mode between GAP_FILTER_POLICY_ALL and _FILTER_POLICY_WHITE?
  • Can not switch GAP_FILTER_POLICY_WHITE mode to GAP_FILTER_POLICY_ALL mode?