Skip to content

Finalize and add SD device test #5403

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 tasks done
devyte opened this issue Nov 30, 2018 · 2 comments
Open
5 tasks done

Finalize and add SD device test #5403

devyte opened this issue Nov 30, 2018 · 2 comments
Assignees

Comments

@devyte
Copy link
Collaborator

devyte commented Nov 30, 2018

Basic Infos

  • This issue complies with the issue POLICY doc.
  • I have read the documentation at readthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • I have filled out all fields below.

Platform

  • Hardware: All
  • Core Version: latest git
  • Development Env: All
  • Operating System: All

Problem Description

From #4444 : Sketch below to test SD on device.
Possibly add to devices test, similar to @d-a-v 's interactive WiFi test sketch, maybe add more actions.

MCVE Sketch

Steps:

Send m to mount
Send u and y to unmount
Send m to mount again, if SD.end() is commented, you are in a endless "SD initialization failed!" loop.

File myFile;
bool mounted = false;

void setup() {
    Serial.begin(115200);
}

void loop() {
    if (mounted && Serial.peek() == 'u') {
        Serial.read();
        Serial.println("Unmount SD and press 'y' to continue");
        while (Serial.peek() != 'y') {
            delay(1000);
        }
        mounted = false;
        Serial.println("SD unmounted.");
        Serial.read();
    } else if (!mounted && Serial.peek() == 'm') {
        Serial.read();

        //Uncomment this to finish while (!SD.begin(D2)) endless loop
        //SD.end();

        while (!SD.begin(D2)) {
            Serial.println("SD initialization failed!");
            delay(1000);
        }
        mounted = true;
        Serial.println("Initialization succeded!");
    }

    if (mounted) {
        myFile = SD.open("test.txt");
        Serial.println("Printing test.txt contents:");
        while (myFile.available()) {
            Serial.write(myFile.read());
        }
        myFile.close();
        Serial.println();
        Serial.println("All contents of test.txt printed!");

        Serial.println("SD mounted, press 'u' to unmount");
    } else {
        Serial.println("SD unmounted, press 'm' to mount");

    }

    Serial.println("Wait 3 seconds...");
    delay(3000);
}
@devyte devyte added type: enhancement help wanted Help needed from the community good first issue If you want to help, this is is a good place to start labels Nov 30, 2018
@devyte devyte removed good first issue If you want to help, this is is a good place to start help wanted Help needed from the community labels Dec 29, 2018
@devyte
Copy link
Collaborator Author

devyte commented Dec 29, 2018

@earlephilhower assigning to you as part of your ongoing FS work.

@earlephilhower
Copy link
Collaborator

Link to #5525. Not sure what exactly the request it, but we are doing host tests already, might want to add a "change SD card" host test as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants