<?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>RE-programming the nRF52840 Dongle</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/60930/re-programming-the-nrf52840-dongle</link><description>I would like clarification on the use of the nrfConnect programmer for RE-programming the &amp;quot;dongle&amp;quot; a.k.a PCA10059. NOTE: NOT &amp;quot;programming a virgin dongle&amp;quot; Reference: The user guide &amp;quot;nRF Connect Programmer&amp;quot; version 1.4.2 user guide version 1.2 updated</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 May 2020 13:28:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/60930/re-programming-the-nrf52840-dongle" /><item><title>RE: RE-programming the nRF52840 Dongle</title><link>https://devzone.nordicsemi.com/thread/251971?ContentTypeID=1</link><pubDate>Wed, 27 May 2020 13:28:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:658cdf3d-1266-4597-a819-aa50e1299ac9</guid><dc:creator>RayFoulkes</dc:creator><description>&lt;p&gt;For Posterity: The last comment I made was that I would change the load=&amp;quot;no&amp;quot; to load=&amp;quot;yes&amp;quot; of the line:&lt;/p&gt;
[quote userid="69239" url="~/f/nordic-q-a/60930/re-programming-the-nrf52840-dongle/248002"]&amp;lt;ProgramSection alignment=&amp;quot;4&amp;quot; keep=&amp;quot;Yes&amp;quot; load=&amp;quot;No&amp;quot; name=&amp;quot;.GZP_PARAMS&amp;quot; start = &amp;quot;0x00015000&amp;quot; size=&amp;quot;0x1000&amp;quot; /&amp;gt;[/quote]
&lt;p&gt;That caused a 4Kbyte section of FF to be loaded, starting at address 15000 in addition to the normal application. True, it did, but then the application would not boot - the dongle simply went back to the DFU without pushing the reset button. The reason is that the DFU (I think is the DFU) takes not only your program code but all memory from the lowest address to the highest address as your &amp;quot;program&amp;quot;. It then calculates the CRC of that and remembers it. If, on subsequent power-ups, the CRC of the memory is different to that calculated at load, it refuses to boot. Since GZP_PARAMS is a data store, not a program, it is more or less guaranteed to change. Ipso facto your program will never run.&lt;/p&gt;
&lt;p&gt;The simplest work-around is to program the dongle TWICE, once with your program + memory zero (it does actually zero it) then once without the memory zero so the data area is not included in the CRC the second time around.&lt;/p&gt;
&lt;p&gt;There is a BUT, and that is I am told that the DFU does no optimisation i.e. it clears an address range to all FFFFFFFs and then writes in what it is told (which for clearing is FFFFFFFs and therefore pointless). Sounds innocent, but I have not established yet whether such writing consumes one of the &amp;quot;maximum number of writes between erasings&amp;quot; of the chip. To be investigated.&lt;/p&gt;
&lt;p&gt;So, it would appear that the nRFconnect programmer is likely to be dangerous to use for re-purposing (i.e. changing the program on a dongle) if the subsequent program reserves ANY NVRAM for data without a method of the user zeroing the data programatically since the programmer (and possibly the DFU itself) will not erase any memory outside the program area.&lt;/p&gt;
&lt;p&gt;My final alternative is to write a tiny program which does one job only, that is to erase the relevant data area programatically instead of at load time. Load and run this once, THEN load the real application without attempting to zero the memory. I may report on this subsequently.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE-programming the nRF52840 Dongle</title><link>https://devzone.nordicsemi.com/thread/248002?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 17:49:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2d569c8-dec8-4551-95b3-1dac52d19ac1</guid><dc:creator>RayFoulkes</dc:creator><description>&lt;p&gt;Hi again Haakonsh, that offer of further assistance is very nice, thank you, I really appreciate that. I won&amp;#39;t bother you unless I am really stuck. This response is just FYI.&lt;/p&gt;
&lt;p&gt;I realise that I could post-process the .hex file to add in a 4k chunk of all FF at the appropriate address, but that is a bit fragile for a production environment. First I am going to look at simply initialising the data area and telling the linker to emit instructions to write it. I think that I have seen in an example or gzp .h files a macro which starts of with 4 bytes, then another which calls it twice, then another calling that twice.... and so on. until there are 4K bytes, all FF. I just have to find it again! Then I will change the flash_placement file line (below) from &amp;quot;load=no&amp;quot; to load=&amp;quot;yes&amp;quot; and hopefully see the 4K block initialised to all FF. Wish me luck!&lt;/p&gt;
&lt;p&gt;&amp;lt;ProgramSection alignment=&amp;quot;4&amp;quot; keep=&amp;quot;Yes&amp;quot; load=&amp;quot;No&amp;quot; name=&amp;quot;.GZP_PARAMS&amp;quot; start = &amp;quot;0x00015000&amp;quot; size=&amp;quot;0x1000&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;Bye, Ray&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE-programming the nRF52840 Dongle</title><link>https://devzone.nordicsemi.com/thread/247919?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 14:09:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01c86d75-2a53-4ec6-8905-e88af271cbd3</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Let me know if you need more assistance Ray :)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE-programming the nRF52840 Dongle</title><link>https://devzone.nordicsemi.com/thread/247846?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 12:07:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d35b9b1-5fdb-420a-9696-62f772afda97</guid><dc:creator>RayFoulkes</dc:creator><description>&lt;p&gt;Haakonsh, Thanks for the confirmation regarding 1/0. I did know about the Tag-Connect gold plated footprint but one of the reasons for using the dongle was the simple usb plug-it-in-and-program. The initial production run will be about 1000 dongles programmed by a not-so-skilful operator. That sort of number doesn&amp;#39;t really justify setting up a jig for Tag-Connect (there are no retention holes for tag-connect as I recall). Also, using the DK is probably more complicated for the operator.&lt;/p&gt;
&lt;p&gt;But, thanks for the direction to &amp;quot;only nRF Util&amp;quot; - I missed that in the doc. There will only be a couple of images to program so perhaps setting up nRF Util and scripting it will be OK.&lt;/p&gt;
&lt;p&gt;I think that covers my original worries and gives me a great start on fixing the initialisation and looking at nRF Util a bit more closely. I will do &amp;quot;verify answer&amp;quot; on your latest comment if that is OK.&lt;/p&gt;
&lt;p&gt;Thank you for your efforts, Ray&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE-programming the nRF52840 Dongle</title><link>https://devzone.nordicsemi.com/thread/247839?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 11:47:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e3820ca-5060-4326-8957-e04a840d7f29</guid><dc:creator>haakonsh</dc:creator><description>[quote user="RayFoulkes"]it sets it to all 1 not all 0[/quote]
&lt;p&gt;&amp;nbsp;Yeah, you&amp;#39;re correct, sorry, my bad.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;nRF Util is required for any DFU operation. If you have zero plans for any DFU&amp;#39;s in the future you can just rip out the bootloader and DFU, and just flash the devices with a DK and a 6pin j-link needle connector from Tag-Connect, there should be a footprint for that connector on the bottom side of the dongle pcb.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE-programming the nRF52840 Dongle</title><link>https://devzone.nordicsemi.com/thread/247822?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 10:41:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43049383-8376-4b25-9e3a-9bdd283ba62d</guid><dc:creator>RayFoulkes</dc:creator><description>&lt;p&gt;Hi Haakonsh, OK thanks for the confirmation of my understanding. BUT, you now have me confused. I thought that when you &amp;quot;erase&amp;quot; the nvram it sets it to all 1 not all 0. You write about padding it with zeros - which, if I understand correctly, means that it cannot be written which would then be useless anyway for the program to write into.&lt;/p&gt;
&lt;p&gt;In particular I am using gzll dynamic pairing which requires a 4k block to write the pairing info. I think I recall that it checks to see if the memory is all FFFF which means &amp;quot;unused&amp;quot;. I think that I can deal with that for the 4k block I need. My application is not on the internet, just low security point to point comms, so there are no plans for in-field updating of the firmware.&lt;/p&gt;
&lt;p&gt;I am also contemplating the use of command-line programming of the dongle, but I am currently struggling between nrfutil and nrfjprog - it all looks fairly complex.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RE-programming the nRF52840 Dongle</title><link>https://devzone.nordicsemi.com/thread/247805?ContentTypeID=1</link><pubDate>Mon, 04 May 2020 09:37:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:662ba825-0f76-4e5c-9f88-786532869ee5</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;The programmer app in nRF Connect for Desktop is not ideal for the dongle as you&amp;#39;ve noticed.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]When &amp;quot;write&amp;quot; is used, any 4k block of nvram that will potentially be written is first erased, the block is written, read back and verified against the file to be written&amp;#39;. i.e. only memory in the range of the .hex will be erased.&lt;br /&gt;Also, for the dongle, there is no method available to you on &amp;quot;nRF Connect Programmer&amp;quot; to output the content of the nvram to a file on the computer.&amp;#39;[/quote]
&lt;p&gt;&amp;nbsp;This is correct, the DFU bootloader does not erase any memory outside of the image address space, this can cause issues if you&amp;#39;re using flash to store application information. You should assume any data outside of an image&amp;#39;s address space to be undefined after a DFU, given that the new image is smaller than a previous one.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]Now, if that is actually true, there is an implication that memory outside that to be written as a result of writing the hex file, may well have been written for a previous program&lt;br /&gt;so that, if it is programmatically written from the application, the only way that it can be guaranteed to be all 1s is to initialise it in the HEX file to all ones there being no way to erase this in nrfConnect.[/quote]
&lt;p&gt;&amp;nbsp;Yes, this should work. You can write a script that pads the image with zeroes for the remainder of the address space. I&amp;#39;ll ask the devs if this is something we can do for a future release of the Programmer app.&amp;nbsp;&lt;br /&gt;Though this&amp;nbsp;method is not really ideal for dual-bank DFU&amp;#39;s as&amp;nbsp;you limit the space available for the next DFU.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>