<?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>Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66216/update-nrf52-firmware-dfu-via-external-mcu-stm32</link><description>Hi all, 
 I am new to NRF world &amp;amp; I have gone through Nordic&amp;#39;s Tutorials about 
 
 Getting Started 
 custom Services / Characteristics 
 Bootloader, Softdevices 
 DFU via OTA / UART (PC) 
 creating/signing DFU packet etc.. 
 
 So now in my case, main</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 04 Mar 2024 08:15:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66216/update-nrf52-firmware-dfu-via-external-mcu-stm32" /><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/471951?ContentTypeID=1</link><pubDate>Mon, 04 Mar 2024 08:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49e22b99-e6e5-4b53-8b4e-0bc9eb645c80</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;This ticket was originally for the nRF5 SDK, while you seems to be using the nRF Connect SDK. So for follow up questions, please create a new DevZone ticket.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;However, we don&amp;#39;t have any mcumgr implementation for embedded devices. So in the case if you want to update the nRF with another MCU, you need to implement mcumgr on that device, so that it can push the FW update to the nRF over the protocol that you are using.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/471728?ContentTypeID=1</link><pubDate>Fri, 01 Mar 2024 09:24:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0091ed5-907b-413a-a0b3-ba5298f0ced1</guid><dc:creator>JuanAlm</dc:creator><description>&lt;p&gt;Did you find finally something? Im currently with the same problem but Im using nrf connect sdk... so the project&amp;nbsp;&lt;a href="https://github.com/jimmywong2003/nrf-slim-serial-uart-dfu-host-c-code/tree/master"&gt;Serial DFU Host Application (By using C programming language)&lt;/a&gt;&amp;nbsp;doesnt work for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/383426?ContentTypeID=1</link><pubDate>Fri, 26 Aug 2022 09:33:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8aa8ac7b-3839-4e1e-a72d-a4ad20bbf286</guid><dc:creator>Louis_263</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;the question was related to the original post. I also want to update the firmware of a nRF52 with a STM32 and wanted to ask the author of the question how he solved the problem.&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Louis&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/383401?ContentTypeID=1</link><pubDate>Fri, 26 Aug 2022 07:52:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69902f22-070f-41c2-89f2-4707b54da3b1</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I am not quite sure what you mean. I don&amp;#39;t have anything other than what I already linked in this ticket. But perhaps this question was not meant for me?&lt;/p&gt;
