This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MAC Address for BLE Communication

Hi,

I'm trying send me the mac address of the device by UART by the following method:

void sendMacAddress(void){
  uint8_t packet[6];
  packet[0] = NRF_FICR->DEVICEADDR[0];
  packet[1] = NRF_FICR->DEVICEADDR[0]>>8;
  packet[2] = NRF_FICR->DEVICEADDR[0]>>16;
  packet[3] = NRF_FICR->DEVICEADDR[0]>>24;
  packet[4] = NRF_FICR->DEVICEADDR[1];
  packet[5] = NRF_FICR->DEVICEADDR[1]>>8;
  transmit_string_CR("Start",5);
  for(int i=5; i>=0; --i){
    char msg[2]={0};
    itoa(packet[i],msg,16);
    transmit_string_NCR(msg,2);
    if(i!=0)transmit_string_NCR(":",1);
  }
  CR();
  nrf_delay_ms(1000);
}

By serial I receive: 

Start
b9:24:82:d5:4f:81

The problem its that the device which I receive is not the same that appears in the stick device, I attach photo:

Could anyone tell me that I'm do it correctly?

Best,

Jorge.

Parents Reply Children
  • Your code is correct except for the last 2 bits, which is expected. The last 2 bits in the serial BLE stream are listed below as the most significant 2 bits in the last byte (ie your packet[5]).

    This is the response from an nRF52832, but it doesn't have a label such as the label in your photo above so I can't actually verify if the calculated address matches the expected address on the label:

     // >Central SD Ver. [5.1.0] [59 A5 9] BLE 0001:9132FEF505E6 (DD082605F5FE3291)
     // BLE 0001: 91 32 FE F5 05 E6
     //           DD 08 26 05 F5 FE 32 91
     // reverse   91 32 FE F5 05 26 08 DD
    
     //  BLE 0001:91 32 FE F5 05 E6
     // Your code 91 32 FE F5 05 26
     // packet[i]  0  1  2  3  4  5

    The last 2 bits in the bit stream have different meaning as defined in the Bluetooth Sig; one bit is public/random address but I forget what the other bit is, and I don't have docs to hand. Maybe a Nordic engineer can point to that .. 

    Your photo actually matches your log, I just checked! Except for the 2 special bits, of course.

Related