<?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>How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75517/how-to-test-examples-dfu-secure_bootloader-pca10040_uart_debug</link><description>I build the example and download to PCA10040,but there no log print in RTT, and I debug in keil mdk, I found the program does not step into main function. 
 How to run this example?Does there have any document to describle about usart DFU?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 27 May 2021 08:07:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75517/how-to-test-examples-dfu-secure_bootloader-pca10040_uart_debug" /><item><title>RE: How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/thread/311984?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 08:07:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:242f8ce8-11b9-49e7-a43e-551394ad5cc6</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;You just flash it the same way as you flash the softdevice or bootloader or application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can use nRF Connect - Programmer application on PC or use nrfjprog.exe command line tool to flash the hex file.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;To debug the bootloader you can flash the debug version and step through the code (only after you flash the MBR)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/thread/311938?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 02:56:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0be658af-697a-4fe1-a61b-bdec3b6b84a3</guid><dc:creator>great-master</dc:creator><description>&lt;p&gt;I have have read&amp;nbsp;many documents in the website,But I&amp;#39;m not find how to flash mbr, can you give me a link?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/thread/311925?ContentTypeID=1</link><pubDate>Thu, 27 May 2021 01:12:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5f061dc-65f8-4915-93e7-90f57a438ea2</guid><dc:creator>great-master</dc:creator><description>&lt;p&gt;&lt;span&gt;Is there no way to debug the bootloader separately?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/thread/311715?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 10:15:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4603ecd7-dc83-4f6e-b55f-255e68f6dd4b</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Please do use the MBR. The MBR does vector table forwarding and handle the bootloader swap.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We unfortunately don&amp;#39;t provide the source code for the MBR. But you can find some of the features of the MBR in the nrf_dfu_mbr.h file.&amp;nbsp;&lt;br /&gt;Changing the bootloader to address 0 would requires quite a few modification in the bootloader to make it work.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/thread/311712?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 10:01:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00e52c1c-be25-4eb4-8e29-b8edbe850cc6</guid><dc:creator>great-master</dc:creator><description>&lt;p&gt;thanks for reply, Does the MBR have source code?I want to know exactly what does it do.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Your suggestion is very good But I have encounter some problem for runing the uasrt dfu example.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Here&amp;#39;s how I do it:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;1.I&amp;#39;m not flash MBR;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2.I modify the secure bootloader project IROM1 start addr to 0x00&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/rom.png" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. I have generate key and package as the&amp;nbsp;&amp;nbsp;&amp;lt;&lt;span class="fontstyle0"&gt;nRF Util&amp;nbsp;&lt;/span&gt;&lt;span class="fontstyle2"&gt;v6.1.0 User Guide.pdf&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="fontstyle2"&gt;4.I Flash the generated package on command&amp;nbsp;&lt;pre class="ui-code" data-mode="bat"&gt;nrfutil dfu usb-serial -pkg app_dfu_signed_package.zip -p COM4 -b 115200&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="fontstyle2"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="fontstyle2"&gt;The result:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="fontstyle2"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; nrf_dfu_serial_uart: on_rx_complete, receive error:17&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: add byte to buffer&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; nrf_dfu_serial_uart: on_rx_complete, receive error:17&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: finished reading packet&lt;/p&gt;
