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
  • Hi Shenzn,

    Do you use resolvable random address ? Or you simply use the static random address comes as the default with the chip ?

    If you use the static random address, you can just call sd_ble_gap_addr_get() to get the address. It should not be the same for all chips. Each chip should have different address in the FICR.

    If you use resolvable random address ( requires you to use _opt command to set) then it's not much point of getting that address because it will change over time.

    Could you let me know what is the use of own_addr in your case ?

  • Thanks for the answer Hung Bui! In my case the sd_ble_gap_addr_get() function gets all the same value (0x04 0x00 0x20 0xE5 0x08 0x00) for different nFR52832 chips. That is why I have asked about that thing. If any other way to get the unique bluetooth address? And why sd_ble_gap_addr_get() function returns the same value for different chips in my case? Thanks!

Reply
  • Thanks for the answer Hung Bui! In my case the sd_ble_gap_addr_get() function gets all the same value (0x04 0x00 0x20 0xE5 0x08 0x00) for different nFR52832 chips. That is why I have asked about that thing. If any other way to get the unique bluetooth address? And why sd_ble_gap_addr_get() function returns the same value for different chips in my case? Thanks!

Children
No Data
Related