This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Different MAC address for different GAP roles

I am using a nrf52832 Development Board with s132 for some BLE applications. I developed a beacon app, set for BLE peripheral, and every reading of the advertising from this app gives me its MAC address.

Now I am developing a gateway app, set for BLE central. This app will read the advertising from beacons and send a package via uart. This package will include also the gateway MAC. I am using the same board for the gateway, and for the beacons I am using some other hardware I have. To include the gateway MAC address in this package I used sd_ble_gap_address_get(), expecting the same MAC as I have when I use the beacon app for this board. However I get another address for the gateway app.

Is it expected to have different MAC addresses for different GAP roles (peripheral and central) for the same board or is sd_ble_gap_address_get() giving me a wrong MAC address for some reason?

Thank you

Parents
  • Nordic SD API doesn't support setting different MAC addresses for different roles/connection links if they are used in parallel. So all these will have the same MAC address. Don't worry that they would get mixed in the air, there is something called Access Address generated for every connection and that is actually used by Link Layer so that is fine. If you want to pretend to be advertising as multiple GAP Peripherals (= different MAC for each of these different packets) Then you have small problem because this is missing in Nordic SD as of now. If you are only advertising you can use radio_notification API and change Adv. and Scan Resp. data together with MAC (GAP address) before every packet so your device will appear as several advertisers with N-times longer intervals. But once this is mixed with established Peripheral or Connection link it's almost impossible to rotate address correctly so you would need to solve it differently (e.g by going with custom or open source stack).

  • Hi endnode, thank you for your answer. However, I think I did not make myself clear.

    When I program my board with my beacon app (peripheral) it advertises with its MAC.

    When I program my board with my gateway app (central) and use sd_ble_gap_address_get() to get its MAC I get a different address. Different from the one I have using my beacon app.

    I was also expecting to get the same MAC, maybe I am just doing something wrong. This is what I am doing:

    ble_gap_addr_t * local_addr;
    
    sd_ble_gap_address_get(local_addr);
    
    printf("%02X%02X%02X%02X%02X%02X,",					
             local_addr->addr[5],
             local_addr->addr[4],
             local_addr->addr[3],
             local_addr->addr[2],
             local_addr->addr[1],
             local_addr->addr[0]);
    
Reply
  • Hi endnode, thank you for your answer. However, I think I did not make myself clear.

    When I program my board with my beacon app (peripheral) it advertises with its MAC.

    When I program my board with my gateway app (central) and use sd_ble_gap_address_get() to get its MAC I get a different address. Different from the one I have using my beacon app.

    I was also expecting to get the same MAC, maybe I am just doing something wrong. This is what I am doing:

    ble_gap_addr_t * local_addr;
    
    sd_ble_gap_address_get(local_addr);
    
    printf("%02X%02X%02X%02X%02X%02X,",					
             local_addr->addr[5],
             local_addr->addr[4],
             local_addr->addr[3],
             local_addr->addr[2],
             local_addr->addr[1],
             local_addr->addr[0]);
    
Children
No Data
Related