This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DFU in nRF Toolbox on iOS won't reconnect if in non-encrypted connection

Hi,

I am trying to update some code to the last SDK and softdevice. When I trying to perform a DFU update using the iOS app nRF Toolbox on my iPad the device will not reconnect after entering the bootloader mode, although I can see that it is advertising as 'DFUTarg' with the MCP on my PC. This is my environment:

SDK: nRF51_SDK_9.0.0_2e23562

Softdevice: s110_nrf51_8.0.0_softdevice.hex

nRF Toolbox under iOS 9.1 and iPad 3

Master Control Panel 3.9.0.6

Keil uVision: v 5.10.0.0

softdevice.hex

bootloader.hex

sd_s110_8_0_0_and_bootloader.zip

My application does not have any characteristic encrypted and it does not use bonding. I have also tested to update a encrypted example from the SDK namely 'dfu_test_app_hrm_s110.zip'. If I use this application code the iPad reconnects after starting bootloader using direct advertising. In a non-encrypted connection, the app will not reconnect. I will tap the 'Upload' option after selecting the device, and it will stay on hold forever in a 'waiting' status. I have attached two captures from RTT to see the difference between an encrypted update and a non-encrypted update.

Non-encrypted DFU (Connectable undirected advertising)

Non-Encrypted DFU

Encrypted DFU (Connectable directed advertising)

Encrypted DFU

The only way to complete the update is to go back into the nRF Toolbox main menu , enter the DFU, reselect the file and file type and select the device. Then it will reconnect and it is possible to upload the code.

Any help is welcome. Please let me know if you need any other info. Thanks

Parents
  • Hi,

    Thanks for your reply.

    I am using a non-encrypted connection. No bonding information is shared. The device enters the bootloader mode correctly and starts advertising as 'DFUTarg', but the nRF Toolbox will not reconnect. I can see the device on the MCP advertising as in the image attached.

    DFUTarg on MCP

    The bootloader code will advertise as Connectable undirected and LE General Discoverable Mode if there is no bonding information (m_ble_peer_data_valid is false). I consider this is correct, the problem is that the app nRF Toolbox under DFU will not reconnect to the device, so it is needed to select the device again (this time around selected as 'DFUTarg'). Please have a close look at this last step.

    static void advertising_start(void)
    {
        if (!m_is_advertising)
        { 
           uint32_t err_code;
    
            // Initialize advertising parameters (used when starting advertising).
            memset(&m_adv_params, 0, sizeof(m_adv_params));
    
            if (m_ble_peer_data_valid)
            {
    						SEGGER_RTT_WriteString(0, "Peer Valid Data\n");
                ble_gap_irk_t empty_irk = {{0}};
    
                if (memcmp(m_ble_peer_data.irk.irk, empty_irk.irk, sizeof(empty_irk.irk)) == 0)
                {
                    advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE);
                    m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND;
                    m_adv_params.p_peer_addr = &m_ble_peer_data.addr;
                    m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
                    m_adv_params.interval    = 0;
                    m_adv_params.timeout     = 0;
                }
                else
                {
                    ble_gap_irk_t  * p_irk[1];
                    ble_gap_addr_t * p_addr[1];
    
                    p_irk[0]  = &m_ble_peer_data.irk;
                    p_addr[0] = &m_ble_peer_data.addr;
    
                    ble_gap_whitelist_t whitelist;
                    whitelist.addr_count = 1;
                    whitelist.pp_addrs   = p_addr;
                    whitelist.irk_count  = 1;
                    whitelist.pp_irks    = p_irk;
    
                    advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
                    m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
                    m_adv_params.fp          = BLE_GAP_ADV_FP_FILTER_CONNREQ;
                    m_adv_params.p_whitelist = &whitelist;
                    m_adv_params.interval    = APP_ADV_INTERVAL;
                    m_adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
                }
            }
            else
            {
    						SEGGER_RTT_WriteString(0, "No Peer Valid Data\n");
                advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
                m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
                m_adv_params.p_peer_addr = NULL;
                m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
                m_adv_params.interval    = APP_ADV_INTERVAL;
                m_adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
            }
    
            err_code = sd_ble_gap_adv_start(&m_adv_params);
            APP_ERROR_CHECK(err_code);
    
            nrf_gpio_pin_clear(ADVERTISING_LED_PIN_NO);
    				
    				SEGGER_RTT_WriteString(0, "Start Advertising\n");
    
            m_is_advertising = true;
        }
    }
    

    Best Regards

Reply
  • Hi,

    Thanks for your reply.

    I am using a non-encrypted connection. No bonding information is shared. The device enters the bootloader mode correctly and starts advertising as 'DFUTarg', but the nRF Toolbox will not reconnect. I can see the device on the MCP advertising as in the image attached.

    DFUTarg on MCP

    The bootloader code will advertise as Connectable undirected and LE General Discoverable Mode if there is no bonding information (m_ble_peer_data_valid is false). I consider this is correct, the problem is that the app nRF Toolbox under DFU will not reconnect to the device, so it is needed to select the device again (this time around selected as 'DFUTarg'). Please have a close look at this last step.

    static void advertising_start(void)
    {
        if (!m_is_advertising)
        { 
           uint32_t err_code;
    
            // Initialize advertising parameters (used when starting advertising).
            memset(&m_adv_params, 0, sizeof(m_adv_params));
    
            if (m_ble_peer_data_valid)
            {
    						SEGGER_RTT_WriteString(0, "Peer Valid Data\n");
                ble_gap_irk_t empty_irk = {{0}};
    
                if (memcmp(m_ble_peer_data.irk.irk, empty_irk.irk, sizeof(empty_irk.irk)) == 0)
                {
                    advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE);
                    m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_DIRECT_IND;
                    m_adv_params.p_peer_addr = &m_ble_peer_data.addr;
                    m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
                    m_adv_params.interval    = 0;
                    m_adv_params.timeout     = 0;
                }
                else
                {
                    ble_gap_irk_t  * p_irk[1];
                    ble_gap_addr_t * p_addr[1];
    
                    p_irk[0]  = &m_ble_peer_data.irk;
                    p_addr[0] = &m_ble_peer_data.addr;
    
                    ble_gap_whitelist_t whitelist;
                    whitelist.addr_count = 1;
                    whitelist.pp_addrs   = p_addr;
                    whitelist.irk_count  = 1;
                    whitelist.pp_irks    = p_irk;
    
                    advertising_init(BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED);
                    m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
                    m_adv_params.fp          = BLE_GAP_ADV_FP_FILTER_CONNREQ;
                    m_adv_params.p_whitelist = &whitelist;
                    m_adv_params.interval    = APP_ADV_INTERVAL;
                    m_adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
                }
            }
            else
            {
    						SEGGER_RTT_WriteString(0, "No Peer Valid Data\n");
                advertising_init(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
                m_adv_params.type        = BLE_GAP_ADV_TYPE_ADV_IND;
                m_adv_params.p_peer_addr = NULL;
                m_adv_params.fp          = BLE_GAP_ADV_FP_ANY;
                m_adv_params.interval    = APP_ADV_INTERVAL;
                m_adv_params.timeout     = APP_ADV_TIMEOUT_IN_SECONDS;
            }
    
            err_code = sd_ble_gap_adv_start(&m_adv_params);
            APP_ERROR_CHECK(err_code);
    
            nrf_gpio_pin_clear(ADVERTISING_LED_PIN_NO);
    				
    				SEGGER_RTT_WriteString(0, "Start Advertising\n");
    
            m_is_advertising = true;
        }
    }
    

    Best Regards

Children
No Data
Related