When I scan BLE device at nRF UARTv2.0 App in Android4.4, it is appar device name(Ex:Nordic_UART) and 6 byte device address(MAC address?). I want to include mac address in device name. How to get 6 byte mac address at nrf51822?
When I scan BLE device at nRF UARTv2.0 App in Android4.4, it is appar device name(Ex:Nordic_UART) and 6 byte device address(MAC address?). I want to include mac address in device name. How to get 6 byte mac address at nrf51822?
By default, the BLE address is derived from the NRF_FICR->DEVICEADDR[] and is of 48 bits length (6 bytes). This registers are randomly generated in our production, and they are unique for each device (2^46 different combinations, due to MSbits set to '11').
You can read out the address using the API call, "sd_ble_gap_address_get(..);" or reading the FICR->DEVICEADDR[x] registers.
Example: My device advertises with "0xE724 08C78790"
DEVICEADDR[0] = 0x08C78790 DEVICEADDR[1] = 0xYYYYA724
The reason why "A7" becomes "E7" is because the specification says that the 2 MSBit of the address must be set '11' (if you're very interested, see Bluetooth Core v4.0, Vol 3, Part C, chapter 10.8.1.)
BR Håkon
By default, the BLE address is derived from the NRF_FICR->DEVICEADDR[] and is of 48 bits length (6 bytes). This registers are randomly generated in our production, and they are unique for each device (2^46 different combinations, due to MSbits set to '11').
You can read out the address using the API call, "sd_ble_gap_address_get(..);" or reading the FICR->DEVICEADDR[x] registers.
Example: My device advertises with "0xE724 08C78790"
DEVICEADDR[0] = 0x08C78790 DEVICEADDR[1] = 0xYYYYA724
The reason why "A7" becomes "E7" is because the specification says that the 2 MSBit of the address must be set '11' (if you're very interested, see Bluetooth Core v4.0, Vol 3, Part C, chapter 10.8.1.)
BR Håkon
Can I change the mac address by some APPs or some upper monitor?
Hi Jackson,
You can only change the MAC on your local device. To change it on a peer-device, you will need to implement a "hook" (or a ble service) to do this.
Cheers, Håkon
I use the code below but I got the mac address is different from I set .What's more,I find it is constant.
ble_gap_addr_t m_address_1;
m_address_1.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE;
for(uint8_t i = 0;i<2;i++)
{
m_address_1.addr[i] = 0xAAAAAAAA;
}
sd_ble_gap_address_set(BLE_GAP_ADDR_CYCLE_MODE_NONE, &m_address_1);
while(1)
{
for(uint8_t i = 0;i<2;i++)
{
Serial.println(NRF_FICR->DEVICEID[i]);
}
delay(1000);
}
Hi,
Can Nordic MAC address be the same as MAC address of BLE Soc made by another Vendor? As I understand, your MAC address is not an unique address where the first 3 bytes mean Vendor name (www.coffer.com/.../).
The BLE address we provide is a random static address, which means that it is random generated. This does not use any vendor name. The high order of randomness (46 bits are random) in this type of address does not provide 100 % security wrt. two devices having the same address, but the probability is quite low.