Skip to content
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

sd card total size and used size #686

Open
MungoBerry opened this issue Mar 8, 2023 · 0 comments
Open

sd card total size and used size #686

MungoBerry opened this issue Mar 8, 2023 · 0 comments

Comments

@MungoBerry
Copy link

Hi,

I'm using a teensy 3.5 with Arduino 1.8.19 and teensyduino 1.57.

The following code works under 1.56 but returns 0 with 1.57:

#include <SD.h>

void setup()
{
	Serial.begin(9600);
	
	if ( ! SD.sdfs.begin(SdioConfig(DMA_SDIO)) )
		Serial.println("unable to init SD!");
	else
	{
		uint32_t sizeInKb = (uint32_t)((SD.totalSize() - SD.usedSize()) / 1000);
		Serial.printf("SD available space is %" PRIu32 "Kb\n", sizeInKb);
	}
}

void loop()
{
	yield();
}

SD.totalSize and SD.usedSize both returns 0.
There are some small changes in SD.h and SD.cpp between versions but I was unable to fix it!

Finally, may I ask:

  • why I need to specify "Serial.begin(9600);" with 1.57 to see output ? Version 1.56 do not need it.
  • is teensyduino version specified as define somewhere ? I would to put it inside my program.

Thank you.

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

No branches or pull requests

1 participant