<?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>Unable to flash nRF9160 with &amp;quot;ninja flash&amp;quot;</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48984/unable-to-flash-nrf9160-with-ninja-flash</link><description>I&amp;#39;m building some of the samples using command line in Ubuntu and have a strange issue. Everything builds fine, the merged.hex file is generated, however when I try to flash the device using &amp;quot;ninja flash&amp;quot; the boot loader never runs the application: 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 Jul 2019 12:45:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48984/unable-to-flash-nrf9160-with-ninja-flash" /><item><title>RE: Unable to flash nRF9160 with "ninja flash"</title><link>https://devzone.nordicsemi.com/thread/196263?ContentTypeID=1</link><pubDate>Wed, 03 Jul 2019 12:45:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02324069-9b53-4886-a4e7-1ae350e1e641</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;New release of nrf5x cmd line tools is out here:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools/Download#infotabs"&gt;https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools/Download#infotabs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you try this and see if it works better?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to flash nRF9160 with "ninja flash"</title><link>https://devzone.nordicsemi.com/thread/195981?ContentTypeID=1</link><pubDate>Tue, 02 Jul 2019 12:14:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d47342dd-2b9c-4348-ad1e-5b04e2157bd7</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I can confirm that this is a bug in nrfjprog, where &amp;quot;--sectorerase&amp;quot; is failing in a certain corner case. The developers are actively looking into this, and we will push a new version as soon as its fixed and verified. Be on the lookout for a new version, but as a workaround until that is out; I&amp;#39;d recommend to use v9.8.1.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to flash nRF9160 with "ninja flash"</title><link>https://devzone.nordicsemi.com/thread/195748?ContentTypeID=1</link><pubDate>Mon, 01 Jul 2019 16:13:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baa025fa-3c3d-43c8-af15-3b5d66b4dea6</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m running ubuntu 19.04.&lt;/p&gt;
&lt;p&gt;I have a slightly older JLinkARM installation, but it seems to work as intended here:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ nrfjprog -v
nrfjprog version: 10.1.1
JLinkARM.dll version: 6.46a
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By adding verbose flag to ninja (ninja -v flash), you can see the inputs to the west command, and by adding -v to west again, I get this output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ cd /opt/ncs/nrf/samples/nrf9160/at_client/build &amp;amp;&amp;amp; /usr/bin/cmake -E env /home/hkn/.local/bin/west -v flash --skip-rebuild
ZEPHYR_BASE=/opt/ncs/zephyr (origin: env)
Using runner: nrfjprog
nrfjprog --ids
Flashing file: /opt/ncs/nrf/samples/nrf9160/at_client/build/zephyr/merged.hex
nrfjprog --program /opt/ncs/nrf/samples/nrf9160/at_client/build/zephyr/merged.hex -f NRF91 --snr 960044273 --sectorerase
Parsing hex file.
Erasing page at address 0x0.
Erasing page at address 0x1000.
Erasing page at address 0x2000.
Erasing page at address 0x3000.
Erasing page at address 0x4000.
Erasing page at address 0x5000.
Erasing page at address 0x6000.
Erasing page at address 0x7000.
Erasing page at address 0xC000.
Erasing page at address 0xD000.
Erasing page at address 0xE000.
Erasing page at address 0xF000.
Erasing page at address 0x10000.
Erasing page at address 0x11000.
Erasing page at address 0x12000.
Erasing page at address 0x13000.
Erasing page at address 0x14000.
Erasing page at address 0x15000.
Erasing page at address 0x16000.
Erasing page at address 0x17000.
Erasing page at address 0x18000.
Erasing page at address 0x19000.
Erasing page at address 0x1A000.
Erasing page at address 0x1B000.
Erasing page at address 0x1C000.
Erasing page at address 0x1D000.
Erasing page at address 0x1E000.
Erasing page at address 0x1F000.
Erasing page at address 0x20000.
Erasing page at address 0x21000.
Erasing page at address 0x22000.
Erasing page at address 0x23000.
Erasing page at address 0x24000.
Erasing page at address 0x25000.
Erasing page at address 0x26000.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
nrfjprog --pinreset -f NRF91 --snr 960044273
Applying pin reset.
Board with serial number 960044273 flashed successfully.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Compared to how you do it, west does a --sectorerase instead of a full erase (nrfjprog -e).&lt;/p&gt;
&lt;p&gt;You could try the same procedure and see if that works? remember to do a --reset afterwards to start up the device again.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;*&lt;em&gt;&lt;strong&gt;edit&lt;/strong&gt;&lt;/em&gt;*: I think you&amp;#39;re right. There seems to be something with the sectorerase functionality in this release, especially on linux. I&amp;#39;ll dig some more and update you.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to flash nRF9160 with "ninja flash"</title><link>https://devzone.nordicsemi.com/thread/195209?ContentTypeID=1</link><pubDate>Thu, 27 Jun 2019 15:55:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e75efdb-f808-49f0-9f94-3b1210257e08</guid><dc:creator>phipi</dc:creator><description>&lt;p&gt;Looks like my tools are all up to date:&lt;/p&gt;
&lt;p&gt;$ nrfjprog -v&lt;br /&gt;nrfjprog version: 10.1.1&lt;br /&gt;JLinkARM.dll version: 6.46g&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to flash nRF9160 with "ninja flash"</title><link>https://devzone.nordicsemi.com/thread/194949?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 17:54:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2c27939-c03e-49e7-a256-0d135de13b8f</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;What is the output of nrfjprog -v? Is either JLink (should be v6.40 or newer) or nrfjprog old (v9.8.1 or newer)?&lt;/p&gt;
&lt;p&gt;If you have an old one in path, it might not accept &amp;quot;-f nrf91&amp;quot; (west invokes nrfjprog with this switch), but still try to program it. West checks the connected jlinks, provides a list if more than one is present, then passes that on to nrfjprog with --ids switch.&lt;/p&gt;
&lt;p&gt;You can find the latest nrfjprog here:&amp;nbsp;&lt;a href="https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools/Download#infotabs"&gt;https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Command-Line-Tools/Download#infotabs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to flash nRF9160 with "ninja flash"</title><link>https://devzone.nordicsemi.com/thread/194935?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 15:44:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9817525-e5a7-4269-9527-bd6a72e8e336</guid><dc:creator>MJD093</dc:creator><description>&lt;p&gt;If I&amp;#39;m reading your problem right, you are finding that invoking ninja flash is not actually flashing a different application to the DK right?&lt;/p&gt;
&lt;p&gt;I have had a few instances of ninja flash just straight up not doing anything but reseting the device with the same firmware that was on it previously.&lt;/p&gt;
&lt;p&gt;I generally just invoke a JLinkExe erase by writing to the NVMC Erase All register:&lt;/p&gt;
&lt;p&gt;w4 0x50039504 2 //sets NVMC config register to erase enabled&lt;br /&gt;w4 0x5003950c 1 //NVMC eraseall&lt;/p&gt;
&lt;p&gt;That should invoke an erase of the nRF9160, then ninja flash it again and it should actually work this time. I believe this is what nrfjprog does under the hood for nRF9160s, my version of JLink doesn&amp;#39;t identify the cortex as an nRF9160, only as M33. So some manual tinkering is used. Alternatively you could try the Desktop NRF Connect Programmer application but I don&amp;#39;t know if that is avaliable on Linux.&lt;/p&gt;
&lt;p&gt;I use this method to erase and reflash a DK remotely.&lt;/p&gt;
&lt;p&gt;Edit: Actually re-reading your OP, I guess this isn&amp;#39;t your issue but for #2, you haven&amp;#39;t set an nRF family type so it probably won&amp;#39;t manipulate the NVMC which you must do to enable flashing and erasing. You could try it this way as I described to erase, then do it again and set NVMC to write enabled, then use &amp;#39;loadfile &amp;lt;merged.hex&amp;gt;&amp;#39; to flash the firmware. See page 32 of the OPS on NVMC config.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to flash nRF9160 with "ninja flash"</title><link>https://devzone.nordicsemi.com/thread/194889?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 13:07:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fe02c39c-e035-4058-9ba8-c34688a142c9</guid><dc:creator>phipi</dc:creator><description>&lt;p&gt;I get the same result with nrf/samples/nrf9160/at_client, and with mqtt_simple. I haven&amp;#39;t tried any more at this time.&lt;/p&gt;
&lt;p&gt;This is on v0.4.0&lt;/p&gt;
&lt;p&gt;How would I find out exactly which nrfjprog commands are being executed by ninja? There must be some sort of discrepancy if #3 above works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to flash nRF9160 with "ninja flash"</title><link>https://devzone.nordicsemi.com/thread/194879?ContentTypeID=1</link><pubDate>Wed, 26 Jun 2019 12:37:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2070715c-7e30-4f0d-825c-e7f6e478225c</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q1: What project are you compiling? Is this the behavior for all projects?&lt;/p&gt;
&lt;p&gt;Q2: What revision/tag have you checked out?&amp;nbsp;&lt;/p&gt;
[quote user=""]Does anyone know what the issue might be here? Is ninja flash corrupting something during the erase?[/quote]
&lt;p&gt;ninja just acts as the build system. In the background, nrfjprog is being called, so it should be equal to manually flashing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>