<?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>MESH DFU PROBLEM</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46570/mesh-dfu-problem</link><description>Hello, 
 Here i are using nRF52832 ,softdevice S132 and mesh sdk v3.0.0 
 For my Application,i need to go with DFU.so i merged my application into the example code of DFU provided by MESH SDK. 
 As my Application needs BUTTON related functions.so for</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 May 2019 04:04:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46570/mesh-dfu-problem" /><item><title>RE: MESH DFU PROBLEM</title><link>https://devzone.nordicsemi.com/thread/186815?ContentTypeID=1</link><pubDate>Tue, 14 May 2019 04:04:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:281453cb-02c7-4d14-ba0c-d38b4afb4a87</guid><dc:creator>SAIF</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for ur reply.&lt;/p&gt;
&lt;p&gt;Yeah,Above mentioned DFU process is working fine.i.e,by uploading Softdevice,Bootloader and dfu_package file related to my application of LIGHT_SWITCH_SERVER code,it is entering into DFU_TARGET mode and i can able to upload my DFU_PACKAGE file as many time as i want and for one to one device only.&lt;/p&gt;
&lt;p&gt;Yes,i have tried flashing the example before the mesh dfu process and in that case the buttons doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;But,as of now&amp;nbsp; my application with DFU seems to work with LIGHT_SWITCH_SERVER code only.&lt;/p&gt;
&lt;p&gt;So,i have not gone with MESH DFU code provided in the MESH SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MESH DFU PROBLEM</title><link>https://devzone.nordicsemi.com/thread/186393?ContentTypeID=1</link><pubDate>Fri, 10 May 2019 11:31:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cd33c92-33df-4b93-9462-a5b8b9308ece</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Are you sure that the mesh DFU updated successfully? Do you have any logging information you could provide for the mesh dfu? It seems that you initialize the button_event_handler correctly. Have you tried running flashing the example before you try the mesh DFU process? Do the buttons then work as intended?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MESH DFU PROBLEM</title><link>https://devzone.nordicsemi.com/thread/185354?ContentTypeID=1</link><pubDate>Mon, 06 May 2019 07:21:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:24ca4776-1238-4541-b112-d7cc705ab643</guid><dc:creator>SAIF</dc:creator><description>&lt;p&gt;Thanks for your reply.!!&lt;/p&gt;
&lt;p&gt;Right now i am not going with mesh dfu process and it takes nearly about 1 hour and it is also one to many devices dfu process.&lt;/p&gt;
&lt;p&gt;As i want only one to one device dfu process in MESH . So what i have done is i have implemented the dfu process related to BLE stack in the normal LIGHT SWITCH SERVER code&amp;nbsp; and done with one to one device dfu process and it is working fine.&lt;/p&gt;
&lt;p&gt;i.e., by uploading softdevice ,bootloader hex files and application dfu package file.&lt;/p&gt;
&lt;p&gt;By this i solved my button handler issue,but still i am sending you the main code so that i can know what is the reason for button handler not working in MESH DFU code.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;string.h&amp;gt;

/* HAL */
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;simple_hal.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;

/* Core */
#include &amp;quot;nrf_mesh_config_core.h&amp;quot;
#include &amp;quot;nrf_mesh_configure.h&amp;quot;
#include &amp;quot;nrf_mesh.h&amp;quot;
#include &amp;quot;mesh_stack.h&amp;quot;
#include &amp;quot;device_state_manager.h&amp;quot;
#include &amp;quot;access_config.h&amp;quot;
#include &amp;quot;proxy.h&amp;quot;
#include &amp;quot;nrf_mesh_events.h&amp;quot;
#include &amp;quot;nrf_mesh_dfu.h&amp;quot;

/* Provisioning and configuration */
#include &amp;quot;mesh_provisionee.h&amp;quot;
#include &amp;quot;mesh_app_utils.h&amp;quot;
#include &amp;quot;mesh_adv.h&amp;quot;

