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.

How to save and used same private IEEE address by CC2541

Other Parts Discussed in Thread: CC2541

Hi,

Use the following function can generate private IEEE address (random), 

When a random address was changed. can get the private address from  "GAP_RANDOM_ADDR_CHANGED_EVENT" event.

GAP_ConfigDeviceAddr( ADDRTYPE_PRIVATE_RESOLVE, (uint8 *)NULL );

when CC2541 device power on reset the private address will be different.

I want to using the same private address, but I don't know what to do.

Try to set IRK for using the same private address, the situation is still the same.

if ( newState == GAPROLE_STARTED )
{

uint8 abIrk[16] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};

GAPRole_SetParameter(GAPROLE_IRK, 16, &abIrk);

GAP_ConfigDeviceAddr( ADDRTYPE_PRIVATE_RESOLVE, (uint8 *)NULL );
}

try used ADDRTYPE_PRIVATE_NONRESOLVE can change to the private address,

in Window 8 can't fond the BLE device, but android or IOS system can.

GAP_ConfigDeviceAddr( ADDRTYPE_PRIVATE_NONRESOLVE, (uint8 *)abBD_Addr );

  • Hello. It is not possible to select the resolvable private address that you want to start out with as this is generated randomly by the stack. You could somewhat mimic this by:
    1. Store private resolvable address in flash each time a new one is generated.
    2. When you recover from a reset, begin advertising with a static address of the last stored private resolvable address.
    3. After a given amount of time, restart advertising with private resolvable addresses.
  • Hi Tim,

    If setting static address is 0x060504030201,
    but using sniffer record data will see the address is 0xC60504030201
    Why would they not the same ?


    ///////////////////////////////////////////////////////////////////////////////////////
    // if started
    else if ( newState == GAPROLE_STARTED )
    {
    // nothing to do for now!
    uint8 abBD_Addr[6] = {1,2,3,4,5,6};
    GAP_ConfigDeviceAddr( ADDRTYPE_STATIC, (uint8 *)abBD_Addr );
    }
    ///////////////////////////////////////////////////////////////////////////////////////

    If setting static address is 0xAA0504030201,
    but using sniffer record data will see the address is 0xEA0504030201


    ///////////////////////////////////////////////////////////////////////////////////////
    // if started
    else if ( newState == GAPROLE_STARTED )
    {
    // nothing to do for now!
    uint8 abBD_Addr[6] = {0x01,0x02,0x03,0x04,0x05,0xAA};
    GAP_ConfigDeviceAddr( ADDRTYPE_STATIC, (uint8 *)abBD_Addr );
    }
    ///////////////////////////////////////////////////////////////////////////////////////

  • Hello Mars,
    Read chapter "1.3.2.1 Static Device Address" in the Bluetooth® Core Specification 4.2 (​Core Version 4.2):
    www.bluetooth.org/.../adopted-specifications

    The two most significant bits of the address is defined differently for static random (11) , private resolvable(10)and private nonresolvable (00). That is why 0xAA (0b10101010) turns into 0xEA(0b11101010). In theory you could set it directly with HCI_EXT_SetBDADDRCmd in SimpleBLEPeripheral_init as a public address. But that would violate the spec (section 9.2 ("48-bit universal LAN MAC addresses") of the IEEE 802-2001). Also there is an additional field in the PDU header (TxAdd) that indicates whether the advertiser’s address in the AdvA field is public (TxAdd = 0) or random (TxAdd = 1).

    I don't think there is a way around this without modifying the stack,
    Tim C : Please correct me if I am wrong.