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

MAC address randomly set to 00:00:00:00:00:00

Hello,

I do migration from SDK11 to SDK12 (S132-SD-v2.0.1 to S132-SD-v3.1.0) and my device (nRF52-DK) randomly got a MAC of 00:00:00:00:00:00.

Helped by the migration document, I configure random private non resolvable MAC address with:

#define BLE_GAP_PRIVATE_ADDR_CYCLE_INTERVAL_S (15 * 60)
sd_ble_gap_privacy_set(&(ble_gap_privacy_params_t) { 
	.privacy_mode = BLE_GAP_PRIVACY_MODE_DEVICE_PRIVACY,
	.private_addr_type = BLE_GAP_ADDR_TYPE_RANDOM_PRIVATE_NON_RESOLVABLE,
	.private_addr_cycle_s = BLE_GAP_PRIVATE_ADDR_CYCLE_INTERVAL_S,
	.p_device_irk = NULL
});

This erroneous MAC address prevent device detection from Apple iphone/ipod.

Moreover, the MAC address seems to change after (during?) each connection !?

Do you see my mistake? Can someone help me?

Thanks!

  • Your code is correct, I just tested it here, and I get the same behavior.

    It should not be 0, and is a bug. I will update this answer when it is fixed.

    With the non-resolvable address type the address will change every number of seconds you set private_addr_cycle_s to, so this is expected.

    And after the first private_addr_cycle_s seconds a proper random non-resolvable address is used, instead of 0. Then iOS should be able to connect.

    Now you are setting private_addr_cycle_s to 15 * 60 s = 15 min. If 15 min is too much, the workaround is to decrease it.

    The device address is not used while you are in a connection, so you don't have to worry about it changing then.

    Edit: It seems like a reset will also remove the issue.

    Edit2: Or put a delay after ble_stack_init(), like nrf_delay_ms(2).

  • Hi Petter,

    A sleep of 20 ms after ble_stack_init() seems to do the job (no problem after 100 tests). With a sleep of 2 ms, I saw the wrong MAC address one time or two.

    I am still interested with a real correction! I let you close the topic at your will.

    Thanks for your help.

Related