/* Logging and RTT */
#include &amp;quot;log.h&amp;quot;
#include &amp;quot;rtt_input.h&amp;quot;

/* Example specific includes */
#include &amp;quot;app_config.h&amp;quot;
#include &amp;quot;example_common.h&amp;quot;
#include &amp;quot;light_switch_example_common.h&amp;quot;
#include &amp;quot;nrf_mesh_config_examples.h&amp;quot;
#include &amp;quot;ble_softdevice_support.h&amp;quot;
#include &amp;quot;nrf_drv_gpiote.h&amp;quot;

#ifndef NRF_MESH_SERIAL_ENABLE
#define NRF_MESH_SERIAL_ENABLE 1
#endif

#if NRF_MESH_SERIAL_ENABLE
#include &amp;quot;nrf_mesh_serial.h&amp;quot;
#endif


#if defined(NRF51) &amp;amp;&amp;amp; defined(NRF_MESH_STACK_DEPTH)
#include &amp;quot;stack_depth.h&amp;quot;
#endif


#define STATIC_AUTH_DATA {0x6E, 0x6F, 0x72, 0x64, 0x69, 0x63, 0x5F, 0x65, 0x78, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x5F, 0x31}

#if defined(NRF51)
    #define FLASH_PAGE_SIZE                 ( 0x400)
    #define FLASH_PAGE_MASK             (0xFFFFFC00)
#elif defined(NRF52_SERIES)
    #define FLASH_PAGE_SIZE                 (0x1000)
    #define FLASH_PAGE_MASK             (0xFFFFF000)
#endif

#if defined(_lint)
    const volatile uint32_t * rom_base   = NULL;
    const volatile uint32_t * rom_length = NULL;
    uint32_t rom_end;
    uint32_t bank_addr;
#elif defined ( __CC_ARM )
    extern uint32_t Image$$ER_IROM1$$Base;
    extern uint32_t Image$$ER_IROM1$$Length;
    const volatile uint32_t * rom_base   = &amp;amp;Image$$ER_IROM1$$Base;
    const volatile uint32_t * rom_length = &amp;amp;Image$$ER_IROM1$$Length;
    uint32_t rom_end;
    uint32_t bank_addr;
#elif defined   ( __GNUC__ )
    extern uint32_t _start;
    extern uint32_t __exidx_end;
    const volatile uint32_t rom_base   = (uint32_t) &amp;amp;_start;
    const volatile uint32_t rom_end    = (uint32_t) &amp;amp;__exidx_end;
    uint32_t rom_length;
    uint32_t bank_addr;
#endif

static nrf_mesh_evt_handler_t m_evt_handler;
static bool m_device_provisioned;


static bool fw_updated_event_is_for_me(const nrf_mesh_evt_dfu_t * p_evt)
{
    switch (p_evt-&amp;gt;fw_outdated.transfer.dfu_type)
    {
        case NRF_MESH_DFU_TYPE_APPLICATION:
            return (p_evt-&amp;gt;fw_outdated.current.application.app_id == p_evt-&amp;gt;fw_outdated.transfer.id.application.app_id &amp;amp;&amp;amp;
                    p_evt-&amp;gt;fw_outdated.current.application.company_id == p_evt-&amp;gt;fw_outdated.transfer.id.application.company_id &amp;amp;&amp;amp;
                    p_evt-&amp;gt;fw_outdated.current.application.app_version &amp;lt; p_evt-&amp;gt;fw_outdated.transfer.id.application.app_version);

        case NRF_MESH_DFU_TYPE_BOOTLOADER:
            return (p_evt-&amp;gt;fw_outdated.current.bootloader.bl_id == p_evt-&amp;gt;fw_outdated.transfer.id.bootloader.bl_id &amp;amp;&amp;amp;
                    p_evt-&amp;gt;fw_outdated.current.bootloader.bl_version &amp;lt; p_evt-&amp;gt;fw_outdated.transfer.id.bootloader.bl_version);

        case NRF_MESH_DFU_TYPE_SOFTDEVICE:
            return false;

        default:
            return false;
    }
}

