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

  • When it advertising I see different addresses by peer_addr = &p_ble_evt->evt.gap_evt.params.connected.peer_addr; But I want to know my own address without looking for that address on another side of communication chain. The problem is that sd_ble_gap_addr_get() returns incorrect address. Different which I see during advertising. Hung Bui, Did you try the sd_ble_gap_addr_get() function? Does it work correct?

Reply
  • When it advertising I see different addresses by peer_addr = &p_ble_evt->evt.gap_evt.params.connected.peer_addr; But I want to know my own address without looking for that address on another side of communication chain. The problem is that sd_ble_gap_addr_get() returns incorrect address. Different which I see during advertising. Hung Bui, Did you try the sd_ble_gap_addr_get() function? Does it work correct?

Children
No Data
Related