Hello,
Is it possible that the SD I/O libraries for the Sakura have a bug for writing right now? It seems that we only get files filled with wrong characters and even corrupt files at the moment.
The codes for writing in our specific case have not been changed, but the output is changed dramatically. (as of 9-1-2018 for as far as we know)
-美月
Hello JB, I have since uploaded the example program and that one gives problems too. It can be read by the Sakura before it is close();'d, but after that I can't read it back on PC. Is it perhaps known whether there are demands for certain cluster sizes, SD card sizes or anything? I do know about the 8.3 names requirement. As for saving within my project, does it give problems if I first manually SD.flush(); and then SD.close();, since SD.close(); flushes as well? The reference does not mention anything about it not being allowed.
Quick update: I just removed the SD.flush(); attempt to make it work and it stillproduces a file that cannot be opened on a PC. This also means that the file is not read by the Sakura.
Hello JB,
In my last message I told that I tried the demo program and that the data in it cant be read back on a PC (which is a requirement, by the way). I have since tried some more things, and at the moment I can write a file ..sometimes. When I try opening a file, it will not always do it. Generally, from the 2nd attempt on it will succesfully open a file for writing. Once, it worked the first time, but it produced a file of nearly 4GB, that was 0B when I tried to delete it.
I will post my piece of code below. Note that I changed variable names.
if (SD.exists("filename.txt") && !xOnlyDeleteOnce){ SD.remove("filename.txt"); xOnlyDeleteOnce = true; } fileVar = SD.open("filename.txt", FILE_WRITE); if (fileVar) {fileVar.print(intVar1); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar2); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar3); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar4); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar5); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar6); delay(5);fileVar.print(","); delay(5);fileVar.print(floatVar1, 2); // print two decimal places delay(5);fileVar.print(","); delay(5);fileVar.print(floatVar2, 2); // print two decimal places delay(5);fileVar.println(","); // Ends line and inserts cr/lf delay(5); delay(300); //@TODO test this -> didn't workfileVar.close(); Serial.println("Done writing!"); } else { errorFlag = true; errorCode = 11; } // This is followed by if (!fileVar) { //code to return to main scenario }
if (SD.exists("filename.txt") && !xOnlyDeleteOnce){ SD.remove("filename.txt"); xOnlyDeleteOnce = true; }
fileVar = SD.open("filename.txt", FILE_WRITE);
if (fileVar) {fileVar.print(intVar1); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar2); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar3); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar4); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar5); delay(5);fileVar.print(","); delay(5);fileVar.print(intVar6); delay(5);fileVar.print(","); delay(5);fileVar.print(floatVar1, 2); // print two decimal places delay(5);fileVar.print(","); delay(5);fileVar.print(floatVar2, 2); // print two decimal places delay(5);fileVar.println(","); // Ends line and inserts cr/lf delay(5); delay(300); //@TODO test this -> didn't workfileVar.close(); Serial.println("Done writing!"); } else { errorFlag = true; errorCode = 11; }
// This is followed by
if (!fileVar) { //code to return to main scenario }
I hope that you, or anyone else, can help me fix this problem
Ok. There is no description in libraries. The version is only described template name or default sketch as below.
If you could, try the latest version V2.20 downloadable at GR-SAKURA web. http://gadget.renesas.com/en/product/sakura.html
Note that the projects can be used with e2studio V5.4, not for V6.x.