static void mesh_evt_handler(const nrf_mesh_evt_t* p_evt)
{
    switch (p_evt-&amp;gt;type)
    {
        case NRF_MESH_EVT_DFU_FIRMWARE_OUTDATED:
        case NRF_MESH_EVT_DFU_FIRMWARE_OUTDATED_NO_AUTH:
            if (fw_updated_event_is_for_me(&amp;amp;p_evt-&amp;gt;params.dfu))
            {
                ERROR_CHECK(nrf_mesh_dfu_request(p_evt-&amp;gt;params.dfu.fw_outdated.transfer.dfu_type,
                                                 &amp;amp;p_evt-&amp;gt;params.dfu.fw_outdated.transfer.id,
                                                 (uint32_t*) bank_addr));
                hal_led_mask_set(LEDS_MASK, false); /* Turn off all LEDs */
            }
            else
            {
                ERROR_CHECK(nrf_mesh_dfu_relay(p_evt-&amp;gt;params.dfu.fw_outdated.transfer.dfu_type,
                                               &amp;amp;p_evt-&amp;gt;params.dfu.fw_outdated.transfer.id));
            }
            break;

        case NRF_MESH_EVT_DFU_START:
            hal_led_mask_set(BSP_LED_0_MASK | BSP_LED_2_MASK, true);
            break;

        case NRF_MESH_EVT_DFU_END:
            hal_led_mask_set(LEDS_MASK, false); /* Turn off all LEDs */
            hal_led_mask_set(BSP_LED_0_MASK | BSP_LED_1_MASK, true); /* Yellow */
            break;

        case NRF_MESH_EVT_DFU_BANK_AVAILABLE:
            hal_led_mask_set(LEDS_MASK, false); /* Turn off all LEDs */
            ERROR_CHECK(nrf_mesh_dfu_bank_flash(p_evt-&amp;gt;params.dfu.bank.transfer.dfu_type));
            break;

        default:
            break;

    }
}

static void node_reset(void)
{
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- Node reset  -----\n&amp;quot;);
    hal_led_blink_ms(LEDS_MASK, LED_BLINK_INTERVAL_MS, LED_BLINK_CNT_RESET);
    /* This function may return if there are ongoing flash operations. */
    mesh_stack_device_reset();
}

static void config_server_evt_cb(const config_server_evt_t * p_evt)
{
    if (p_evt-&amp;gt;type == CONFIG_SERVER_EVT_NODE_RESET)
    {
        node_reset();
    }
}

static void button_event_handler(uint32_t button_number)
{
    switch (button_number)
       {
  /*When switch 0 is pressed*/
           case 0:
           {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- BUTTON 0 -----\n&amp;quot;);

           }
            break;
  /*When switch 1 is pressed*/
          case 1:
          {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- BUTTON 1 -----\n&amp;quot;);
          }
      
           break;
   /*When switch 2 is pressed*/
          case 2:
          {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- BUTTON 2 -----\n&amp;quot;);
        
          }
       
            break;
   /*When switch 3 is pressed*/
          case 3:
          {
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- BUTTON 3 -----\n&amp;quot;);
          }
             
           break;
   /*When switch 4 is pressed*/					
          case 4:
          { 
            __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- BUTTON 4 -----\n&amp;quot;);
          }
          break;
                          
          default:
            break;
      }

}


