<?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>Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93046/log-to-nrf52-thingy-internal-flash</link><description>I am working on a prototype using the nRF Connect SDK v2.1.0 on the nRF52 Thingy platform. 
 For my prototype, I need to store normal log output on the internal flash of the nRF52 Thingy in FAT format. The reason behind this is: I will put my Thingys</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 08 Nov 2022 08:27:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93046/log-to-nrf52-thingy-internal-flash" /><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/394594?ContentTypeID=1</link><pubDate>Tue, 08 Nov 2022 08:27:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:44e1e5d2-f64e-44e0-b432-d62cc75568aa</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Michael&lt;/p&gt;
&lt;p&gt;No worries, it happens to the best of us &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;p&gt;The Thingy53 and Thingy91 have proper USB support, if you ever switch to one of them.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;How to handle it best on the Thingy52 I don&amp;#39;t know. Potentially you can still store it in flash directly, and use a debugger to read it out. Or connect to the UART interface and add some function to dump the logs over UART.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/394498?ContentTypeID=1</link><pubDate>Mon, 07 Nov 2022 15:27:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d0187f4-25cc-4efa-b2c7-4867ac7a613e</guid><dc:creator>spoerk</dc:creator><description>&lt;p&gt;Hi Torbj&amp;oslash;rn,&lt;br /&gt;Thanks for the reply. Yes, I was planning to use the USB on the Thingy52, but silly me did not read the documentation or looked at the schematics. Thank you for clarifying that my planned USB logging is not possible on the Thingy 52 hardware.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry to keep you busy with my issue. I should have checked before.&lt;/p&gt;
&lt;p&gt;All the best,&lt;/p&gt;
&lt;p&gt;Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/394466?ContentTypeID=1</link><pubDate>Mon, 07 Nov 2022 14:31:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4af697f4-d4e7-4c2f-9096-9b47d19ec12a</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Michael&lt;/p&gt;
&lt;p&gt;Sigurd is currently on leave, so I will help you with this case.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Just for my own curiosity, how are you planning to read data over USB from the Thingy52?&amp;nbsp;&lt;br /&gt;The Thingy52 uses the nRF52832, which doesn&amp;#39;t support USB, and the USB port on the board is used for charging the device only.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I did some testing myself, and using an nRF52840DK I have no issues to format the disk in Windows and access it locally, but so far I have only tested using the MX25 QSPI flash device on the DK. Are you able to share the project you are using to set up the internal flash rather than the external one?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then I can test it locally, and see if I can reproduce your issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/393743?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2022 18:17:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f559a7fa-ed10-4ca3-8f32-45dd8f93e2e4</guid><dc:creator>spoerk</dc:creator><description>&lt;p&gt;Thanks for getting back that fast.&lt;br /&gt;Unfortunately, formatting the FAT filesystem with Windows first does not fix the problem.&lt;/p&gt;
&lt;p&gt;The firmware on the nRF52 detects that the filesystem configuration (perhaps the block size) is not correct and formats the filesystem again with its parameters.&lt;/p&gt;
&lt;p&gt;Do you know of a filesystem config (e.g., block size, sectors, ...) windows and Zephyr can read?&lt;/p&gt;
&lt;p&gt;Thank you,&lt;br /&gt;Michael&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/393440?ContentTypeID=1</link><pubDate>Tue, 01 Nov 2022 11:45:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5f89740a-5be5-45ac-bef0-c4c35c4545dd</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;A colleague gave me an idea:&lt;/p&gt;
&lt;p&gt;The fat_fs sample worked for them, but they formatted the SD card on the windows first, then used it with the nRF.&lt;/p&gt;
&lt;p&gt;Would this work for you? &lt;br /&gt;To format it with windows first and then use it.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/393289?ContentTypeID=1</link><pubDate>Mon, 31 Oct 2022 14:58:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6cc6fdee-34fb-439d-a0d2-130e41205d11</guid><dc:creator>Sigurd Hellesvik</dc:creator><description>&lt;p&gt;Hi Michael,&lt;/p&gt;
&lt;p&gt;I know windows has a limited set of supported filesystem formats.&lt;br /&gt;My best guess is that you will need to figure out if windows supports FAT at all, and then what specific settings windows needs for FAT.&lt;/p&gt;
&lt;p&gt;I do not think we have anything on this, but I can try to look a bit more into it in the next couple of days.&lt;/p&gt;
&lt;p&gt;Regards,&lt;br /&gt;Sigurd Hellesvik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/392902?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2022 16:08:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df9446b5-d206-400d-8e40-2dc58239021c</guid><dc:creator>spoerk</dc:creator><description>&lt;p&gt;Do you by any chance know, how to configure the Zephyr FAT FS so that I can mount it on Windows without needing to format it?&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;With your fix, I am able to mount it, but I think the config is wrong. When I format it in Zephyr, Windows cannot read it. When I format it in Windows, Zephyr cannot read it.&lt;/p&gt;
&lt;p&gt;I could not find anything about FAT configuration for Windows compatibility in this forum.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;All the best,&lt;/p&gt;
&lt;p&gt;Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/392901?ContentTypeID=1</link><pubDate>Thu, 27 Oct 2022 16:03:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3e70df3-91f4-4481-aaa7-c171075415c4</guid><dc:creator>spoerk</dc:creator><description>&lt;p&gt;Thanks that fixed the problem.&lt;/p&gt;
&lt;p&gt;I have created a Zephyr issue so that this will get fixed in the future (&lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/issues/51720"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/51720&lt;/a&gt;). Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/392148?ContentTypeID=1</link><pubDate>Mon, 24 Oct 2022 12:07:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2f66237-5d06-4e4e-af4a-1d5b2334e1be</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Can you try to apply the following patch to Zephyr?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="diff"&gt;diff --git a/drivers/disk/flashdisk.c b/drivers/disk/flashdisk.c
index 62ad2babeb..3917900779 100644
--- a/drivers/disk/flashdisk.c
+++ b/drivers/disk/flashdisk.c
@@ -56,8 +56,11 @@ static int disk_flash_access_init(struct disk_info *disk)
 		return 0;
 	}
 
