<?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>it can&amp;#39;t boot to dfu mode.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/61173/it-can-t-boot-to-dfu-mode</link><description>I have a Nordic 52840 hardware, which comes with the bootloader. Learned that the register GPREGRET address is 0x4000051C. The app is written in rust language, and the address is assigned 0xB1 directly in the app. But it can&amp;#39;t enter the dfu mode. code</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 May 2020 09:06:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/61173/it-can-t-boot-to-dfu-mode" /><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/249383?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 09:06:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8d4f3d5-f9e3-47d4-a7a0-3cad6122dcc5</guid><dc:creator>Hanno Braun</dc:creator><description>[quote userid="7377" url="~/f/nordic-q-a/61173/it-can-t-boot-to-dfu-mode/249207"]Please note that Rust is not officially supported. If you want to do some real work, then I suggest you use the nRF5 SDK and program in C. If you use rust for fun or research that is, of course, fine, but you are more or less on your own.[/quote]
&lt;p&gt;I can&amp;#39;t let this stand without comment :-)&lt;/p&gt;
&lt;p&gt;While it is certainly true that Rust is not officially supported by Nordic or any MCU vendor that I know of, people can and do absolutely use it for &amp;quot;real work&amp;quot;. Supporting companies that do this is what I do for a living, and I&amp;#39;ve been fully booked with Rust/Cortex-M work for about a year now. And I&amp;#39;m not even the only provider in this space.&lt;/p&gt;
&lt;p&gt;So please do use Rust for any work (real or not) where you see a benefit in doing so :-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/249380?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 08:50:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec8c1517-88f8-4e73-b1d9-ce581c4fcff2</guid><dc:creator>Hanno Braun</dc:creator><description>&lt;p&gt;NVIC_SystemReset() seems to be a CMSIS function, and according to &lt;a href="https://www.keil.com/pack/doc/cmsis/Core/html/group__NVIC__gr.html#ga1b47d17e90b6a03e7bd1ec6a0d549b46"&gt;this reference&lt;/a&gt; it resets the device using the AIRCR register. You can write to this register manually, but I recommend using the cortex-m (&lt;a href="https://crates.io/crates/cortex-m)"&gt;crates.io/.../cortex-m)&lt;/a&gt; and cortex-m-rt (&lt;a href="https://crates.io/crates/cortex-m-rt"&gt;https://crates.io/crates/cortex-m-rt&lt;/a&gt;) crates alongside nrf52840-pac.&lt;/p&gt;
&lt;p&gt;The equivalent method to NVIC_SystemReset() would be SCB::sys_reset: &lt;a href="https://docs.rs/cortex-m/0.6.2/cortex_m/peripheral/struct.SCB.html#method.sys_reset"&gt;docs.rs/.../struct.SCB.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/249338?ContentTypeID=1</link><pubDate>Tue, 12 May 2020 07:16:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:605378c6-263e-4c7f-abf9-4066ae46d8c1</guid><dc:creator>xaqfan</dc:creator><description>&lt;p&gt;Google have&amp;nbsp; an opensource on github with nordic hardware, it&amp;#39;s name opensk.&lt;/p&gt;
&lt;p&gt;I can flash app .And I what enter DFU mode to update with button less.&lt;/p&gt;
&lt;p&gt;But i have no idea.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/249207?ContentTypeID=1</link><pubDate>Mon, 11 May 2020 13:17:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef0e433f-d6e1-41f2-8e61-a824626505c3</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;If you are running code on the nRF that you write in Rust, then you must have the basic infrastructure in place, and I would be very surprised if it did not support core ARM functions such as NVIC reset. I do not know any details about what you are using though, so I cannot say more. Please note that Rust is not officially supported. If you want to do some real work, then I suggest you use the nRF5 SDK and program in C. If you use rust for fun or research that is, of course, fine, but you are more or less on your own.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/249203?ContentTypeID=1</link><pubDate>Mon, 11 May 2020 13:09:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ad05d78-6b12-4ab6-b4eb-bf95197b35de</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="89530" url="~/f/nordic-q-a/61173/it-can-t-boot-to-dfu-mode/249033"]How can I do to a soft reset&amp;nbsp; after writing?[/quote]
&lt;p&gt;You do a normal system reset with&amp;nbsp;NVIC_SystemReset(), unless you also have other work you want to do before entering DFU mode.&lt;/p&gt;
[quote userid="89530" url="~/f/nordic-q-a/61173/it-can-t-boot-to-dfu-mode/249033"]And is not bootloader monitoring the registers ?[/quote]
&lt;p&gt;No, the bootloader does no longer run after the application is started. But it reads the retention register (among other things) during startup. This assumes that you actually have programmed the nRF5 SDK bootloader, which may not be the case.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/249034?ContentTypeID=1</link><pubDate>Sat, 09 May 2020 03:59:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db24be9e-40ff-4dfe-9937-05ae68d081c0</guid><dc:creator>xaqfan</dc:creator><description>&lt;p&gt;How implement NVIC_SystemReset() function&amp;nbsp; by rust?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/249033?ContentTypeID=1</link><pubDate>Sat, 09 May 2020 02:31:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d2bde0c-c6a8-40de-a681-f1fa7a0ba04e</guid><dc:creator>xaqfan</dc:creator><description>&lt;p&gt;How can I do to a soft reset&amp;nbsp; after writing?&lt;/p&gt;
&lt;p&gt;And is not bootloader monitoring the registers ?&lt;/p&gt;
&lt;p&gt;I thought the register was assigned a value, it will automatically reset and enter dfu mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/249032?ContentTypeID=1</link><pubDate>Sat, 09 May 2020 02:24:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd102a04-d569-4468-8fa9-eb027c2cfc1a</guid><dc:creator>xaqfan</dc:creator><description>&lt;p&gt;My purpose is that HW enter DFU mode with button less by program some code in app.&lt;/p&gt;
&lt;p&gt;Learned that set&amp;nbsp;&lt;span&gt;&amp;nbsp;GPREGRET&amp;nbsp;register&amp;#39;s value 0xB1 ,and bootload enter DFU mode in office sdk.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;But it doesn&amp;#39;t work.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/248927?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 12:06:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c53b9bf1-2faa-4dcd-9968-e9ecb70b13c3</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I addition to the excellent points by &lt;a href="https://devzone.nordicsemi.com/members/hanno-braun"&gt;Hanno Braun&lt;/a&gt;, I also want to mention the following which may or may not be relevant (it is not clear from the question):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The nRF5 devices do not ship with a bootloader by default, so unless you (or someone else) has programmer the bootloader, it is not there.&lt;/li&gt;
&lt;li&gt;After writing the magic word (0xB1) to the retention register, you need to do a soft reset in order for the bootloader to run.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: it can't boot to dfu mode.</title><link>https://devzone.nordicsemi.com/thread/248894?ContentTypeID=1</link><pubDate>Fri, 08 May 2020 10:33:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64c0cd48-cadf-4fbb-be92-8e233a6c8d17</guid><dc:creator>Hanno Braun</dc:creator><description>&lt;p&gt;I&amp;#39;m not familiar with what you&amp;#39;re trying to do, but from a Rust perspective, I can see one potential problem: As far as the compiler is concerned, you&amp;#39;re writing to a memory address, then never access that address again. It might just decide that your write can be optimized out without changing the behavior of the program.&lt;/p&gt;
&lt;p&gt;What you need is a volatile write, which tells the compiler not to interfere: &lt;a href="https://doc.rust-lang.org/core/ptr/fn.write_volatile.html"&gt;https://doc.rust-lang.org/core/ptr/fn.write_volatile.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also, is there any reason you can&amp;#39;t use nrf52840-pac (&lt;a href="https://crates.io/crates/nrf52840-pac"&gt;https://crates.io/crates/nrf52840-pac&lt;/a&gt;)? It&amp;#39;s automatically generated from Nordic&amp;#39;s SVD file, should contain all the correct register definitions, and will take care of the volatile writes under the hood.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>