<?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>Setting Up DFU OTA On S110 ( PCA10001 )</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9501/setting-up-dfu-ota-on-s110-pca10001</link><description>Hello
I want to setting up DFU in my project. I followed this document :
 link text 
I&amp;#39;m using IAR EWARM and nRF51_SDK_8.0.0 and &amp;quot;nRF51_SDK_8.0.0\examples\dfu\bootloader&amp;quot; as bootloader. 
 It&amp;#39;s amazing that when using ble_dfu_init function , program</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 05 Oct 2015 14:46:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9501/setting-up-dfu-ota-on-s110-pca10001" /><item><title>RE: Setting Up DFU OTA On S110 ( PCA10001 )</title><link>https://devzone.nordicsemi.com/thread/35066?ContentTypeID=1</link><pubDate>Mon, 05 Oct 2015 14:46:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fab85e94-4620-4cc9-944c-947732f199ae</guid><dc:creator>Anders Strand</dc:creator><description>&lt;p&gt;Are you running in debug mode? If yes, &lt;a href="https://devzone.nordicsemi.com/question/18039/bootloader-debugging/"&gt;this&lt;/a&gt; post might help you out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Up DFU OTA On S110 ( PCA10001 )</title><link>https://devzone.nordicsemi.com/thread/35065?ContentTypeID=1</link><pubDate>Sat, 03 Oct 2015 10:23:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c298df14-5245-4c0a-a6e2-7e22c70ec300</guid><dc:creator>Sourena</dc:creator><description>&lt;p&gt;Thank u Anders Strand
this image shows initial PC value is 0xFFFFFFFE instead of main()! but why??!!
When i uncheck [Options...-&amp;gt;Debugger-&amp;gt;Run to main()] , program will start from 0x000006D0 that is OK.
but when PC arrive to 0x164FA , jump to  0xFFFFFFFE instead of main()...
This problem occurred when ble_dfu_init() added.
My project is based on the ble_app_hids_keyboard sample.
Summary of my code is :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;.
.
.
#include &amp;quot;ble_dfu.h&amp;quot;
#include &amp;quot;dfu_app_handler.h&amp;quot;
.
.
.
#define IS_SRVC_CHANGED_CHARACT_PRESENT  1                                              /**&amp;lt; Include or not the service_changed characteristic. if not enabled, the server&amp;#39;s database cannot be changed for the lifetime of the device*/
.
.
.
#define DFU_REV_MAJOR                    0x00                                       /** DFU Major revision number to be exposed. */
#define DFU_REV_MINOR                    0x01                                       /** DFU Minor revision number to be exposed. */
#define DFU_REVISION                     ((DFU_REV_MAJOR &amp;lt;&amp;lt; 8) | DFU_REV_MINOR)     /** DFU Revision number to be exposed. Combined of major and minor versions. */
#define APP_SERVICE_HANDLE_START         0x000C                                     /**&amp;lt; Handle of first application specific service when when service changed characteristic is present. */
#define BLE_HANDLE_MAX                   0xFFFF                                     /**&amp;lt; Max handle value in BLE. */
STATIC_ASSERT(IS_SRVC_CHANGED_CHARACT_PRESENT);                                     /** When having DFU Service support in application the Service Changed Characteristic should always be present. */
.
.
.
static ble_dfu_t                         m_dfus;                                    /**&amp;lt; Structure used to identify the DFU service. */
.
.
.
.
static void advertising_stop(void)
{
    uint32_t err_code;

    err_code = sd_ble_gap_adv_stop();
    APP_ERROR_CHECK(err_code);

    err_code = bsp_indication_set(BSP_INDICATE_IDLE);
    APP_ERROR_CHECK(err_code);
}

