<?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>Filesystem logging backend not keeping up and stopping</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92446/filesystem-logging-backend-not-keeping-up-and-stopping</link><description>Hi there! 
 I&amp;#39;m currently in the process of migrating an &amp;#39;old&amp;#39; nRF5X based application already in the field to the nRF Connect SDK, and am stumbling upon issues with logging to the filesystem. 
 The issue is reproducible with the nRF Connect SDK V2.0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Dec 2022 10:17:33 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92446/filesystem-logging-backend-not-keeping-up-and-stopping" /><item><title>RE: Filesystem logging backend not keeping up and stopping</title><link>https://devzone.nordicsemi.com/thread/400340?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2022 10:17:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b175cce-3c93-49b3-9246-59cafb0e2387</guid><dc:creator>JVKran</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Sorry for the delay. We&amp;#39;ve ditched logging to the SD-card because, as it turns out, FatFS doesn&amp;#39;t support having multiple files open for writing by default. See&amp;nbsp;&lt;a href="http://elm-chan.org/fsw/ff/doc/appnote.html" rel="noopener noreferrer" target="_blank"&gt;the appnote about re-entrancy&lt;/a&gt;&amp;nbsp;over on the site of elm-chan.&lt;/p&gt;
&lt;p&gt;Logging to flash works just fine. Thanks for helping.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Jochem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Filesystem logging backend not keeping up and stopping</title><link>https://devzone.nordicsemi.com/thread/388924?ContentTypeID=1</link><pubDate>Mon, 03 Oct 2022 09:09:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab83c0a0-1fa1-4dce-83ff-b4ced37b4414</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Jochem,&lt;/p&gt;
&lt;p&gt;I was not aware. Well. The FATFS filesystem is not necessarily the same as an SD card. It could also refer to an area of the internal (or external QSPI) flash. External QSPI flash would be XiP, execute in place, which differs from an SD card. XiP will treat the attached flash as if it was internal flash. Just for testing, you could try to remove the SD card, and log directly to the internal flash of the nRF52832 and see whether the issue remains? I suspect that logging to flash on an SD card is a corner case that isn&amp;#39;t really covered, even though logging to flash (internal) and using fatfs on an sd card both work separately. The challenge here is that you only have a simple SPI connection to the SD card, and using this SPI bus is fairly slow compared to your application running on the nRF52832.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What functions was it that returned the -2 and -5 errors?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Filesystem logging backend not keeping up and stopping</title><link>https://devzone.nordicsemi.com/thread/388914?ContentTypeID=1</link><pubDate>Mon, 03 Oct 2022 08:38:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41ca68a5-b827-4c39-bb17-84bfbb3580e8</guid><dc:creator>JVKran</dc:creator><description>&lt;p&gt;Hi Edvin,&lt;/p&gt;
&lt;p&gt;Not a late reply at all, thanks. I&amp;#39;m using Zephyrs Filesystem Logging Backend &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.7.0/kconfig/CONFIG_LOG_BACKEND_FS.html" rel="noopener noreferrer" target="_blank"&gt;as documented here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Multi-threaded use of SD-card by the filesystem should also be supported with the use of the configuration variable &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.5.2/kconfig/CONFIG_FS_FATFS_NUM_FILES.html" rel="noopener noreferrer" target="_blank"&gt;CONFIG_FS_FATFS_NUM_FILES&lt;/a&gt;. As a result, I would expect several simultaneous operations should be supported.&lt;/p&gt;
&lt;p&gt;What do you think?&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Jochem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Filesystem logging backend not keeping up and stopping</title><link>https://devzone.nordicsemi.com/thread/388907?ContentTypeID=1</link><pubDate>Mon, 03 Oct 2022 08:00:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b875b76-63a0-4d61-a89e-c309bb04c5be</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello Jochem,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Sorry for the late reply,&lt;/p&gt;
[quote user=""]&lt;p&gt;This results in error -2 ENOENT (No such file or directory) or error -5 EIO (I/O-error).&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;[/quote]
&lt;p&gt;What sort of functions is returning these values?&lt;/p&gt;
&lt;p&gt;Are you using some premade SD card backend to write log messages to flash, or did you implement this yourself? If it is something already available, can you please let me know what you are using? (Because I am currently not aware of this feature in NCS).&lt;/p&gt;
&lt;p&gt;It sounds to me like you have some issues with several instances trying to access the SD card at once. If you have not implemented some sort of queue function, you will probably see collisions like this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You should consider adding some semaphore, queue or buffer that you can use to handle several simultaneous interrupts/operations like this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>