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

Getting own bluetooth address of device

Hello,

I have migrated from SoftDevice S130 2.0.1 to SoftDevice S132 3.0.0 and found one mismathing in ble_gap_evt_connected_t structure.

There is absent an own_addr field which excites in previous version. I used that field to get local bluetooth address.

static void on_ble_evt(ble_evt_t * p_ble_evt)
{
    uint32_t                err_code;
    const ble_gap_evt_t   * p_gap_evt = &p_ble_evt->evt.gap_evt;

    switch (p_ble_evt->header.evt_id)
    {
        case BLE_GAP_EVT_CONNECTED:
        {
            m_pending_db_disc_conn = p_ble_evt->evt.gap_evt.conn_handle;
            m_retry_db_disc = false;
					
            ble_gap_addr_t * peer_addr;
	        ble_gap_addr_t * own_addr;	
				
	        peer_addr = &p_ble_evt->evt.gap_evt.params.connected.peer_addr;
	        own_addr = &p_ble_evt->evt.gap_evt.params.connected.own_addr;

   ...

How to get local bluetooth address now? with softdevice s132 v3.x.x

Should I use sd_ble_gap_addr_get() function for that? I have tried it but it returns the same values for all chips.

Could you please clarify such detail? Thanks!

Parents
  • It doesn't sound very right that all chip returns same address. The default address should match with the 48bit DEVICEADDR in the FICR. Could you try to test with any ble peripheral example in the SDK ? Simply add sd_ble_gap_addr_get() call in and check the address. It should match with address when advertising. You can use PC or a Phone to check the address of the advertiser.

    image description

  • Sure, the sd_ble_gap_addr_get() has not return the same address. But it does in my case. I did like you say and check When it advertises I see unique address but if I use the mentioned function I am not able to get that address. So that function returns all the time the same value on different chips. So I am wondering if is it buggy function or me doing something wrong? If any way to check it?

Reply
  • Sure, the sd_ble_gap_addr_get() has not return the same address. But it does in my case. I did like you say and check When it advertises I see unique address but if I use the mentioned function I am not able to get that address. So that function returns all the time the same value on different chips. So I am wondering if is it buggy function or me doing something wrong? If any way to check it?

Children
No Data
Related