-	flash_dev = device_get_binding(CONFIG_DISK_FLASH_DEV_NAME);
-	if (!flash_dev) {
+	//flash_dev = device_get_binding(CONFIG_DISK_FLASH_DEV_NAME);
+	//if (!flash_dev) {
+	flash_dev = DEVICE_DT_GET(DT_NODELABEL(mx25r64));
+    if (!device_is_ready(flash_dev)) {
 		return -ENODEV;
 	}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;After I did that, I got the following output using the USB mass sample with your prj.conf.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.1.99-ncs1  ***
Area 4 at 0x0 on mx25r6435f@0 for 131072 bytes
Mount /NAND:: 0
/NAND:: bsize = 512 ; frsize = 512 ; blocks = 216 ; bfree = 216
/NAND: opendir: 0
End of files
[00:00:05.844,879] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Use of the devicetree&amp;nbsp;&lt;/span&gt;&lt;em&gt;label property&lt;/em&gt;&lt;span&gt;&amp;nbsp;has been deprecated per&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/releases/release-notes-3.2.html#devicetree"&gt;release notes of Zephyr v.3.2&lt;/a&gt;, and the flashdisk driver has not taken this into account.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Would you be able to create a &lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/new/choose"&gt;Zephyr GitHub issue&lt;/a&gt; about this?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/391682?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 13:08:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53b6a8ab-455a-476f-b941-3b588df2fb72</guid><dc:creator>spoerk</dc:creator><description>&lt;p&gt;Hi Simon,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thank you for your fast reply. As far as I can tell, you run the sample without specifying a file system. (&amp;quot;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;No file system selected&lt;/span&gt;&amp;quot; in the RTT output.&lt;/p&gt;
&lt;p&gt;Here is my full &lt;span style="font-family:&amp;#39;courier new&amp;#39;, courier;"&gt;prj.conf&lt;/span&gt; content:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_STDOUT_CONSOLE=y

#USB related configs
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_PRODUCT=&amp;quot;Zephyr MSC sample&amp;quot;
CONFIG_LOG=y
CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE=y
CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y
CONFIG_USB_MASS_STORAGE_LOG_LEVEL_ERR=y

CONFIG_MAIN_STACK_SIZE=1536

CONFIG_APP_MSC_STORAGE_FLASH_FATFS=y&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have executed nrfjprog --qspieraseall, but it did not solve the problem.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/391675?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 12:55:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df588450-3b5d-480d-8bf7-d7cdfa5c6cdb</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;Hello Michael&lt;/p&gt;
&lt;p&gt;I tried running&amp;nbsp;buildining the sample&amp;nbsp;\zephyr\samples\subsys\usb\mass in NCS v2.1.0 and flashing it to the nRF52840DK v3.0.0 but did not encounter the issue you did.&lt;/p&gt;
&lt;p&gt;I got the following RTT output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.255,645] &amp;lt;inf&amp;gt; main: No file system selected
[00:00:00.255,737] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;and the following serial output:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;*** Booting Zephyr OS build v3.1.99-ncs1  ***
[00:00:00.255,645] &amp;lt;inf&amp;gt; main: No file system selected
[00:00:00.255,737] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Try running &lt;a href="https://infocenter.nordicsemi.com/topic/ug_nrf_cltools/UG/cltools/nrf_nrfjprogexe_reference.html?cp=10_1_3_0"&gt;nrfjprog --qspieraseal&lt;/a&gt;l first, and program the USB Mass sample again.&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: Log to nrf52 thingy internal flash</title><link>https://devzone.nordicsemi.com/thread/391576?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 07:48:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7daec4c1-20de-47d2-a616-225003b92580</guid><dc:creator>spoerk</dc:creator><description>&lt;p&gt;When running the USB Mass sample in FLASH configuration on the nRF52840DK, I get the following RTT logs:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;[00:00:00.254,333] &amp;lt;err&amp;gt; usb_msc: Storage init ERROR !!!! - Aborting USB init
[00:00:00.258,514] &amp;lt;err&amp;gt; fs: fs mount error (-5)
[00:00:00.258,544] &amp;lt;err&amp;gt; main: Failed to mount filesystem
[00:00:00.258,728] &amp;lt;inf&amp;gt; main: The device is put in USB mass storage mode.&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>