<?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>nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/77743/nrf9160-dk-logging-to-external-memory</link><description>Hey, 
 I noticed that in the SDK v1.6.0 a Kconfig option CONFIG_LOG_BACKEND_FS was added. However, I cannot find any information on how to use it. 
 I would like to be able to store the logs on an SD-card/memory chip on the nRF9160 DK (v.1.0.2). I tried</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Jul 2021 08:21:17 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/77743/nrf9160-dk-logging-to-external-memory" /><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/322378?ContentTypeID=1</link><pubDate>Thu, 29 Jul 2021 08:21:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:034a5bbd-067f-473d-ba67-960abaf39743</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Ah, I should have seen that earlier. The&amp;nbsp;nRF52840 DK &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/0944459b5b622048a08ad1f8cf8a044c135fd0d3/boards/arm/nrf52840dk_nrf52840/nrf52840dk_nrf52840.dts#L206-L212"&gt;uses QSPI&lt;/a&gt;, while the nRF9160 DK &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/0944459b5b622048a08ad1f8cf8a044c135fd0d3/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common_0_14_0.dtsi#L42-L49"&gt;uses SPI&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yes, don&amp;#39;t hesitate to ask if you encounter new issues.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/322375?ContentTypeID=1</link><pubDate>Thu, 29 Jul 2021 07:57:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:212fd1b6-78fb-461d-a660-b5e0e1c4413b</guid><dc:creator>Oette</dc:creator><description>&lt;p&gt;Hey, I was able to get it mounted. I just needed to add these configs and remove the qspi configs that I had copied from the nrf52840 config:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_PM_EXTERNAL_FLASH=y
CONFIG_PM_EXTERNAL_FLASH_DEV_NAME=&amp;quot;MX25R64&amp;quot;
CONFIG_PM_EXTERNAL_FLASH_BASE=0
CONFIG_PM_EXTERNAL_FLASH_SIZE=0x4000000
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Now I just need to get it working with the logs &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f603.svg" title="Smiley"&gt;&amp;#x1f603;&lt;/span&gt;. I will ask for help if I have trouble with it&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/322181?ContentTypeID=1</link><pubDate>Wed, 28 Jul 2021 09:35:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb2eea8e-c9bb-4683-8186-db120f0276ac</guid><dc:creator>Simon</dc:creator><description>[quote user="Atte P"]I will try debugging tomorrow.[/quote]
&lt;p&gt;&amp;nbsp;Sounds good. Let me know if the init function fails or not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/322060?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 13:09:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d6975fef-add1-43f3-a0fb-6393eac9a5e6</guid><dc:creator>Oette</dc:creator><description>[quote userid="72692" url="~/f/nordic-q-a/77743/nrf9160-dk-logging-to-external-memory/322039#322039"]Regarding 1, can you check the file&amp;nbsp;&lt;em&gt;zephyr/samples/subsys/fs/littlefs/&amp;lt;build folder&amp;gt;/zephyr/zephyr.dts&amp;nbsp;&lt;/em&gt;and search for &amp;quot;MX25R64&amp;quot;?[/quote]
&lt;p&gt;It is mentioned under spi3:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;			spi3: spi@b000 {
				#address-cells = &amp;lt; 0x1 &amp;gt;;
				#size-cells = &amp;lt; 0x0 &amp;gt;;
				reg = &amp;lt; 0xb000 0x1000 &amp;gt;;
				interrupts = &amp;lt; 0xb 0x1 &amp;gt;;
				status = &amp;quot;okay&amp;quot;;
				label = &amp;quot;SPI_3&amp;quot;;
				compatible = &amp;quot;nordic,nrf-spim&amp;quot;;
				sck-pin = &amp;lt; 0xd &amp;gt;;
				mosi-pin = &amp;lt; 0xb &amp;gt;;
				miso-pin = &amp;lt; 0xc &amp;gt;;
				cs-gpios = &amp;lt; &amp;amp;gpio0 0x19 0x1 &amp;gt;;
				mx25r64: mx25r6435f@0 {
					compatible = &amp;quot;jedec,spi-nor&amp;quot;;
					reg = &amp;lt; 0x0 &amp;gt;;
					spi-max-frequency = &amp;lt; 0x7a1200 &amp;gt;;
					label = &amp;quot;MX25R64&amp;quot;;
					jedec-id = [ C2 28 17 ];
					sfdp-bfp = [ E5 20 F1 FF FF FF FF 03 44 EB 08 6B 08 3B 04 BB EE FF FF FF FF FF 00 FF FF FF 00 FF 0C 20 0F 52 10 D8 00 FF 23 72 F5 00 82 ED 04 CC 44 83 68 44 30 B0 30 B0 F7 C4 D5 5C 00 BE 29 FF F0 D0 FF FF ];
					size = &amp;lt; 0x4000000 &amp;gt;;
					has-dpd;
					t-enter-dpd = &amp;lt; 0x2710 &amp;gt;;
					t-exit-dpd = &amp;lt; 0x88b8 &amp;gt;;
					partitions {
						compatible = &amp;quot;fixed-partitions&amp;quot;;
						#address-cells = &amp;lt; 0x1 &amp;gt;;
						#size-cells = &amp;lt; 0x1 &amp;gt;;
						lfs1_part: partition@0 {
							label = &amp;quot;storage&amp;quot;;
							reg = &amp;lt; 0x0 0x10000 &amp;gt;;
							phandle = &amp;lt; 0x5 &amp;gt;;
						};
					};
				};
			};&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Does this seem correct to you?&lt;/p&gt;