static void app_rtt_input_handler(int key)
{
    if (key &amp;gt;= &amp;#39;0&amp;#39; &amp;amp;&amp;amp; key &amp;lt;= &amp;#39;4&amp;#39;)
    {
        uint32_t button_number = key - &amp;#39;0&amp;#39;;
        button_event_handler(button_number);
    }
}


static void mesh_init(void)
{
    uint8_t dev_uuid[NRF_MESH_UUID_SIZE];
    uint8_t node_uuid_prefix[NODE_UUID_PREFIX_LEN] = SERVER_NODE_UUID_PREFIX;
    
    ERROR_CHECK(mesh_app_uuid_gen(dev_uuid, node_uuid_prefix, NODE_UUID_PREFIX_LEN));
    mesh_stack_init_params_t init_params =
    {
        .core.irq_priority       = NRF_MESH_IRQ_PRIORITY_LOWEST,
        .core.lfclksrc           = DEV_BOARD_LF_CLK_CFG,
        .core.p_uuid             = dev_uuid,
        .models.models_init_cb   = NULL,
        .models.config_server_cb = config_server_evt_cb
    };
    ERROR_CHECK(mesh_stack_init(&amp;amp;init_params, &amp;amp;m_device_provisioned));

#if NRF_MESH_SERIAL_ENABLE
    ERROR_CHECK(nrf_mesh_serial_init(NULL));
#endif

    m_evt_handler.evt_cb = mesh_evt_handler;
    nrf_mesh_evt_handler_add(&amp;amp;m_evt_handler);
}

static void initialize(void)
{
uint32_t err_code;
#if defined(NRF51) &amp;amp;&amp;amp; defined(NRF_MESH_STACK_DEPTH)
    stack_depth_paint_stack();
#endif

    ERROR_CHECK(app_timer_init());
    hal_leds_init();

    __LOG_INIT(LOG_MSK_DEFAULT | LOG_SRC_DFU | LOG_SRC_APP | LOG_SRC_SERIAL, LOG_LEVEL_INFO, log_callback_rtt);
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- Bluetooth Mesh DFU Example -----\n&amp;quot;);

#if defined ( __CC_ARM )
    rom_end    = (uint32_t) rom_base + (uint32_t) rom_length;
#elif defined   ( __GNUC__ )
    rom_length = (uint32_t) rom_end - rom_base;
#endif
    /* Take the next available page address */
    bank_addr  = (uint32_t) (rom_end &amp;amp; FLASH_PAGE_MASK) + FLASH_PAGE_SIZE;
    __LOG(LOG_SRC_APP, LOG_LEVEL_DBG2, &amp;quot;rom_base   %X\n&amp;quot;, rom_base);
    __LOG(LOG_SRC_APP, LOG_LEVEL_DBG2, &amp;quot;rom_end    %X\n&amp;quot;, rom_end);
    __LOG(LOG_SRC_APP, LOG_LEVEL_DBG2, &amp;quot;rom_length %X\n&amp;quot;, rom_length);
    __LOG(LOG_SRC_APP, LOG_LEVEL_DBG2, &amp;quot;bank_addr   %X\n&amp;quot;, bank_addr);


    err_code =hal_buttons_init(button_event_handler);
    if (err_code == NRF_SUCCESS)
    {
      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- successful -----\n&amp;quot;);
    }
    else
    {
      __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;----- unsuccessful -----\n&amp;quot;);
    }
    ble_stack_init();

#if MESH_FEATURE_GATT_ENABLED
    gap_params_init();
    conn_params_init();
#endif

    mesh_init();

    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Initialization complete!\n&amp;quot;);
}

static void start(void)
{
    rtt_input_enable(app_rtt_input_handler, RTT_INPUT_POLL_PERIOD_MS);
    if (!m_device_provisioned)
    {
        static const uint8_t static_auth_data[NRF_MESH_KEY_SIZE] = STATIC_AUTH_DATA;
        mesh_provisionee_start_params_t prov_start_params =
        {
            .p_static_data = static_auth_data,
            .prov_complete_cb = NULL,
            .prov_device_identification_start_cb = NULL,
            .prov_device_identification_stop_cb = NULL,
            .prov_abort_cb = NULL,
            .p_device_uri = NULL
        };
        ERROR_CHECK(mesh_provisionee_prov_start(&amp;amp;prov_start_params));
    }

#if NRF_MESH_SERIAL_ENABLE
    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Enabling serial interface...\n&amp;quot;);
    ERROR_CHECK(nrf_mesh_serial_enable());
