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

MAC Address Read in BMD 300 nrf52 - DK

Hi,
I am developing an application using BMaD 300 Eval board nrf52. As a first I want to display device information along with MAC address of BMD 300 I have, in advertising packet. But when I try to read the register UICR in BMD 300 documentation says read back protection is enabled on register UICR. Can you help me with directions to read MAC address of BMD 300 I have, in my application. Firmware version is AB.
Thanks,
Aravind
Parents
  • The default BLE address is in the FICR, not UICR, There are two ways of reading this, direct or via the SD Device.

    // MAC Address
    // ===========
    //
    // Last 2 bits in 48-bit stream - top 2 bits in last byte of Device Address
    // 00 Public
    // 01 Random Static
    // 10 Resolvable
    // 11 Non-Resolvable
    //
    // Note that even though the address is "Random", it is invariant and never changes
    // for a specific Nordic device as the NRF_FICR->DEVICEADDR registers are Read-Only
    //
    // formed from NRF_FICR->DEVICEADDR[1] and NRF_FICR->DEVICEADDR[0]
    // eg: BLE 1:B6DB78952FCE (B0050E2F9578DBB6)

    or from the SoftDevice:

        // Get actual BLE address in case it is different from hardware register BLE address
        ble_gap_addr_t device_addr;  /**< 48-bit address, LSB format. */
        sd_ble_gap_addr_get(&device_addr);

    Here is an example:

       snprintf(IPacket, sizeof(IPacket), "Id %08X%08X, Peer %u, Type %u, Addr %02X:%02X:%02X:%02X:%02X:%02X\r\n",
                NRF_FICR->DEVICEADDR[1], NRF_FICR->DEVICEADDR[0],
                device_addr.addr_id_peer, device_addr.addr_type, device_addr.addr[0], device_addr.addr[1],
                device_addr.addr[2], device_addr.addr[3], device_addr.addr[4], device_addr.addr[5]);
    
    Output:
    Id 71959DCC72DCF09F, Peer 0, Type 1, Addr 9F:F0:DC:72:CC:DD

Reply
  • The default BLE address is in the FICR, not UICR, There are two ways of reading this, direct or via the SD Device.

    // MAC Address
    // ===========
    //
    // Last 2 bits in 48-bit stream - top 2 bits in last byte of Device Address
    // 00 Public
    // 01 Random Static
    // 10 Resolvable
    // 11 Non-Resolvable
    //
    // Note that even though the address is "Random", it is invariant and never changes
    // for a specific Nordic device as the NRF_FICR->DEVICEADDR registers are Read-Only
    //
    // formed from NRF_FICR->DEVICEADDR[1] and NRF_FICR->DEVICEADDR[0]
    // eg: BLE 1:B6DB78952FCE (B0050E2F9578DBB6)

    or from the SoftDevice:

        // Get actual BLE address in case it is different from hardware register BLE address
        ble_gap_addr_t device_addr;  /**< 48-bit address, LSB format. */
        sd_ble_gap_addr_get(&device_addr);

    Here is an example:

       snprintf(IPacket, sizeof(IPacket), "Id %08X%08X, Peer %u, Type %u, Addr %02X:%02X:%02X:%02X:%02X:%02X\r\n",
                NRF_FICR->DEVICEADDR[1], NRF_FICR->DEVICEADDR[0],
                device_addr.addr_id_peer, device_addr.addr_type, device_addr.addr[0], device_addr.addr[1],
                device_addr.addr[2], device_addr.addr[3], device_addr.addr[4], device_addr.addr[5]);
    
    Output:
    Id 71959DCC72DCF09F, Peer 0, Type 1, Addr 9F:F0:DC:72:CC:DD

Children
No Data
Related