&lt;p&gt;&amp;lt;error&amp;gt; nrf_dfu_serial_uart: on_rx_complete, receive error:17&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; app: finished reading packet&lt;/p&gt;
&lt;p&gt;&amp;lt;info&amp;gt; nrf_dfu_serial_uart: Allocated buffer 2000065C&lt;/p&gt;
&lt;p&gt;&amp;lt;debug&amp;gt; nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)&lt;/p&gt;
&lt;p&gt;&amp;lt;debug&amp;gt; nrf_dfu_req_handler: Request handling complete. Result: 0x1&lt;/p&gt;
&lt;p&gt;&amp;lt;debug&amp;gt; nrf_dfu_req_handler: Handle NRF_DFU_OP_OBJECT_WRITE (command)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;the error code is print at&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static __INLINE void on_rx_complete(nrf_dfu_serial_t * p_transport, uint8_t * p_data, uint8_t len)
{
    ret_code_t ret_code = NRF_ERROR_TIMEOUT;

    // Check if there is byte to process. Zero length transfer means that RXTO occured.
    if (len)
    {
        ret_code = slip_decode_add_byte(&amp;amp;m_slip, p_data[0]);
    }

    (void) nrf_drv_uart_rx(&amp;amp;m_uart, &amp;amp;m_rx_byte, 1);

    if (ret_code == NRF_SUCCESS)
    {
        nrf_dfu_serial_on_packet_received(p_transport,
                                         (uint8_t const *)m_slip.p_buffer,
                                         m_slip.current_index);

        uint8_t * p_rx_buf = nrf_balloc_alloc(&amp;amp;m_payload_pool);
        if (p_rx_buf == NULL)
        {
            NRF_LOG_ERROR(&amp;quot;Failed to allocate buffer&amp;quot;);
            return;
        }
        NRF_LOG_INFO(&amp;quot;Allocated buffer %x&amp;quot;, p_rx_buf);
        // reset the slip decoding
        m_slip.p_buffer      = &amp;amp;p_rx_buf[OPCODE_OFFSET];
        m_slip.current_index = 0;
        m_slip.state         = SLIP_STATE_DECODING;
    }
    else
    {
        NRF_LOG_ERROR(&amp;quot;%s, receive error:%d&amp;quot;, __func__, ret_code);  // 17 is NRF_ERROR_BUSY
    }

}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span class="fontstyle2"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So&amp;nbsp;&lt;/span&gt;&lt;span&gt;why there have a NRF_ERROR_BUSY(17) error?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/thread/311680?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 08:29:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:16b1e2a2-e055-44b6-8b5e-c9363c174f16</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;br /&gt;You are right, if you don&amp;#39;t plan to use BLE in both your application and the bootloader (UART DFU) then you don&amp;#39;t need the softdevice.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;But the bootloader requires a MBR (master boot record) to be flashed at address 0x0000 to be able to work. The MBR will handle the forwarding of the vector table.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can find the MBR at&amp;nbsp;\components\softdevice\mbr\hex&lt;br /&gt;&lt;br /&gt;We don&amp;#39;t have an example of using proprietary RF to do DFU. But due to the way the bootloader designed, it should be rather straight forward to do. I would suggest to study the nrf_dfu_serial_uart.c code.&amp;nbsp;&lt;br /&gt;In the code you can find how you can call&amp;nbsp;DFU_TRANSPORT_REGISTER() to register your own dfu transport. And how you can define&amp;nbsp; the init function to handle event from the upper level of the DFU library. It shouldn&amp;#39;t be too hard to change it to your own transport protocol.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;But I would suggest to test with the stock UART bootloader first , before modifying it.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/thread/311632?ContentTypeID=1</link><pubDate>Wed, 26 May 2021 05:44:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7def2e61-1f97-4279-b6f6-e0bcf3119ab0</guid><dc:creator>great-master</dc:creator><description>&lt;p&gt;I use&amp;nbsp;proprietary RF, the softdevice is not needn&amp;#39;t, right?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have a question, I&amp;#39;m not find the VTOR offset config in bootloader, where does it set?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I want modify the bootloader&amp;nbsp;dfu transport from usart to &lt;span&gt;proprietary&amp;nbsp;&lt;/span&gt;RF,Can you give me some brief description for to achieve it?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to test examples\dfu\secure_bootloader\pca10040_uart_debug</title><link>https://devzone.nordicsemi.com/thread/311574?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 15:54:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da6a6043-70c5-43cf-a49a-04b35e6cc389</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you follow the documentation &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/ble_sdk_app_dfu_bootloader.html?cp=7_1_4_4_0"&gt;here &lt;/a&gt;?&amp;nbsp;&lt;br /&gt;I also made a blog that might be useful for you, &lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;br /&gt;Note that you need to flash the softdevice before you test the bootloader.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>