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: Direct Advertising with Auto Connect

Part Number: LAUNCHXL-CC2640R2

Hi,

I'm trying to modify simple central/peripheral code so that the peripheral only auto-connect to a specific central device by enabling direct advertising. Here is what I did:

In central: 

#define FPGA_AUTO_CONNECT 1

In peripheral I added these below the GAP_ROLE_PARAMETER lines:

uint8 connectedDeviceAddr[B_ADDR_LEN] = {0x36,0x4E,0xAA,0x2D,0x07,0x98}; //0x98072DAA4E36 << this is my central btAddr
uint8 advDirectType = GAP_ADTYPE_ADV_HDC_DIRECT_IND;
uint8 advDirectAddrType = ADDRMODE_STATIC;
GAPRole_SetParameter( GAPROLE_ADV_EVENT_TYPE, sizeof( uint8 ), &advDirectType );
GAPRole_SetParameter( GAPROLE_ADV_DIRECT_ADDR, sizeof( connectedDeviceAddr ), connectedDeviceAddr );
GAPRole_SetParameter( GAPROLE_ADV_DIRECT_TYPE,sizeof( uint8 ), &advDirectAddrType );

After these changes these two devices cannot auto connect, is there something I did wrong here?

Thanks!

  • Hi Tianqi,

    I recommend removing the FPGA_AUTO_CONNECT define - these aren't meant to be used with the SoC.

    Regarding autoconnect, have your central
    Scan for Directed Advertisements (eg make sure that GAPRole's scan filter policy is correct and the address type is correct)
    GAPCentralRole_EstablishLink with address of the peripheral. (you should be able to get this from the advertisement data.

    You also use a static address, ensure that the central is set up as a static address.

    Regards,
    Rebel