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

nRFConnect iOS and Windows see different modified DEVICE_NAME

Hello,

I have modified my device name (nRF52, BLE) per the function below. When flashed to a board, I then use nRF connect to look for this device.

Using Windows nRFConnect and the nRF52 dongle, the name is "JK_BXY". Using iPhone and nRFConnect, the name is "JUNK_BL". These are scanning the same device at the same time!

I have just started to try and understand how this could be, but it seems that the iOS BLE communication must do something different such that the gap_params_init isn't called or is later overridden. But i cannot find another function that does this (overrides).

The only apparent place sd_ble_gap_device_name_set(...) is called is in this function, which clearly only calls out the modified name.

Does anyone have any suggestions on where to look?

static uint32_t gap_params_init(void)
{
    uint32_t                err_code;
    ble_gap_conn_params_t   gap_conn_params = {0};
    ble_gap_conn_sec_mode_t sec_mode;


    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);

    err_code = gap_address_change();
    VERIFY_SUCCESS(err_code);
		
#if (1)
		/* Change name from JUNK_BL which is the define DEVICE_NAME */
		uint8_t devname[6] = {'J','K','_','B','X','Y'}; 
		
		err_code = sd_ble_gap_device_name_set(&sec_mode,
                                          (const uint8_t *)devname,
                                          7);
#else																			
		err_code = sd_ble_gap_device_name_set(&sec_mode,
                                          (const uint8_t *)DEVICE_NAME,
                                          strlen(DEVICE_NAME));
#endif																					
    VERIFY_SUCCESS(err_code);

    gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
    gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
    gap_conn_params.slave_latency     = SLAVE_LATENCY;
    gap_conn_params.conn_sup_timeout  = CONN_SUP_TIMEOUT;

    err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
    return err_code;
}
Parents
  • Hi,

    I guess the nRFConnect app uses the internal name given by iOS.

    This is a common problem with iOS BLE development. iOS holds an internal name for a device. If iOS has never seen this device before the advertised name will be used. If you connect to this device the device name will be updated by the name read from the generic service. This name will not be updated again by a received advertising. In your case the new name will probably adapted once you connect to the renamed device.

    It is possible in app development to handle this topic different and ignore the internal name from iOS. As an app can get the advertised data it can also grab the name from there.

    Regards Adrian

  • Thanks Adrian. I do believe it has something to do with iOS, though not sure if it is what you describe yet. Is there a way to clear any cache from an iOS device that isn't controlled by an app? For example, i'm using nRFConnect on iPhone. Is there a setting or something somewhere that lets me force a clear of the iOS internal names to see if that tool then sees the correct name? Thanks!

Reply Children
No Data
Related