&lt;p&gt;BR,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/383314?ContentTypeID=1</link><pubDate>Thu, 25 Aug 2022 13:50:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc6f382e-d368-4594-b8e1-83114d84b3e6</guid><dc:creator>Louis_263</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;I am currently facing the same problem and would like to update the nRF52 from a STM32 as well. Do you possibly still have the code for the STM32 and would share it?&lt;/p&gt;
&lt;p&gt;Best regards&lt;/p&gt;
&lt;p&gt;Louis&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/271119?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 13:32:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce684e5f-123f-461e-988c-e56169b60910</guid><dc:creator>Edvin</dc:creator><description>[quote user="Mayur Patel"]1. Do I need an external memory to store the Firmware to update NRF52 via STM32? Or can STM32 can tunnel the data directly via UART that it receives via CAN?[/quote]
&lt;p&gt;&amp;nbsp;You can do the option that suits best in your case. When the nRF is in DFU mode, it will be in a passive waiting state, waiting for the next packet or command, and handle that packet. The only thing you need to consider is some sort of timeout. If the nRF has a valid application (but you set the device in DFU mode via button press), it will start a timer during intialization. Look at nrf_bootloader_init() -&amp;gt;&amp;nbsp;nrf_bootloader_dfu_inactivity_timer_restart(initial_timeout, inactivity_timeout);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;inactivity_timeout is a callback function, so when this function is called once, it will reach that handler if&amp;nbsp;initial_timeout ticks passes without this being called again. It will be called on every &amp;quot;object received&amp;quot; event, which resets the timer, and the default timeout is 120 seconds, so probably not something you need to worry about as long as you keep sending the packets.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user="Mayur Patel"]2. Is this DFU via UART possible at all if the nRF52xx SoC is empty(from production) and does not contain any type of Softdevice or Bootloader?&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;It requires at least a bootloader and either a SoftDevice or the MBR pre-programmed in order to work. (MBR is part of the softdevice, so if you don&amp;#39;t use the softdevice, you need to program the standalone MBR).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The &amp;quot;normal way&amp;quot; to do this, is to program the bootloader, Softdevice/MBR, application and bootloader_settings during production, so that you have the first set of application and bootloader already present.&lt;/p&gt;
&lt;p&gt;The bootloader settings is something you can generate externally using &amp;quot;nrfutil settings generate --help&amp;quot;. What this does is that it signs the application, and generates a hex file containing this signature in the flash area that the bootloader uses to verify the signature.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;But yes, you need the bootloader pre-programmed in order to perform a serial DFU.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/271019?ContentTypeID=1</link><pubDate>Wed, 23 Sep 2020 09:27:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eec7e638-eee4-494d-be80-9481468ab7b5</guid><dc:creator>Mayur Patel</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/edvin-holmseth"&gt;Edvin&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;Thank you for your reply.&lt;/p&gt;
&lt;p&gt;I went through your links and cleared my doubts. It helped me to enter Bootloader mode from App mode without doing button press. Now the open Que. are,&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. Do I need an external memory to store the Firmware to update NRF52 via STM32? Or can STM32 can tunnel the data directly via UART that it receives via CAN?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Is this DFU via UART possible at all if the nRF52xx SoC is empty(from production) and does not contain any type of Softdevice or Bootloader?&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/270898?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 14:36:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fca7b1e-9e7e-49e8-9cd2-a83d0e3864b2</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;We don&amp;#39;t have any SPI bootloaders for the nRF52832 in the examples in the SDK, but I know that several customers have ported the UART bootloader (found in SDK\examples\dfu\secure_bootloader\pca10040_uart) to use SPI instead of UART. It shouldn&amp;#39;t be too much work.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;As for the master side, we don&amp;#39;t have anything STM specific, but we have some experimental projects using both UART and SPI written for an nRF, so perhaps it is possible to port that to an STM without too much work.&lt;/p&gt;
&lt;p&gt;One of the examples are found close to the bottom of the Getting started with DFU guide, which is the one I believe you referred to, found &lt;a href="https://devzone.nordicsemi.com/nordic/short-range-guides/b/software-development-kit/posts/getting-started-with-nordics-secure-dfu-bootloader#h108sjziaxo3m81rkgr1has5r1d72qtu"&gt;here&lt;/a&gt;. Search for &amp;quot;DFU Master Code&amp;quot;.&lt;/p&gt;
&lt;p&gt;Another project that does more or less the same is from one of our FAEs&amp;#39; github:&amp;nbsp;&lt;a href="https://github.com/jimmywong2003/nrf-slim-serial-uart-dfu-host-c-code"&gt;nrf-slim-serial-uart-dfu-host-c-code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;To answer your questions:&lt;/p&gt;
&lt;p&gt;1: While the software is running, you need to tell the application to enter DFU mode, somehow. We have several means of doing so. One way can be to reset the device. If you have connected the RESET pin to the application processor (the STM) and then pull another pin low (or high) that the bootloader will check before entering the already programmed application again. Search for&amp;nbsp;NRF_BL_DFU_ENTER_METHOD_BUTTON in the bootloader example project, and see how it is used. Another way to trigger DFU mode is to set some power register before the reset. Check the function dfu_enter_check() in the bootloader example project:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    if (NRF_BL_DFU_ENTER_METHOD_GPREGRET &amp;amp;&amp;amp;
       (nrf_power_gpregret_get() &amp;amp; BOOTLOADER_DFU_START))
    {
        NRF_LOG_DEBUG(&amp;quot;DFU mode requested via GPREGRET.&amp;quot;);
        return true;
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Then it is possible to write this register from the application, and then reset the device to trigger DFU mode. Let me know if this is what you want to do, but struggle with this. The trick is to wait until the register is written before you reset. So write to it, then read it back until the correct value is read back, and then reset.&lt;/p&gt;
&lt;p&gt;What method you decide to use depends on the HW setup. Either way you need some way to communicate from the STM to the nRF application that it should enter DFU mode, and the then may have to do some preparations (e.g. write to the power register) and reset the device.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;2: Both SPI and UART can be used. As mentioned, we don&amp;#39;t have an out of the box SPI bootloader, but it is possible to port the UART Bootloader to support SPI instead of UART. After that, it is only your preferred communication that decides this.&lt;/p&gt;
&lt;p&gt;Please note that the flash operations takes some time, when you update the device. So it is probably not the UART throughput that will cap the DFU speed.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;3: Please see the DFU getting started, and Jimmy&amp;#39;s nrf-slim-serial-uart-dfu-host-c-code repo that I linked above. They are not written for an STM, but it can be a starting point. In case you need it, you can also check the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.0.2/lib_dfu_transport_serial.html"&gt;bootloader&amp;#39;s serial transport documentation on infocenter&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/270836?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 12:14:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1514003-cfe4-4e08-b43a-ab5d2bee9382</guid><dc:creator>Mayur Patel</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/turboj"&gt;Turbo J&lt;/a&gt;,&lt;/p&gt;
&lt;p&gt;First thank you very much for the reply.&lt;/p&gt;
&lt;p&gt;As you said NRF52 is powerful Cortex M4 but it&amp;#39;s not possible to change completely to it that is fixed and that&amp;#39;s d sad part.&lt;/p&gt;
&lt;p&gt;As you understood it right STM32 must act as Tunnel / DFU-controller to send Firmware to NRF, b&lt;strong&gt;ut not via PC or nrfutil.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Now for info STM32 has Bootloader and updates itself via CAN communication from a Tool. &lt;br /&gt;In our case STM32 can also get Firmware for NRF via CAN and it should act as Tunnel and do DFU via UART.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;SO Que. arises that do we still require external Flash to store the firmware first OR can we directly tunnel the data via UART without saving it on flash?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Update NRF52 Firmware (DFU) via External MCU STM32</title><link>https://devzone.nordicsemi.com/thread/270824?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 11:49:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5db977cc-732a-450d-8216-191993154722</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;Implementing the NRF DFU Host part in C language is a non-trivial but not too difficult task. BTDT (no, not open source). Waaay too much for a simple forum post, though.&lt;/p&gt;
&lt;p&gt;But that would need either a stupid amount of internal flash on the STM32 (think MB range) or some external memory to put the NRF firmware to.&lt;/p&gt;
&lt;p&gt;The other way would have the STM32 just &amp;quot;tunnel&amp;quot; the NRF DFU packets to the PC host somehow, and let the PC deal with the protocol.&lt;/p&gt;
&lt;p&gt;I recommend using UART, since I don&amp;#39;t think there is an SPI implementation for NRF DFU protocol in the SDK.&lt;/p&gt;
&lt;p&gt;The STM32F10xxx are just 72 MHz Cortex-M3 MCUs. Sure that you need that &lt;em&gt;at all&lt;/em&gt;? There is a 64MHz Cortex-&lt;strong&gt;M4F&lt;/strong&gt; in the NRF52832. Maybe it would be enough to upgrade to the NRF52840 (unless you need a crapton of I/Os for example).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>