static void app_context_load(dm_handle_t const * p_handle)
{
    uint32_t                 err_code;
    static uint32_t          context_data;
    dm_application_context_t context;

    context.len    = sizeof(context_data);
    context.p_data = (uint8_t *)&amp;amp;context_data;

    err_code = dm_application_context_get(p_handle, &amp;amp;context);
    if (err_code == NRF_SUCCESS)
    {
        // Send Service Changed Indication if ATT table has changed.
        if ((context_data &amp;amp; (DFU_APP_ATT_TABLE_CHANGED &amp;lt;&amp;lt; DFU_APP_ATT_TABLE_POS)) != 0)
        {
            err_code = sd_ble_gatts_service_changed(m_conn_handle, APP_SERVICE_HANDLE_START, BLE_HANDLE_MAX);
            if ((err_code != NRF_SUCCESS) &amp;amp;&amp;amp;
                (err_code != BLE_ERROR_INVALID_CONN_HANDLE) &amp;amp;&amp;amp;
                (err_code != NRF_ERROR_INVALID_STATE) &amp;amp;&amp;amp;
                (err_code != BLE_ERROR_NO_TX_BUFFERS) &amp;amp;&amp;amp;
                (err_code != NRF_ERROR_BUSY) &amp;amp;&amp;amp;
                (err_code != BLE_ERROR_GATTS_SYS_ATTR_MISSING))
            {
                APP_ERROR_HANDLER(err_code);
            }
        }

        err_code = dm_application_context_delete(p_handle);
        APP_ERROR_CHECK(err_code);
    }
    else if (err_code == DM_NO_APP_CONTEXT)
    {
        // No context available. Ignore.
    }
    else
    {
        APP_ERROR_HANDLER(err_code);
    }
}


static void reset_prepare(void)
{
    uint32_t err_code;

    if (m_conn_handle != BLE_CONN_HANDLE_INVALID)
    {
        // Disconnect from peer.
        err_code = sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
        APP_ERROR_CHECK(err_code);
        err_code = bsp_indication_set(BSP_INDICATE_IDLE);
        APP_ERROR_CHECK(err_code);
    }
    else
    {
        // If not connected, the device will be advertising. Hence stop the advertising.
        advertising_stop();
    }

    err_code = ble_conn_params_stop();
    APP_ERROR_CHECK(err_code);

    nrf_delay_ms(500);
}


void dfu_init(){

    ble_dfu_init_t   dfus_init;
    uint32_t err_code;
    // Initialize the Device Firmware Update Service.
    memset(&amp;amp;dfus_init, 0, sizeof(dfus_init));

    dfus_init.evt_handler   = dfu_app_on_dfu_evt;
    dfus_init.error_handler = NULL;
    dfus_init.evt_handler   = dfu_app_on_dfu_evt;
    dfus_init.revision      = DFU_REVISION;

    err_code = ble_dfu_init(&amp;amp;m_dfus, &amp;amp;dfus_init);
    APP_ERROR_CHECK(err_code);

    dfu_app_reset_prepare_set(reset_prepare);
    dfu_app_dm_appl_instance_set(m_app_handle);

}
.
.
.
static void services_init(void)
{
.
.
.
    dfu_init();
}
.
.
.
static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
{
.
.
.
ble_dfu_on_ble_evt(&amp;amp;m_dfus, p_ble_evt);
}
.
.
.
static uint32_t device_manager_evt_handler(dm_handle_t const    * p_handle,
                                           dm_event_t const     * p_event,
                                           ret_code_t           event_result)
{
    APP_ERROR_CHECK(event_result);

    switch(p_event-&amp;gt;event_id)
    {
    	case   DM_EVT_LINK_SECURED:
        	app_context_load(p_handle);
    	break;
        case DM_EVT_DEVICE_CONTEXT_LOADED: // Fall through.
        case DM_EVT_SECURITY_SETUP_COMPLETE:
            m_bonded_peer_handle = (*p_handle);
            break;
    }

    return NRF_SUCCESS;
}
.
.
.
int main(void)
{
    uint32_t err_code;
    app_trace_init();
    timers_init();
    buttons_leds_init(&amp;amp;erase_bonds);
    ble_stack_init();
    adc_configure();
    scheduler_init();
    device_manager_init(erase_bonds);
    gap_params_init();
    advertising_init();
    services_init();
    conn_params_init();
    buffer_init();
    timers_start();
    err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
    APP_ERROR_CHECK(err_code);
    InitNVM();
    // Enter main loop.
    for (;;)
    {
        app_sched_execute();
        power_manage();
    }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I tested ble_app_hrs_s110_with_dfu sample and works well.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Setting Up DFU OTA On S110 ( PCA10001 )</title><link>https://devzone.nordicsemi.com/thread/35064?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2015 09:39:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ee313bc-325a-49df-ab7e-9b9ab2695662</guid><dc:creator>Anders Strand</dc:creator><description>&lt;p&gt;Hi. Can you explain the image you attached? What is the different columns? Are you calling ble_dfu_init() directly in main.c? In the example code it is called a inside a larger initiation process, bootloader_dfu_start() in main().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>