<?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>Serial DFU Flash Erase Fail</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61304/serial-dfu-flash-erase-fail</link><description>Hi 
 I had implemented a DFU module in esp8266 where I am trying to upgrade nrf over serial (UART Communication). 
 I had success with Init file write but when I send the command to execute the i got nothing in return, Device got stuck and no response</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 May 2020 08:45:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61304/serial-dfu-flash-erase-fail" /><item><title>RE: Serial DFU Flash Erase Fail</title><link>https://devzone.nordicsemi.com/thread/250115?ContentTypeID=1</link><pubDate>Fri, 15 May 2020 08:45:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c906813-2915-4c6c-937f-67f937a19823</guid><dc:creator>Vaibhav_Bansal</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;br /&gt;&lt;br /&gt;After some debugging I am able to resolve the issue&lt;/p&gt;
&lt;p&gt;thanks for your time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial DFU Flash Erase Fail</title><link>https://devzone.nordicsemi.com/thread/250039?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 17:43:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:11393334-8dd8-4a38-bbfc-dcc63b11af5e</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;Can you set a breakpoint in&amp;nbsp;nrf_dfu_flash_init(). Is&amp;nbsp;sd_irq_initialized set to true or false, i.e. is&amp;nbsp;p_api_impl set to&amp;nbsp;&amp;amp;nrf_fstorage_sd or&amp;nbsp;&amp;amp;nrf_fstorage_nvmc ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial DFU Flash Erase Fail</title><link>https://devzone.nordicsemi.com/thread/249882?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 09:33:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:06562b3d-92e2-477b-bec5-235f2127e93a</guid><dc:creator>Vaibhav_Bansal</dc:creator><description>&lt;p&gt;Hi Bjorn&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nrf_dfu_flash_erase won&amp;#39;t return, the code just stuck there until no activity timeout happens and after reset it happens again.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;sd_flash_erase_page is not returning.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Serial DFU Flash Erase Fail</title><link>https://devzone.nordicsemi.com/thread/249832?ContentTypeID=1</link><pubDate>Thu, 14 May 2020 06:57:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a5d619a-0693-4ae0-9ec0-d1798accd320</guid><dc:creator>bjorn-spockeli</dc:creator><description>&lt;p&gt;HI Vaibhav,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ok, so the address that is passed to&amp;nbsp;nrf_fstorage_erase() is not aligned to&amp;nbsp; a page boundary. Do you have the call stack when &lt;span&gt;nrf_fstorage_erase returns&amp;nbsp;&lt;/span&gt;NRF_ERROR_INVALID_ADDR? What are the input parameters to&amp;nbsp;nrf_fstorage_erase?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;ret_code_t nrf_fstorage_erase(nrf_fstorage_t const * p_fs,
                              uint32_t               page_addr,
                              uint32_t               len,
                              void                 * p_context)
{
    if (p_fs == NULL)
    {
        return NRF_ERROR_NULL;
    }

    if (p_fs-&amp;gt;p_api == NULL)
    {
        return NRF_ERROR_INVALID_STATE;
    }

    if (len == 0)
    {
        return NRF_ERROR_INVALID_LENGTH;
    }

    /* Address must be aligned to a page boundary. */
    if (    ((page_addr &amp;amp; (p_fs-&amp;gt;p_flash_info-&amp;gt;erase_unit - 1)) != 0)
        ||  !addr_within_bounds(p_fs, page_addr, (len * p_fs-&amp;gt;p_flash_info-&amp;gt;erase_unit)))
    {
        return NRF_ERROR_INVALID_ADDR;
    }

    return (p_fs-&amp;gt;p_api)-&amp;gt;erase(p_fs, page_addr, len, p_context);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;nrf_fstorage_erase() is called from&amp;nbsp;&lt;/span&gt;nrf_dfu_flash_erase(), which is refrerence from the following locations in the bootloader source.&amp;nbsp;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;nRF5_SDK_14.2.0_17b948a/components/libraries/bootloader/dfu/nrf_dfu_settings.c ( line 199):err_code = nrf_dfu_flash_erase((uint32_t)m_dfu_settings_buffer, 1, NULL);&lt;/li&gt;
&lt;li&gt;nRF5_SDK_14.2.0_17b948a/components/libraries/bootloader/dfu/nrf_dfu_utils.c (line 128): ret_val = nrf_dfu_flash_erase(target_addr, split_size / CODE_PAGE_SIZE, NULL);&lt;/li&gt;
&lt;li&gt;nRF5_SDK_14.2.0_17b948a/examples/dfu/dfu_req_handling/dfu_req_handling.c (line 944):if (nrf_dfu_flash_erase((m_firmware_start_addr + s_dfu_settings.progress.firmware_image_offset)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If the DFU process halts after the Execute command after the init packet has been transferred, then my bet is that its the nrf_dfu_flash_erase call in the nrf_dfu_settings_write() call after the&amp;nbsp;dfu_handle_prevalidate() call in&amp;nbsp;&lt;span&gt;dfu_handle_signed_command() that is the culprit. Can you set a breakpoint here and see what&amp;nbsp;nrf_dfu_flash_erase() returns?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Here is the call chain.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;on_packet_received()-&amp;gt;nrf_dfu_req_handler_on_req()-&amp;gt;nrf_dfu_command_req()-&amp;gt;dfu_handle_signed_command()-&amp;gt;nrf_dfu_settings_write()-&amp;gt;nrf_dfu_flash_erase()&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Bjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>