[quote userid="72692" url="~/f/nordic-q-a/77743/nrf9160-dk-logging-to-external-memory/322039#322039"]Can you debug spi_nor_init() and see if it fails[/quote]
&lt;p&gt;I will try debugging tomorrow.&lt;/p&gt;
&lt;p&gt;I also tried attaching an oscilloscope to the SCK-pin (P0.13) but it didn&amp;#39;t seem to have any signal on it.&lt;/p&gt;
&lt;p&gt;Thanks for your response &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/322039?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 12:04:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a98026be-d53d-4a47-afd9-b13ab2f97b7d</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;A quick comment. I saw the following message:&amp;nbsp;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;err&amp;gt; littlefs: can&amp;#39;t get flash device: MX25R64&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This means that these lines failed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.0-rc1-ncs1/subsys/fs/littlefs_fs.c#L636"&gt;littlefs_fc.c --&amp;gt; flash_area_get_device()&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.0-rc1-ncs1/subsys/storage/flash_map/flash_map.c#L254"&gt;flash_map.c --&amp;gt; device_get_binding()&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The call to device_get_binding() can fail due to two reasons&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If the label (&amp;quot;MX25R64&amp;quot;) it&amp;#39;s looking for is not in the generated DTS (which is translated into header files readable to .c files)&lt;/li&gt;
&lt;li&gt;If the associated init function failed.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Regarding 1, can you check the file&amp;nbsp;&lt;em&gt;zephyr/samples/subsys/fs/littlefs/&amp;lt;build folder&amp;gt;/zephyr/zephyr.dts&amp;nbsp;&lt;/em&gt;and search for &amp;quot;MX25R64&amp;quot;?&lt;/p&gt;
&lt;p&gt;Regarding 2, to find the associated init function you can look at the compatible field used for the mx25r64, which is&amp;nbsp;&lt;em&gt;&amp;quot;jedec,spi-nor&amp;quot;. &lt;/em&gt;Then, after searching through NCS for &amp;quot;jedec_spi_nor&amp;quot;, I found that the driver&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/6d2b8c7b17aabf54c6120bbf79cf432add0956b1/drivers/flash/spi_nor.c#L10"&gt;zephyr/drivers/flash/spi_nor.c&lt;/a&gt;&amp;nbsp;used that compatible field, which contains the init function &lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/6d2b8c7b17aabf54c6120bbf79cf432add0956b1/drivers/flash/spi_nor.c#L1140"&gt;spi_nor_init()&lt;/a&gt;. Can you look into (either through&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/nordic/nrf-connect-sdk-guides/b/getting-started/posts/nrf-connect-sdk-tutorial---part-3-ncs-v1-4-0#h131sk0f71xdy1hliuda1vq9p8n11weqgr"&gt;debugging&lt;/a&gt;, or adding printk()&amp;#39;s and open a terminal like Termite) spi_nor_init()--&amp;gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/6d2b8c7b17aabf54c6120bbf79cf432add0956b1/drivers/flash/spi_nor.c#L1014"&gt;&lt;span&gt;spi_nor_configure()&lt;/span&gt;&lt;/a&gt; and see if it fails (should return null if succesful)? This is a function run by the kernel before main.c&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/322008?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 10:14:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:937cc090-9b7f-4333-a092-22cdecf168c4</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I will try to get a hold of an nRF9160 DK v1.0 with external memory and try to get it working.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/321999?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 09:34:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ede1d88a-a7a7-44d4-9927-32eca1beff94</guid><dc:creator>Oette</dc:creator><description>&lt;p&gt;Update on this:&lt;/p&gt;
&lt;p&gt;I realised I have to route the flash chip to the nRF9160. I followed &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/76723/how-to-use-the-nrf9160-dk-onboard-external-flash/317242#317242"&gt;this thread&lt;/a&gt; to do so. I also realised there is an overlay for newer DK&amp;#39;s so I removed the spi3 configurations from the &amp;quot;&lt;em&gt;nrf9160dk_nrf9160ns.overlay&lt;/em&gt;&amp;quot; file, because I get them when I build it for the new revision.&lt;/p&gt;
&lt;p&gt;However, I am still not able to get it to work.&lt;/p&gt;
&lt;p&gt;I also tested &lt;a href="https://github.com/nrfconnect/sdk-zephyr/tree/0944459b5b622048a08ad1f8cf8a044c135fd0d3/samples/subsys/fs/littlefs"&gt;Zephyr&amp;#39;s littlefs sample&lt;/a&gt;, and it fails to mount the flash as well:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
Area 0 at 0x0 on MX25R64 for 65536 bytes
FAIL: mount id 0 at /lfs1: -19
[00:00:00.252,563] [1B][0m&amp;lt;inf&amp;gt; littlefs: littlefs partition at /lfs1[1B][0m
[00:00:00.260,620] [1B][0m&amp;lt;inf&amp;gt; littlefs: LittleFS version 2.2, disk version 2.0[1B][0m
[00:00:00.260,620] [1B][1;31m&amp;lt;err&amp;gt; littlefs: can&amp;#39;t get flash device: MX25R64[1B][0m
[00:00:00.260,650] [1B][1;31m&amp;lt;err&amp;gt; fs: fs mount error (-19)[1B][0m
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/321987?ContentTypeID=1</link><pubDate>Tue, 27 Jul 2021 09:02:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ac55aff-bae4-43ed-afc9-3c2ad13361c3</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;I will take a look at this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/321841?ContentTypeID=1</link><pubDate>Mon, 26 Jul 2021 13:25:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c11b82f-9576-471b-906b-7d889f53bb31</guid><dc:creator>Oette</dc:creator><description>&lt;p&gt;Hey Simon,&lt;/p&gt;
&lt;p&gt;I tried the test, but I couldn&amp;#39;t get it to work. I am able to build and run it but mounting the filesystem fails:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
Running test suite test_log_backend_fs
===================================================================
START - test_fs_nonexist
 Assertion failed at ../src/log_fs_test.c:47: test_fs_nonexist: (rc not equal to 0)
 Can not mount FS.
 FAIL - test_fs_nonexist in 0.10 seconds
 ===================================================================
 START - test_wipe_fs_logs
 PASS - test_wipe_fs_logs in 0.1 seconds
 ===================================================================
 START - test_log_fs_file_content
 Assertion failed at ../src/log_fs_test.c:103: test_log_fs_file_content: (fs_open(&amp;amp;file, fname, FS_O_READ) not equal to 0)
 Can not open log file.
 FAIL - test_log_fs_file_content in 0.14 seconds
 ===================================================================
 START - test_log_fs_file_size
 Assertion failed at ../src/log_fs_test.c:145: test_log_fs_file_size: (fs_stat(fname, &amp;amp;entry) not equal to 0)
 Can not get file info. 
 FAIL - test_log_fs_file_size in 0.13 seconds
 ===================================================================
 START - test_log_fs_files_max
 Assertion failed at ../src/log_fs_test.c:212: test_log_fs_files_max: (rc not equal to 0)
 Can not open directory. 
 FAIL - test_log_fs_files_max in 0.12 seconds
 ===================================================================
 Test suite test_log_backend_fs failed.
 ===================================================================
PROJECT EXECUTION FAILED&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I made .conf and .overlay files for nrf9160dk: &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/nrf9160dk_5F00_nrf9160ns.conf"&gt;devzone.nordicsemi.com/.../nrf9160dk_5F00_nrf9160ns.conf&lt;/a&gt;, &lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4743.nrf9160dk_5F00_nrf9160ns.overlay"&gt;devzone.nordicsemi.com/.../4743.nrf9160dk_5F00_nrf9160ns.overlay&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Is there something wrong with these? Or is there something I need to change in the code? I needed to add the MX25R64 in the overlay because it is not included in the common.dts file.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF9160 DK: Logging to external memory</title><link>https://devzone.nordicsemi.com/thread/321615?ContentTypeID=1</link><pubDate>Fri, 23 Jul 2021 16:35:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2c3deb9e-21f3-4bbb-a84b-70256cc5478a</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;It does not seem like there are any samples that demonstrates how to use this feature. However,&amp;nbsp;it&amp;#39;s made a test for it here:&amp;nbsp;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/tree/0944459b5b622048a08ad1f8cf8a044c135fd0d3/tests/subsys/logging/log_backend_fs"&gt;https://github.com/nrfconnect/sdk-zephyr/tree/0944459b5b622048a08ad1f8cf8a044c135fd0d3/tests/subsys/logging/log_backend_fs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This should give you an idea how to enable&amp;nbsp;&lt;em&gt;LittleFS backend logging&amp;nbsp;&lt;/em&gt;in your sample&lt;/p&gt;
&lt;p&gt;Don&amp;#39;t overlook these files:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/0944459b5b622048a08ad1f8cf8a044c135fd0d3/tests/subsys/logging/log_backend_fs/boards/nrf52840dk_nrf52840.conf"&gt;zephyr/tests/subsys/logging/log_backend_fs/boards/nrf52840dk_nrf52840.conf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nrfconnect/sdk-zephyr/blob/0944459b5b622048a08ad1f8cf8a044c135fd0d3/tests/subsys/logging/log_backend_fs/boards/nrf52840dk_nrf52840.overlay"&gt;zephyr/tests/subsys/logging/log_backend_fs/boards/nrf52840dk_nrf52840.overlay&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Add similar files&amp;nbsp;for your board (nrf9160dk_nrf9160ns I guess?) in your sample as well&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t get it to work, please let me know and I will try to get it working myself.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>