<?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>File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/97005/file-delete-in-littlefs-results-in--22-error</link><description>So I have a device on a custom PCB with an nrf52832 and a mx25r1635f, with which I&amp;#39;ve had quite some trouble already( ). In most of the devices it&amp;#39;s working correctly and was working up until a couple hours ago, but now any operation with the Flash takes</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 24 Mar 2023 14:59:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/97005/file-delete-in-littlefs-results-in--22-error" /><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/417466?ContentTypeID=1</link><pubDate>Fri, 24 Mar 2023 14:59:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79ccc474-dc76-4bf2-b1b2-e27a2a8987a6</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;After opening a github issue about this problem(&lt;a id="" href="https://github.com/zephyrproject-rtos/zephyr/issues/56150)"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/56150&lt;/a&gt;) and got some useful answers about not being able to write many many files, which in my case was due to the other problem I mentioned, and now I&amp;#39;ve found the solution for it, so writing many files is no longer necessary.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/417029?ContentTypeID=1</link><pubDate>Thu, 23 Mar 2023 11:50:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8bc0a5bc-f687-49db-856b-61de352181b4</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;Hi, I tried diving into the zephyr source code to track down the -22 error code problem, in the end I went on this track:&lt;br /&gt;fs_unlink&lt;br /&gt;lfs_dir_commit&lt;br /&gt;lfs_orphaningcommit&lt;br /&gt;lfs_dir_relocatingcommit&lt;br /&gt;lfs_dir_splittingcompact&lt;br /&gt;lfs_dir_split&lt;br /&gt;lfs_dir_alloc&lt;br /&gt;lfs_bd_read&lt;/p&gt;
&lt;p&gt;lfs-&amp;gt;cfg-&amp;gt;read&lt;br /&gt;&lt;br /&gt;but now I don&amp;#39;t quite know where to go next, as the api struct has me really lost as to which function it&amp;#39;s calling.&lt;br /&gt;&lt;br /&gt;Does anyone know what function I have to track down now?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/416272?ContentTypeID=1</link><pubDate>Mon, 20 Mar 2023 13:04:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7337a7f0-bf82-4ade-93bc-57215a117f91</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;Hi, is there any other thing I could test to determine the problem? Now it has already happened on 6 boards and I have 0 clues as to what could be the cause. It&amp;#39;s a pretty serious problem in my case, since I can&amp;#39;t use something with this problem for the production of 200 devices.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/415331?ContentTypeID=1</link><pubDate>Tue, 14 Mar 2023 18:29:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c440fddb-a0e9-4d96-8961-246b11617c41</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;Hi, with the logic analyser I can&amp;#39;t really see a difference. But there is also the problem that my logic analyse is on of those VERY cheap ones and doesn&amp;#39;t handle the 24MS/s sampling frequency very well and constantly timesout.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/415315?ContentTypeID=1</link><pubDate>Tue, 14 Mar 2023 17:00:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f96b27e-59ca-4bca-8faf-ea8fa96c57bd</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Do you see any difference in the commands being sent on the logic analyzer before and after the issue occurs?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/413245?ContentTypeID=1</link><pubDate>Fri, 03 Mar 2023 12:34:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5e1ff04-aaec-4e42-a767-2d6d3ec2d06e</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;Hi, it happened now on the third board I tested as well, so I think it must be software related. The only problem is I don&amp;#39;t really know what could be causing it on my firmware, could it be on the lower level driver?&lt;br /&gt;&lt;br /&gt;Edit: One info that might be helpful is that the occupied flash size is 89kB aproximately. Since my external flash size is 2MB, I don&amp;#39;t think it could be filled memory.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/413089?ContentTypeID=1</link><pubDate>Thu, 02 Mar 2023 15:56:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03f27f8a-2070-4789-b017-c89fceee8734</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hard to determine if this is a hardware or software problem from the available information, but as long as it only happens occasionally and only on one/a few boards, it does sound more like a hardware issue than software related.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/412823?ContentTypeID=1</link><pubDate>Wed, 01 Mar 2023 17:21:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d3d1f0ca-f1f8-4ffa-a777-fb91c6b97d49</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;ok, so something weird happended now, the problem disappeared after leaving it running for about an hour or so and I have no clue what &amp;quot;solved&amp;quot; it. And about the weird clock signal and general weirdness on the logic analyser it was due to my sampling frequency, it was set to 12MS/s so of course I&amp;#39;d see a frequency of 12MHz and weird behaviour, and since it only goes up to 24MS/s but gives a timeout frequently(don&amp;#39;t really know why) using the logic analyser might be a problem. Could it be a problem with the hardware or is it something in the firmware really?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/412782?ContentTypeID=1</link><pubDate>Wed, 01 Mar 2023 14:27:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0dafc2aa-d41c-47cc-9e33-c0ca7b0fd6fd</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;It happened on another board as well now, same thing, operated for a good while saving data toi the flash and now anything it tries to do to it returns -22 error. So I connected a logic analyser to it and the clock looks really weird to me:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1677680710334v1.png" alt=" " /&gt;&lt;br /&gt; is this normal?&lt;br /&gt;Another thing as well is that the clock frequency is 12MHz, even though I set it to 20MHz in the .dts file&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1677680746518v2.png" alt=" " /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;spi1 {
	 compatible = &amp;quot;nordic,nrf-spi&amp;quot;;
	 status = &amp;quot;okay&amp;quot;;
	 pinctrl-0 = &amp;lt;&amp;amp;spi1_default&amp;gt;;
	 pinctrl-1 = &amp;lt;&amp;amp;spi1_sleep&amp;gt;;
	 pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
	 clock-frequency = &amp;lt;20000000&amp;gt;;
	 mx25r16: mx25r1635f@0 {
		compatible = &amp;quot;jedec,spi-nor&amp;quot;;
		reg = &amp;lt;0&amp;gt;;
		spi-max-frequency = &amp;lt;33000000&amp;gt;;
		jedec-id = [c2 28 15];
		size = &amp;lt;DT_SIZE_M(16)&amp;gt;;
	};
 };&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/412258?ContentTypeID=1</link><pubDate>Mon, 27 Feb 2023 12:28:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64efe4af-45ec-49bd-8806-cf942b8c5325</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;Hi, currently I can&amp;#39;t probe these aspects as I have other pressing problems to solve, but once I get the time I&amp;#39;ll be sure to do that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/412247?ContentTypeID=1</link><pubDate>Mon, 27 Feb 2023 12:00:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30722c10-37d5-4db6-ab20-d5b9f30ac9cd</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you do some more debugging to see what happens in the 14 seconds? Is the application stuck waiting for some event, etc? Have you scoped the SPI lines to see how long the actual transfer/commands take, and if these are transmitted as expected?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/412024?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2023 15:01:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4d68ae6-6244-457e-999a-cb2202315814</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;Yeah, I also think it might be a problem with the board, what&amp;#39;s weird to me is it was working just fine up until a little while ago. And I really need to fix this issue with the board, since I have to get 200 boards ready for production and there were only 200 boards fabricated in China(yeah, I know it&amp;#39;s a really bad idea, but it wasn&amp;#39;t me who decided the quantity). I just thought something in the firmware could be the culprit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/412023?ContentTypeID=1</link><pubDate>Fri, 24 Feb 2023 14:56:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:33b4271a-4ed8-49bd-8b38-06e779ca1d75</guid><dc:creator>droidecahedron</dc:creator><description>&lt;p&gt;If it only happens on one specific board you have and not others, my instinct would be to assume something is up with that board.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;could you clarify?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/411702?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 14:50:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b81e66da-dcf4-49dd-a882-b133ba743af4</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;Yes it happens constantly now on a specific hardware, on every reset. On the other PCBs it doesn&amp;#39;t happen, it&amp;#39;s only on that one specific board.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/411701?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 14:48:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c18df99-d22f-4457-aff3-4880a1ef04f7</guid><dc:creator>droidecahedron</dc:creator><description>&lt;p&gt;127 bytes definitely doesnt make sense for 14 seconds.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Does this behavior occur between every single &amp;quot;fs reset&amp;quot; like format/unmount/mount?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/411700?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 14:43:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:470b53a9-680e-4721-9259-7c3fa3fd1edd</guid><dc:creator>BenKrug</dc:creator><description>&lt;p&gt;Hi, fixed the link, due to the error mentioned on the linked ticket, the file is only 127 bytes long, so 14 seconds doesn&amp;#39;t make sense&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: File Delete in littleFS results in -22 error</title><link>https://devzone.nordicsemi.com/thread/411697?ContentTypeID=1</link><pubDate>Thu, 23 Feb 2023 14:31:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:87b99b43-4907-4151-a9de-5208d54d0b7a</guid><dc:creator>droidecahedron</dc:creator><description>&lt;p&gt;The page you linked is a dead URL.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s some background info I&amp;#39;ve experienced:&lt;/p&gt;
&lt;p&gt;When using LittleFS, operations begin to take a long while as the file sizes get bigger. 14 seconds can sometimes happen depending on the flash youre using and how big the littlefs file is.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Check this out:&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1677162671519v1.png" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;(x axis - write size, y axis - ratio between average fs write speed vs average raw write speed)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Try formatting and re-mounting the file system. It&amp;#39;s odd that it&amp;#39;s not letting you delete, but it could be due to a timeout. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;ve run into that and had to change the timeout for the flash interactions.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>