<?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>Accessing little file storage data over BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/93753/accessing-little-file-storage-data-over-ble</link><description>I&amp;#39;m attempting to store log data on my nRF52832 using the little file storage, and then allow a client to access this over BLE. From what I can tell, the data transfer can be handled using the MCUmgr, as described here. 
 I&amp;#39;ve implemented the lfs example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 20 Nov 2022 11:20:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/93753/accessing-little-file-storage-data-over-ble" /><item><title>RE: Accessing little file storage data over BLE</title><link>https://devzone.nordicsemi.com/thread/396513?ContentTypeID=1</link><pubDate>Sun, 20 Nov 2022 11:20:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7aabbc6-7c01-44c3-a7ce-128879824ae4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;I am no littlefs expert, but if I understand the question correctly, then yes, you can append as well as update or overwrite (parts of) files, or a combination of that. (This is conceptually seen from the littlefs APIs though, so when you&amp;nbsp;close the file and it is actually written to flash, it will be re-written to a new physical location).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing little file storage data over BLE</title><link>https://devzone.nordicsemi.com/thread/396112?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2022 04:18:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92c89ee2-0ca5-4259-9007-a45a54f430ab</guid><dc:creator>Mike Austin (LPI)</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thanks - turns out my App developer was doing something wrong.&amp;nbsp; We&amp;#39;ve got this part of it working now.&lt;/p&gt;
&lt;p&gt;A question for you on using lfs - we are trying to log data into the file storage so that we have a record of events.&amp;nbsp; Our hardware spends most of its time in SYSTEM_OFF mode.&amp;nbsp; When triggered by a GPIO, it will wake up, record date/time and event type and event value, write this to file storage, then go back into deep sleep.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m still building all this functionality, but what I wanted to know is whether its possible to append new data to the existing data within my file on littlefs, or do I need to read in the contents of the file into a local struct, update the data, then write the whole lot back to the file before going back into deep sleep?&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Mike&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing little file storage data over BLE</title><link>https://devzone.nordicsemi.com/thread/395159?ContentTypeID=1</link><pubDate>Thu, 10 Nov 2022 15:15:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50e6652b-6127-45aa-be87-ee994eb0df41</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi Mike,&lt;/p&gt;
&lt;p&gt;MGMT_ERR_ENOENT is what you would get if you try to open a file that does not exist, so the path or mount point seems to be wrong.&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t make progress,&amp;nbsp;I suggest experimenting a bit with the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.2/zephyr/samples/subsys/mgmt/mcumgr/smp_svr/README.html"&gt;SMP Server Sample&lt;/a&gt;. That support a number of different backends, including Bluetooth and serial. For instance, by taking that sample from nRF Connect SDK SDK 2.1.2 and building with two additional configuration files (overlay-fs.conf and overlay-serial.conf) I got a working sample that makes it easy to demonstrate. Here I am both writing and reading back a file using mcumgr (serial here for simplicity, but the transport should not matter):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;$ echo &amp;quot;Test test&amp;quot; &amp;gt; test.txt
$ mcumgr -c acm0 fs upload test.txt /lfs1/test.txt
10
Done
$ mcumgr -c acm0 fs download /lfs1/test.txt test_readback.txt
0
10
Done
$ cat test_readback.txt 
Test test
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;PS: The first time you use a COM port with MCUmgr with a serial port you need to configure it. For my setup this was right, but you may need to do something differently:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;mcumgr conn add acm0 type=&amp;quot;serial&amp;quot; connstring=&amp;quot;dev=/dev/ttyACM0,baud=115200,mtu=512&amp;quot;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Einar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>