#endif

    ERROR_CHECK(mesh_stack_start());

    __LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;DFU example started!\n&amp;quot;);
}



int main(void)
{
    initialize();
    start();
    for (;;)
    {
       
    }
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MESH DFU PROBLEM</title><link>https://devzone.nordicsemi.com/thread/185213?ContentTypeID=1</link><pubDate>Fri, 03 May 2019 13:46:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7f7bd00-7e57-418a-9574-8856dc0802ce</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;You could also add some logging to the beginning of the button_event_handler to see if the function is being called at all:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;__LOG(LOG_SRC_APP, LOG_LEVEL_INFO, &amp;quot;Button %u pressed\n&amp;quot;, button_number);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Are you sure the button_pin_config is set correctly, like done in the light switch example?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    for (uint32_t i = 0; i &amp;lt; BUTTONS_NUMBER ; ++i)
    {
        NRF_GPIO-&amp;gt;PIN_CNF[m_buttons_list[i]] = BUTTON_PIN_CONFIG;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Could you post the complete main code using the Insert -&amp;gt; Code option in DevZone? That may make it easier to debug.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MESH DFU PROBLEM</title><link>https://devzone.nordicsemi.com/thread/184667?ContentTypeID=1</link><pubDate>Wed, 01 May 2019 06:49:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5be13115-3d05-45b7-835b-661c82a55f2e</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;&lt;span&gt;Due to other support activity, I have been kept busy the last few days. You can expect a response latest on the 3rd of May. Sorry for any inconvenience caused!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MESH DFU PROBLEM</title><link>https://devzone.nordicsemi.com/thread/183826?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 12:55:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0005e371-f8ab-4bd1-b106-c15553ff8713</guid><dc:creator>SAIF</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thanks for your reply!!!&lt;/p&gt;
&lt;p&gt;Yes,i have used ERROR_CHECK(hal_buttons_init(button_event_handler)) and it returned NRF_SUCCESS.&lt;/p&gt;
&lt;p&gt;No,I am not using regular 52832 DK board,i am using my own developed board with customized gpio&amp;#39;s configured according to my schematics for buttons.&lt;/p&gt;
&lt;p&gt;Actually my entire application works fine with my gpio&amp;#39;s configured with my&amp;nbsp; board ,for this application i have used LIGHT_SWITCH_SERVER_CODE...There is not problem with my application when going with this SERVER code ,but as i need my application to run with DFU.&lt;/p&gt;
&lt;p&gt;so ,i have merged my complete developed application in DFU code provided in MESH_EXAMPLES,but BUTTON related operations where NOT working in DFU code.&lt;/p&gt;
&lt;p&gt;Yes,i have added RTT logging at the beginning of main..i.e.,in&amp;nbsp; the initialize() function.&lt;/p&gt;
&lt;p&gt;Do i need to go with RTT logging at the beginning of main ? As i am using this call ERROR_CHECK(hal_buttons_init(button_event_handler)) for my button handler.And i think this call will take to button_event_handler&amp;nbsp; when ever button action happens?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: MESH DFU PROBLEM</title><link>https://devzone.nordicsemi.com/thread/183799?ContentTypeID=1</link><pubDate>Thu, 25 Apr 2019 12:16:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71ff005b-9689-40c7-b2cd-ab3ab272e167</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;It&amp;#39;s always a good idea to run ERROR_CHECK(hal_buttons_init(button_event_handler)) to see if the initialization function has initialized correctly. Are you using a regular 52832 DK when testing this functionality?&lt;/p&gt;
&lt;p&gt;Have you added any RTT logging at the beginning of your main function just to see if you have setup RTT correctly (for example how it is done in the initialize() function of the light switch client example? Do you receive any RTT logging at all?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>