Code Monkey home page Code Monkey logo

Comments (5)

greiman avatar greiman commented on July 17, 2024

Sorry I didn't get back sooner. I am in am in an area of California that had a three day power outage.

For a long term applications like this I would use a design that does not create or extend files. I would avoid using timestamps in directories. This would avoid any corruption of directories or the file allocation table

I would prepare an SD with an empty file for each day of logging.

I would open a file at the start of each day and rewrite the file using 512 byte writes. Writing 512 byte blocks on 512 byte boundaries will prevent read/update/write operations.

Is there a specific MCU/family with best reliability?

I can't comment on a specific MCU. Reliability depends on how the MCU is integrated into the system and the board support package's system software.

Specific MicroSD/family with best reliability?

I would use one of the popular mid-range cards. I like Samsung and SanDisk. High end cards buy performance, not reliability.

Is dedicated SPI mode recommended vs shared SPI with another device?

If data rates allow, use shared mode. Shared mode forces the card to program flash from the cards internal RAM buffers each time chip select is raised.

Reduction in SPI data rate?

I don't understand this question.

Pullups on SPI data lines?

I use sockets with 10k pullups.

Any specific SdFat usage recommendations, such as pre-allocation etc?

See above.

Any specific FAT32 or exFAT usage recommendations?

Either is OK. FAT32 is limited in file size but you should not write huge files.

Any other recommendations for high reliability which come to mind?

Testing is key to reliability. If possible build several systems and test with faster rates.

Edit: For SD cards on SPI, all modern cards have sufficient performance. Don't pay for high end cards that are for 4K video.

from sdfat.

ha11otronix avatar ha11otronix commented on July 17, 2024

Very interesting things discussed here. I was also curious about the similar thing.

@greiman you mentioned about

For a long term applications like this I would use a design that does not create or extend files. I would avoid using timestamps in directories. This would avoid any corruption of directories or the file allocation table

So what I want to do is everytime my system reboots I want to create a new directory and inside that one I have multiple log files say with fixed number of lines of the data. Like each log file has 10K number of lines. So this approach is what you think may result in corruption of directories in file allocation table?

from sdfat.

greiman avatar greiman commented on July 17, 2024

The main way a FAT file system is corrupted is when a crash happen during directory update or cluster allocation.

FAT and exFAT were not designed to be crash safe. Some Linux systems are better but the best way is a journaling file system.

https://en.wikipedia.org/wiki/Journaling_file_system

https://pages.cs.wisc.edu/~remzi/OSTEP/file-journaling.pdf

So avoiding crashes is the best approach.

from sdfat.

ha11otronix avatar ha11otronix commented on July 17, 2024

This two file system is very first time for me. And I think not stright to implement that's why do not heard about that or have any library supporting the same in arduino.

from sdfat.

greiman avatar greiman commented on July 17, 2024

Journaling file systems are complex to implement. FAT/exFAT is not good base for such a file system.

Arduino is a not suitable for building a reliable system if crashes are possible. Arduino could never be certified for safety critical use.

Here is the kind of system that can be safe. I was involved with its early development in the late 1980s.

from sdfat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.