GithubHelp home page GithubHelp logo

sdcard's Introduction

How to Clone

This project uses submodules (ie. GCC4MBED and CppUTest). Cloning therefore requires an extra flag to get all of the necessary code.

git clone --recursive [email protected]:adamgreen/SDCard.git

Overview

This version of the SD card driver was heavily influenced by these previous versions:

Features

  • Robustness - Enables more thorough CRC and error checking and will retry on errors when possible.
  • Performance - Supports multi-block read/write operations to increase throughput along with running the SPI communications at 25MHz.
  • Lower CPU Utilization - Uses a new SPI driver, SPIDma, created just for this project. With this driver it is able to utilize DMA for the transfer of the 512 byte blocks. While these larger reads/writes are taking place, the CPU can be interrupted to run higher priority tasks with no impact on the I/O operations.

SoakTest

The code in the SoakTest/ folder uses an updated SDFileSystem driver to create a file on the root of a SD card and then reads from it at random locations. It continues to perform these random reads, validating the read data as it progresses, until the user sends a key press to stop the test. It can be run for an extended period of time to verify read robustness of the card/driver. It will log about errors that it encounters during the read process. It also dumps some of the core properties of the SD card and a few internal SDFileSystem counters that help me determine how well it is working on different devices.

Important Notes!

  • Backup your data before running this test. This is a beta quality driver with writes enabled so it could inadvertently destroy data by mistake.
  • The pre-built binary has been built to run on the Smoothie v1 hardware.
    • It is built to be loaded into FLASH at an offset of 16K. This makes it compatible with the boot loader typically used with Smoothieboards.
    • This test is configured to communicate with the uSD socket on the Smoothieboard PCB itself.
    • It outputs test progress and results to the serial port. You need to have a FTDI (or similar) cable connected to the 1x6 pin Serial header on the Smoothieboard.
  • To see the test progress and results you should connect your favorite terminal emulator to your SmoothieBoard at 9600-N-8-1.
  • Once the firmware is loaded, press the reset button to start the test running. The user will then be prompted for the size of the test file to use. I tend to pick a value between 1 and 100 (MB).

I would really appreciate it if people could run this test on their SmoothieBoards with various uSD cards that they have and report back their results! The bins/ folder contains a pre-built SoakTest-Smoothie1.bin binary that it is ready to be installed on a SmoothieBoard via its boot loader. It is probably enough to just let it run for a few minutes on the bulk of your cards to see if it gets any failures. It would be great if you could let it run for an extended period of time (ie. overnight) on what you consider to be your most reliable card.

If you encounter failures:

  • Create an issue here on GitHub.
  • Include all of the serial output generated by the test when it was run against the failing card.
  • Describe the card as best as you can (brand, capacity, etc.)
  • Please note if there is anything out of the ordinary with respect to your Smoothieboard setup.

I have already hit an issue with a ADATA 8GB uSD card that I have here. The failure is documented in this GitHub issue.

Thanks for your help! I really appreciate it!

Example output when run on a SanDisk Mobile Ultra 16GB MicroSD HC I card:

SDCard Soak Test
Cleanup from previous test run.

How large should the test file be in MB (100MB is default):
Dumping SD CID register contents.
  CID = 0x03 0x53 0x44 0x53 0x55 0x31 0x36 0x47 0x80 0x13 0x51 0xB0 0xF7 0x00 0xBB 0x6D
          Manufacturer ID: 0x03
                   OEM ID: SD
             Product Name: SU16G
         Product Revision: 8.0
    Product Serial Number: 0x1351B0F7
       Manufacturing Date: November 2011
                 Checksum: 0x36
Dumping SD OCR register contents.
  OCR = 0xC0FF8000
          Card Power Up Status: 1
          Card Capacity Status: 1
            UHS-II Card Status: 0
    Switching to 1.8V Accepted: 0
                    2.7 - 2.8V: 1
                    2.8 - 2.9V: 1
                    2.9 - 3.0V: 1
                    3.0 - 3.1V: 1
                    3.1 - 3.2V: 1
                    3.2 - 3.3V: 1
                    3.3 - 3.4V: 1
                    3.4 - 3.5V: 1
                    3.5 - 3.6V: 1
Dumping SD CSD register contents.
  CSD = 0x40 0x0E 0x00 0x32 0x5B 0x59 0x00 0x00 0x76 0xB2 0x7F 0x80 0x0A 0x40 0x40 0x13
    CSD Version: 2.0
                  Data Read Access-Time: 0x0E (1ms)
    Data Read Access-Time in CLK cycles: 0
                      Max Transfer Rate: 25.0MHz
                  Card Command Class  0: yes
                  Card Command Class  1: no
                  Card Command Class  2: yes
                  Card Command Class  3: no
                  Card Command Class  4: yes
                  Card Command Class  5: yes
                  Card Command Class  6: no
                  Card Command Class  7: yes
                  Card Command Class  8: yes
                  Card Command Class  9: no
                  Card Command Class 10: yes
                  Card Command Class 11: no
             Max Read Data Block Length: 512
        Partial Blocks for Read Allowed: no
               Write Block Misalignment: no
                Read Block Misalignment: no
                        DSR Implemented: no
                            Device Size: 15931539456 bytes
              Erase Single Block Enable: 512 bytes
        Erase Sector Size (SECTOR_SIZE): 128
               Write Protect Group Size: 0
             Write Protect Group Enable: no
                     Write Speed Factor: 4
            Max Write Data Block Length: 512
       Partial Blocks for Write Allowed: no
                      File Format Group: 0
                              Copy Flag: copy
             Permanent Write Protection: 0
             Temporary Write Protection: 0
                            File Format: 0
                                    CRC: 0x09
Creating 10 MB test file...
The following soak test will run until you press a key to stop it.
LED1 will blink while the test is progressing smoothly.
Starting soak test now...
Removing test file.
SD Card Driver Counters
    maximumWaitWhileBusyTime = 23
    maximumWaitForR1ResponseLoopCount = 2
    maximumACMD41LoopTime = 13
    cmd12PaddingByteRequiredCount = 13011
Test Completed!

sdcard's People

Contributors

adamgreen avatar

Watchers

Eric Decker avatar James Cloos avatar

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.