<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Intermittent Stuck in &amp;quot;Connecting...&amp;quot; with iOS 18 and nRF Connect Mobile</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/117949/intermittent-stuck-in-connecting-with-ios-18-and-nrf-connect-mobile</link><description>Hello Nordic Community, 
 I’m encountering an intermittent issue with my BLE peripherals, which are based on nRF5340 + nRF7002 SoC , while testing with nRF Connect Mobile on devices running iOS 18 . 
 The issue manifests as follows: 
 
 The peripheral</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 22 Feb 2025 01:56:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/117949/intermittent-stuck-in-connecting-with-ios-18-and-nrf-connect-mobile" /><item><title>RE: Intermittent Stuck in "Connecting..." with iOS 18 and nRF Connect Mobile</title><link>https://devzone.nordicsemi.com/thread/524178?ContentTypeID=1</link><pubDate>Sat, 22 Feb 2025 01:56:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:389ffa03-4a3f-403c-907f-58b19967210a</guid><dc:creator>Lucas Heitele</dc:creator><description>&lt;p data-start="73" data-end="90"&gt;&lt;strong data-start="73" data-end="88"&gt;Hi Susheel,&lt;/strong&gt;&lt;/p&gt;
&lt;p data-start="92" data-end="211"&gt;Thanks for your response! I have taken some Wireshark sniffer logs and analyzed the BLE traffic. Here&amp;rsquo;s what I found:&lt;/p&gt;
&lt;p data-start="213" data-end="697"&gt;1️⃣ &lt;strong data-start="217" data-end="303"&gt;iOS 18 scans my device (&lt;code data-start="243" data-end="253"&gt;SCAN_REQ&lt;/code&gt;) and my device correctly responds (&lt;code data-start="289" data-end="299"&gt;SCAN_RSP&lt;/code&gt;).&lt;/strong&gt;&lt;br data-start="303" data-end="306" /&gt;2️⃣ &lt;strong data-start="310" data-end="357"&gt;However, iOS 18 never sends a &lt;code data-start="342" data-end="355"&gt;CONNECT_IND&lt;/code&gt;&lt;/strong&gt;, meaning my peripheral never receives a connection request.&lt;br data-start="417" data-end="420" /&gt;3️⃣ The issue &lt;strong data-start="434" data-end="459"&gt;only occurs on iOS 18&lt;/strong&gt;. Android and earlier iOS versions &lt;strong data-start="494" data-end="520"&gt;connect without issues&lt;/strong&gt;.&lt;br data-start="521" data-end="524" /&gt;4️⃣ My &lt;strong data-start="531" data-end="584"&gt;advertising flags (&lt;code data-start="552" data-end="558"&gt;0x06&lt;/code&gt;) and scan response data&lt;/strong&gt; appear to be formatted correctly.&lt;br data-start="618" data-end="621" /&gt;5️⃣ My &lt;strong data-start="628" data-end="661" data-is-only-node=""&gt;advertising interval (~100ms)&lt;/strong&gt; is within Apple&amp;rsquo;s expected range.&lt;/p&gt;
&lt;p data-start="699" data-end="863"&gt;Since iOS 18 is &lt;strong data-start="715" data-end="769"&gt;scanning my device but not initiating a connection&lt;/strong&gt;, I suspect that iOS &lt;strong data-start="790" data-end="826"&gt;has stricter BLE filtering rules&lt;/strong&gt; or there is a compatibility issue.&lt;/p&gt;
&lt;p data-start="865" data-end="919"&gt;Could you help analyze whether this could be due to:&lt;/p&gt;
&lt;ul data-start="920" data-end="1064"&gt;
&lt;li data-start="920" data-end="962"&gt;&lt;strong data-start="922" data-end="960"&gt;New iOS 18 BLE filtering behavior?&lt;/strong&gt;&lt;/li&gt;
&lt;li data-start="963" data-end="1013"&gt;&lt;strong data-start="965" data-end="1011"&gt;A missing or unexpected advertising field?&lt;/strong&gt;&lt;/li&gt;
&lt;li data-start="1014" data-end="1064"&gt;&lt;strong data-start="1016" data-end="1062"&gt;Security settings or bonding requirements?&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p data-start="1066" data-end="1168"&gt;I can provide sniffer logs if needed. Let me know if you have any recommendations on how to proceed!&lt;/p&gt;
&lt;p data-start="1170" data-end="1190"&gt;Thanks in advance!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent Stuck in "Connecting..." with iOS 18 and nRF Connect Mobile</title><link>https://devzone.nordicsemi.com/thread/521026?ContentTypeID=1</link><pubDate>Mon, 03 Feb 2025 07:44:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5970e3a-bda8-4ff3-bf70-9aa809e62e15</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Sorry for late response. Was away for a while.&lt;br /&gt;I think we can answer who is at fault here if you can attach a air sniffer log of the whole communication. We can then analyze the timings of response from each side and pinpoint the issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent Stuck in "Connecting..." with iOS 18 and nRF Connect Mobile</title><link>https://devzone.nordicsemi.com/thread/520483?ContentTypeID=1</link><pubDate>Tue, 28 Jan 2025 23:51:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18c31cb3-df1c-4cba-974c-a2144bc55981</guid><dc:creator>Lucas Heitele</dc:creator><description>&lt;p&gt;Hi Susheel,&lt;/p&gt;
&lt;p&gt;Thank you for your response! The issue does not seem specific to a sample but appears across various custom implementations, including mine, which I&amp;rsquo;ve shared above. My setup uses nRF Connect SDK v2.6.0, and the advertisement and connection logic are implemented as shown in the code.&lt;/p&gt;
&lt;p&gt;This is my BLE related code:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#include &amp;lt;zephyr/logging/log.h&amp;gt;
LOG_MODULE_REGISTER(ble_control, CONFIG_LOG_DEFAULT_LEVEL);

