<?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>usbd_msc FATFS read/write pointer question (also littlefs)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/71290/usbd_msc-fatfs-read-write-pointer-question-also-littlefs</link><description>Hi! 
 I am currently looking into using a file system to store logged data as files in my QSPI flash memory. To get started I looked around on the devzone and found the usbd_msc example. This works quite well so far. My question however is: I would like</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 09 Feb 2021 06:58:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/71290/usbd_msc-fatfs-read-write-pointer-question-also-littlefs" /><item><title>RE: usbd_msc FATFS read/write pointer question (also littlefs)</title><link>https://devzone.nordicsemi.com/thread/293461?ContentTypeID=1</link><pubDate>Tue, 09 Feb 2021 06:58:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a555537-9e08-41f2-95a2-a8f380dd7a09</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Okay, thank you for the explanation, seems like a misunderstanding on our part then. Sorry about that, but I/we thought you were editing the file object structure in your initial ticket text.&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: usbd_msc FATFS read/write pointer question (also littlefs)</title><link>https://devzone.nordicsemi.com/thread/293281?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 10:20:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cff4f347-92f2-40c8-92a8-e6d9005f3f85</guid><dc:creator>MichielSch</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/71290/usbd_msc-fatfs-read-write-pointer-question-also-littlefs/293256#293256"]Our expert found it interesting/concerning that you modified the FatFS files/libraries instead of adding a pointer like this yourself to the file you&amp;#39;re using.&amp;nbsp;[/quote]
&lt;p&gt;I still don&amp;#39;t get what you mean with his. For example in the usbd_msc_pca10056 file I only changed code in the main.c file. So I did not touch the libraries. I do write to the file.fptr at run time, is this what you mean with FatFS files?&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/71290/usbd_msc-fatfs-read-write-pointer-question-also-littlefs/293256#293256"]instead of adding a pointer like this yourself to the file you&amp;#39;re using.&amp;nbsp;[/quote]
&lt;p&gt;This pointer is specific to the file I have open I would think.&lt;/p&gt;
&lt;p&gt;I believe that in a full blown file system the functionality I am looking for would be the &amp;quot;rewind&amp;quot; function.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/rewind.html"&gt;pubs.opengroup.org/.../rewind.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks and best regards,&lt;/p&gt;
&lt;p&gt;Michiel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: usbd_msc FATFS read/write pointer question (also littlefs)</title><link>https://devzone.nordicsemi.com/thread/293256?ContentTypeID=1</link><pubDate>Mon, 08 Feb 2021 08:58:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:221d7a52-4e66-4661-acf7-e9dd6722c3e5</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi again&lt;/p&gt;
&lt;p&gt;Sounds like a good approach to me, but yes, this part of the flash will likely be worn out before the rest.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Our expert found it interesting/concerning that you modified the FatFS files/libraries instead of adding a pointer like this yourself to the file you&amp;#39;re using.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Either way, a process like this will take a toll on the flash memory&amp;#39;s lifetime I&amp;#39;d imagine.&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: usbd_msc FATFS read/write pointer question (also littlefs)</title><link>https://devzone.nordicsemi.com/thread/293066?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2021 11:17:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1971c9c4-fe58-4b8a-8cfd-aa42ad4e3f2a</guid><dc:creator>MichielSch</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thanks for the update.&lt;/p&gt;
&lt;p&gt;In my case I (think) will only have to update the metadata once or twice before it will get deleted. Basically the changes will be to mark it as synchronized and ready for removal. I also considered having this information in file with sort of a table that contains this information for all the files since in that case I would be able to only read one file in my &amp;quot;clean up&amp;quot; task and remove the old files. The issue in my head with that approach would be that the place in memory containing that file (with the table) would be worn pretty hard compared to the rest of the flash.&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/71290/usbd_msc-fatfs-read-write-pointer-question-also-littlefs/293024#293024"]but find it a bit strange that you want to do this by editing the file system itself instead of storing this metadata in its own file or part of a file?[/quote]
&lt;p&gt;This I don&amp;#39;t quite get, why would I change the file system? The metadata would be in the first few lines of the files themselves. &lt;/p&gt;
&lt;p&gt;Thanks for the input, it&amp;#39;s really helpful getting your point of view.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michiel&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: usbd_msc FATFS read/write pointer question (also littlefs)</title><link>https://devzone.nordicsemi.com/thread/293024?ContentTypeID=1</link><pubDate>Fri, 05 Feb 2021 06:36:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d580a5b2-7c1b-4967-aebd-8cd8baa1edfd</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Michiel&lt;/p&gt;
&lt;p&gt;Indeed, how you implement this is up to you, if it&amp;#39;s working well for you I see no reason this should be an issue. No one here at Nordic are really &amp;quot;experts&amp;quot; in the FatFS field, but find it a bit strange that you want to do this by editing the file system itself instead of storing this metadata in its own file or part of a file?&lt;/p&gt;
&lt;p&gt;In order to maximize the flash lifetime it is generally not a good idea to edit a file every time you open it, as that will cause you to reach the maximum number of flash writes/reads that the flash is specced for much faster.&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: usbd_msc FATFS read/write pointer question (also littlefs)</title><link>https://devzone.nordicsemi.com/thread/292955?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 14:36:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:925a62f4-cbeb-4f3b-a230-14057df69aec</guid><dc:creator>MichielSch</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;Thanks for your reply! For now I will manually adjust it and i look forward to the decisive answer later on. Setting it manually to zero by &lt;pre class="ui-code" data-mode="text"&gt;file.fptr = 0;&lt;/pre&gt; actually works quite well it seems.&lt;/p&gt;
&lt;p&gt;Thanks again,&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michiel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: usbd_msc FATFS read/write pointer question (also littlefs)</title><link>https://devzone.nordicsemi.com/thread/292939?ContentTypeID=1</link><pubDate>Thu, 04 Feb 2021 13:59:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffd7fb19-affd-415e-800c-dc31f64fd23c</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Michiel&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t have any experience with the littlefs file system, so I&amp;#39;ll leave this question open for any potential experts amongst other DevZone users.&lt;/p&gt;
&lt;p&gt;As for the pointer predicament, let me double check this with an expert internally on this, and I&amp;#39;ll get back to you tomorrow with a decisive answer. I have a hunch that both of&amp;nbsp;the methods you suggest should be fine, and that it&amp;#39;s up to you what you do.&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>