<?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>nRF9160DK read/write string to Flash in mqtt_simple</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68456/nrf9160dk-read-write-string-to-flash-in-mqtt_simple</link><description>Hi, 
 I would like to write a string to flash in mqtt_simple SDK example using latest modem firmware and ncs v1.4.0. I based my code off the zephyr example (samples/subsys/nvs/src/main.c) 
 Added the following to proj.conf 
 
 and the following functions</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 25 Nov 2020 19:21:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68456/nrf9160dk-read-write-string-to-flash-in-mqtt_simple" /><item><title>RE: nRF9160DK read/write string to Flash in mqtt_simple</title><link>https://devzone.nordicsemi.com/thread/281910?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 19:21:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0b39646-9592-4534-9d7f-81465c668848</guid><dc:creator>cachro2</dc:creator><description>&lt;p&gt;That recovered the DK!&lt;/p&gt;
&lt;p&gt;So I reloaded modem and application firmware after the recover and everything worked... could not repeat the rebooting failure. I assume I messed up something on the DK while I was testing which lead to the problems.&lt;/p&gt;
&lt;p&gt;Here is the mqtt_simple project for those interested. It reads/writes the string &amp;quot;Hello\n&amp;quot; to flash and is able to send AT commands to the modem.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/mqtt_5F00_simple_5F00_flash_5F00_at_5F00_commands.zip"&gt;devzone.nordicsemi.com/.../mqtt_5F00_simple_5F00_flash_5F00_at_5F00_commands.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;LTE Link Monitor output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;2020-11-25T19:19:19.460Z DEBUG modem &amp;lt;&amp;lt; SPM: NS image at 0x1c200
2020-11-25T19:19:19.461Z DEBUG modem &amp;lt;&amp;lt; SPM: NS MSP at 0x20024e00
2020-11-25T19:19:19.462Z DEBUG modem &amp;lt;&amp;lt; SPM: NS reset vector at 0x1f919
2020-11-25T19:19:19.468Z DEBUG modem &amp;lt;&amp;lt; SPM: prepare to jump to Non-Secure image.
2020-11-25T19:19:19.662Z DEBUG modem &amp;lt;&amp;lt; *** Booting Zephyr OS build v2.4.0-ncs1  ***
2020-11-25T19:19:19.678Z DEBUG modem &amp;lt;&amp;lt; The MQTT simple sample started
2020-11-25T19:19:19.697Z DEBUG modem &amp;lt;&amp;lt; 1
2020-11-25T19:19:19.699Z DEBUG modem &amp;lt;&amp;lt; 2
2020-11-25T19:19:19.701Z DEBUG modem &amp;lt;&amp;lt; Hello
2020-11-25T19:19:19.703Z DEBUG modem &amp;lt;&amp;lt; LTE Link Connecting ...
2020-11-25T19:19:21.220Z DEBUG modem &amp;lt;&amp;lt; +CEREG: 2,&amp;quot;CB64&amp;quot;,&amp;quot;031B9801&amp;quot;,7,0,0,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;
2020-11-25T19:19:21.274Z DEBUG modem &amp;lt;&amp;lt; +CSCON: 1
2020-11-25T19:19:24.578Z DEBUG modem &amp;lt;&amp;lt; +CEREG: 5,&amp;quot;CB64&amp;quot;,&amp;quot;031B9801&amp;quot;,7,,,&amp;quot;11100000&amp;quot;,&amp;quot;11100000&amp;quot;
2020-11-25T19:19:24.604Z DEBUG modem &amp;gt;&amp;gt; AT+COPS=3,2
2020-11-25T19:19:24.607Z DEBUG modem &amp;lt;&amp;lt; LTE Link Connected!&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;There was a minor bug in the original post which I updated.&lt;/p&gt;
&lt;p&gt;Thanks for your support Hakon and apologies for the confusion.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160DK read/write string to Flash in mqtt_simple</title><link>https://devzone.nordicsemi.com/thread/281872?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 15:01:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c9528e40-bb49-4cdf-bd0a-5ae033fa0fc8</guid><dc:creator>Hakon</dc:creator><description>[quote user="cachro2"]Unfortunately, I&amp;nbsp;bricked my DK trying to run variants of this firmware so I cannot get you more logs.[/quote]
&lt;p&gt;&amp;nbsp;Have you tried &amp;#39;nrfjprog --recover&amp;#39; on the bricked DK?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160DK read/write string to Flash in mqtt_simple</title><link>https://devzone.nordicsemi.com/thread/281870?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 14:56:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:374ed7c4-8b42-4010-8013-541760081403</guid><dc:creator>cachro2</dc:creator><description>&lt;p&gt;Unfortunately, I&amp;nbsp;bricked my DK trying to run variants of this firmware so I cannot get you more logs. However, the firmware never reached the printk statements which would have indicated that it wrote to and read from the flash sectors correctly.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160DK read/write string to Flash in mqtt_simple</title><link>https://devzone.nordicsemi.com/thread/281867?ContentTypeID=1</link><pubDate>Wed, 25 Nov 2020 14:51:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eab40133-5bf9-4ca5-95e4-181d0d9f4078</guid><dc:creator>Hakon</dc:creator><description>[quote user="cachro2"]I&amp;#39;m not sure if I understand your question.[/quote]
&lt;p&gt;&amp;nbsp;It looks like you didn&amp;#39;t properly copy/paste the output log, because all I see is&lt;pre class="ui-code" data-mode="text"&gt;2020-11-17T15:04:06.608Z DEBUG modem &amp;lt;&amp;lt; Non-secure callable region 0 placed in flash region 2 with size 32.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and no error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160DK read/write string to Flash in mqtt_simple</title><link>https://devzone.nordicsemi.com/thread/281149?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 15:01:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:db4ef670-202e-4ae1-a8a4-9266e6d5c52b</guid><dc:creator>cachro2</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure if I understand your question. The read/write to firmware above should read/write to flash on the nrf9160 (as indicated by other forum posts) but instead it causes a hard fault; causing my DK to reboot once per second.&amp;nbsp;It is an error because the inclusion of the above firmware in mqtt_simple projects directly causes the cyclic reboot.&lt;br /&gt;&lt;br /&gt;Maybe to simplify the ask, can you please help me understand why:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;DT_FLASH_AREA_STORAGE_OFFSET&lt;/strong&gt;&lt;span&gt;&amp;nbsp;and&amp;nbsp;&lt;/span&gt;&lt;strong&gt;DT_FLASH_DEV_NAME&amp;nbsp;&lt;/strong&gt;are seemingly undeclared.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160DK read/write string to Flash in mqtt_simple</title><link>https://devzone.nordicsemi.com/thread/281145?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 14:43:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3d6d6ac-83ca-47fd-898d-7a0f684ce0df</guid><dc:creator>Hakon</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]It compiles and runs but I get the following error in LTE Link Monitor which causes a cyclic reboot:[/quote]
&lt;p&gt;&amp;nbsp;What makes you think this is an error? This looks completely normal to me, and should not be the cause of the reboot. Can you set CONFIG_DEBUG=y in prj.conf and see if you get any other debug messages in the output log?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160DK read/write string to Flash in mqtt_simple</title><link>https://devzone.nordicsemi.com/thread/280437?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 16:33:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:155da85a-7957-4b0f-ad75-d80773d3c916</guid><dc:creator>cachro2</dc:creator><description>&lt;p&gt;Grep&amp;#39;ing through the file system found the following:&lt;/p&gt;
&lt;p&gt;C:\ncs\v1.4.0\zephyr\doc\releases\release-notes-2.3.rst:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp; 989: * :github:`24356` - MCUboot (and other users of DT_FLASH_DEV_NAME) &lt;span style="color:#ff0000;"&gt;broken with current zephyr master&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;devicetree_legacy_&lt;span style="color:#ff0000;"&gt;unfixed&lt;/span&gt;.h&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;C:\ncs\v1.4.0\nrf\samples\nrf9160\mqtt_simple\build_nrf9160dk_nrf9160ns\zephyr\include\generated\devicetree_legacy_unfixed.h:
 2171  #define DT_FLASH_AREA_STORAGE_ID                    6
 2172  #define DT_FLASH_AREA_STORAGE_READ_ONLY             0
 2173: #define DT_FLASH_AREA_STORAGE_OFFSET_0              1024000
 2174: #define DT_FLASH_AREA_STORAGE_OFFSET                DT_FLASH_AREA_STORAGE_OFFSET_0
 2175  #define DT_FLASH_AREA_STORAGE_SIZE_0                24576
 2176  #define DT_FLASH_AREA_STORAGE_SIZE                  DT_FLASH_AREA_STORAGE_SIZE_0&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;I am new to zephyr, any thoughts to resolve?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>