#include &amp;quot;ble_control.h&amp;quot;

#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/types.h&amp;gt;
#include &amp;lt;stddef.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;lt;zephyr/logging/log_backend_ble.h&amp;gt;
#include &amp;lt;zephyr/mgmt/mcumgr/transport/smp_bt.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/bluetooth.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/uuid.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/gatt.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/conn.h&amp;gt;
#include &amp;lt;zephyr/settings/settings.h&amp;gt;
#include &amp;lt;zephyr/bluetooth/services/dis.h&amp;gt;
#include &amp;lt;zephyr/random/random.h&amp;gt;

#include &amp;quot;version.h&amp;quot;
#include &amp;quot;status_control.h&amp;quot;
#include &amp;quot;sensor_control.h&amp;quot;
#include &amp;quot;led_control.h&amp;quot;
#include &amp;quot;../power_management.h&amp;quot;
#include &amp;quot;../services/data_service.h&amp;quot;
#include &amp;quot;../services/start_service.h&amp;quot;
#include &amp;quot;../services/production_service.h&amp;quot;

#define BLE_AUTH_DELAY_MS       1000 // ms
#define MAX_AUTH_RETRIES        3
#define RANDOM_ID_PREFIX        &amp;quot;EVR-&amp;quot;
#define RANDOM_ID_LEN           32
#define MIN_CONN_INTERVAL 0x0010 // 20ms
#define MAX_CONN_INTERVAL 0x0020 // 40ms
#define SLAVE_LATENCY     0      // No latency
#define CONN_SUP_TIMEOUT  400    // 4 seconds
#define MAX_AUTH_RETRIES  3
#define RETRY_DELAY_MS    300

static struct bt_le_conn_param *conn_params = BT_LE_CONN_PARAM(
    MIN_CONN_INTERVAL,
    MAX_CONN_INTERVAL,
    SLAVE_LATENCY,
    CONN_SUP_TIMEOUT
);

