Is reading and writing a Littlefs logfile at the same time allowed?

arjen1
Posts: 16
Joined: Sun Aug 06, 2023 4:48 pm

Is reading and writing a Littlefs logfile at the same time allowed?

Postby arjen1 » Wed Aug 14, 2024 10:40 am

Dear forum

I do not seem to get the correct search phrases for this question:

I read sensor input. Every 5 minutes I write 7 values with a time stamp to a logfile in LittleFS.
Now and then I want to read (some) values of this file and show it in a chart.

Can I do that? Can you open a file for writing and a the same time and in another function open the same file for reading without conflict?

Thanks

AgentSmithers
Posts: 12
Joined: Fri Jul 02, 2021 12:18 am

Re: Is reading and writing a Littlefs logfile at the same time allowed?

Postby AgentSmithers » Wed Aug 14, 2024 12:27 pm

Are you using Arduino's LittleFS or some other variation? If so can you provide the link to confirm the implementation.

arjen1
Posts: 16
Joined: Sun Aug 06, 2023 4:48 pm

Re: Is reading and writing a Littlefs logfile at the same time allowed?

Postby arjen1 » Wed Aug 14, 2024 5:18 pm

I am using the built in LittleFS, I did not install any other library for LittleFS.

AgentSmithers
Posts: 12
Joined: Fri Jul 02, 2021 12:18 am

Re: Is reading and writing a Littlefs logfile at the same time allowed?

Postby AgentSmithers » Wed Aug 14, 2024 7:21 pm

arjen1 wrote:
Wed Aug 14, 2024 5:18 pm
I am using the built in LittleFS, I did not install any other library for LittleFS.
Is this an Arduino project? I am unsure what you mean by "Built-in".

arjen1
Posts: 16
Joined: Sun Aug 06, 2023 4:48 pm

Re: Is reading and writing a Littlefs logfile at the same time allowed?

Postby arjen1 » Thu Aug 15, 2024 9:36 am

Using the arduino IDE for an ESP8266 project. I am using the LittleFS library that comes with the Arduino IDE, or maybe when you install the ESP8266 stuff. I did not install any 3rd party LittleFS library.

AgentSmithers
Posts: 12
Joined: Fri Jul 02, 2021 12:18 am

Re: Is reading and writing a Littlefs logfile at the same time allowed?

Postby AgentSmithers » Sat Aug 17, 2024 10:03 pm

This question is specific to LittleFS, not so much Arduino as an interrupt may be triggered to write the data while reading is in progress, however, if LittleFS creates a variable to hold if the data is locked then that will be an issue.

Have you implemented an interrupt/protothreads to handle triggering either reading or writing while the opposite is occurring, or what method are you attempting to use to kick off the read/writing while the other is taking place?

Who is online

Users browsing this forum: No registered users and 10 guests