static struct k_work_delayable auth_work;
static struct bt_conn *pending_conn = NULL;

static bool bl_central_connected = false;
static char random_id[RANDOM_ID_LEN + 1]; // +1 for null terminator

static int auth_retries = 0;

static struct bt_data ad[3] = {
    BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
    BT_DATA_BYTES(BT_DATA_UUID16_ALL, BT_UUID_16_ENCODE(BT_UUID_DIS_VAL)),
    BT_DATA_BYTES(BT_DATA_UUID128_ALL, LOGGER_BACKEND_BLE_ADV_UUID_DATA),
    BT_DATA(BT_DATA_NAME_COMPLETE, NULL, 0), // Placeholder for name
};

/* Function prototypes */
static int bt_ready(void);
static void construct_advertisement_data(void);
static void auth_work_handler(struct k_work *work);

static struct bt_conn_le_phy_param *phy_params = BT_CONN_LE_PHY_PARAM_1M;

/**
 * Construct advertisement data using the serial number and side from production_service.
 */
static void construct_advertisement_data(void)
{
    const char *serial = get_serialnumber();

    if (!serial || strlen(serial) == 0) {
        LOG_ERR(&amp;quot;Serial number not available for advertisement.&amp;quot;);
        return;
    }

    snprintf(random_id, RANDOM_ID_LEN, &amp;quot;%s%s&amp;quot;, RANDOM_ID_PREFIX, serial);

    ad[2] = (struct bt_data)BT_DATA(BT_DATA_NAME_COMPLETE, random_id, strlen(random_id));

    LOG_INF(&amp;quot;Advertisement data set: %s&amp;quot;, random_id);
}

static int bt_ready(void)
{
    int ret;

    LOG_INF(&amp;quot;Bluetooth initialized&amp;quot;);

    construct_advertisement_data();

    struct bt_le_adv_param adv_param = {
        .id = BT_ID_DEFAULT,
        .interval_min = 0x0030, // 30ms
        .interval_max = 0x0060, // 60ms
        .options = BT_LE_ADV_OPT_CONNECTABLE,
    };

    // Start advertising
    ret = bt_le_adv_start(&amp;amp;adv_param, ad, ARRAY_SIZE(ad), NULL, 0);
    if (ret) {
        LOG_ERR(&amp;quot;Advertising failed to start (err %d)&amp;quot;, ret);
        return ret;
    }

    LOG_INF(&amp;quot;Advertising successfully started&amp;quot;);
    return 0;
}

static void auth_work_handler(struct k_work *work)
{
    if (!pending_conn) {
        LOG_ERR(&amp;quot;No connection available for security setup&amp;quot;);
        return;
    }

    int security_err = bt_conn_set_security(pending_conn, BT_SECURITY_L2);
    if (security_err) {
        LOG_ERR(&amp;quot;Failed to set security (err %d), retrying...&amp;quot;, security_err);
        auth_retries++;

        if (auth_retries &amp;lt; MAX_AUTH_RETRIES) {
            k_work_reschedule(&amp;amp;auth_work, K_MSEC(RETRY_DELAY_MS));
        } else {
            LOG_ERR(&amp;quot;Authentication failed after %d retries&amp;quot;, MAX_AUTH_RETRIES);
            bt_conn_disconnect(pending_conn, BT_HCI_ERR_AUTH_FAIL);
            auth_retries = 0;
            bt_conn_unref(pending_conn);
            pending_conn = NULL;
        }
    } else {
        LOG_INF(&amp;quot;Security successfully set&amp;quot;);
        auth_retries = 0;

        // Update connection parameters
        bt_conn_le_param_update(pending_conn, conn_params);

        // Request PHY update
        int ret = bt_conn_le_phy_update(pending_conn, phy_params);
        if (ret) {
            LOG_ERR(&amp;quot;Failed to update PHY (err %d)&amp;quot;, ret);
        } else {
            LOG_INF(&amp;quot;PHY update requested to 1M&amp;quot;);
        }

        bt_conn_unref(pending_conn);
        pending_conn = NULL;

        led_switch(LED_GREEN);
        led_active_on();
        bl_central_connected = true;

        LOG_INF(&amp;quot;Connected&amp;quot;);
    }
}

int init_ble(void)
{
    k_work_init_delayable(&amp;amp;auth_work, auth_work_handler);

    int ret = bt_enable(NULL);
    if (ret != 0) {
        LOG_ERR(&amp;quot;Bluetooth enable failed: %d&amp;quot;, ret);
        return ret;
    }

    ret = settings_load();
    if (ret != 0) {
        LOG_ERR(&amp;quot;Load settings failed: %d&amp;quot;, ret);
        return ret;
    }

    ret = production_service_init();
    if (ret != 0) {
        LOG_ERR(&amp;quot;Init production service failed: %d&amp;quot;, ret);
        return ret;
    }

    ret = bt_ready();
    if (ret != 0) {
        LOG_ERR(&amp;quot;Bluetooth initialization failed: %d&amp;quot;, ret);
        return ret;
    }

    LOG_INF(&amp;quot;Bluetooth initialized!&amp;quot;);
    return ret;
}

static void connected(struct bt_conn *conn, uint8_t err)
{
    if (err) {
        LOG_ERR(&amp;quot;Connection failed (err 0x%02x)&amp;quot;, err);
        return;
    }

    auth_retries = 0;

    pending_conn = bt_conn_ref(conn);
    k_work_schedule(&amp;amp;auth_work, K_MSEC(BLE_AUTH_DELAY_MS));

    stop_power_off_work();
}

static void disconnected(struct bt_conn *conn, uint8_t reason)
{
    LOG_INF(&amp;quot;Disconnected (reason 0x%02x)&amp;quot;, reason);

    bl_central_connected = false;
    led_switch(LED_RED);
    start_power_off_work();
}

BT_CONN_CB_DEFINE(conn_callbacks) = {
    .connected = connected,
    .disconnected = disconnected,
};

bool central_connected(void)
{
    return bl_central_connected;
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The problem isn&amp;#39;t specific to the nRF Connect app, as it also occurs in other BLE applications on iOS 18. However, Android and iOS versions prior to iOS 18 do not exhibit this behavior.&lt;/p&gt;
&lt;p&gt;If you can reproduce the issue on your end, it would be great to compare notes. Let me know if there are any specific tests or configurations you&amp;rsquo;d recommend to narrow down the problem further.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent Stuck in "Connecting..." with iOS 18 and nRF Connect Mobile</title><link>https://devzone.nordicsemi.com/thread/519900?ContentTypeID=1</link><pubDate>Fri, 24 Jan 2025 01:15:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a5fac617-d926-461e-a915-13952b173437</guid><dc:creator>superglitch</dc:creator><description>&lt;p&gt;I am noticing some weird issues related to iOS 18.&amp;nbsp; We are trying to do a firmware update and it changes the advertisement data which causes a whole slew of problems where you can&amp;#39;t read or write from the charertistics until cycling Bluetooth off and on or rebooting the phone.&amp;nbsp; Without being a BLE protocol expert I can&amp;#39;t tell who is at fault here either apple or nordic.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Intermittent Stuck in "Connecting..." with iOS 18 and nRF Connect Mobile</title><link>https://devzone.nordicsemi.com/thread/518319?ContentTypeID=1</link><pubDate>Tue, 14 Jan 2025 18:41:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7634cc0b-ac9e-4d3d-9b0f-eb0f36b435e0</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Lucas,&lt;/p&gt;
&lt;p&gt;Sorry for late response. Which Sample have you used to test this? I have an IOS18 which I can use to test this. Please give me SDK version and sample name for me to reproduce this. It could also be an issue with the nrf connect for mobile on IOS aswell, need to first be able to reproduce it on my desk.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>