Open Pezmc opened 9 years ago
Hi,
Well done investigating this thus far. Unfortunately I think your test script is maybe a little too simple; you're writing to the file on the SD card, but you're never actually verifying that it was written. To really check that the card was working, I think you need to write quite a bit more data to it, and then check the size of the written file (the original sketch does this by seeking to 0 and then using the size()
method), and even potentially start reading from it and printing the data that way, rather than just printing it as it gets written.
Another factor that would be useful is knowing which version of the Arduino IDE you're using; I have a hunch that some of the issues we've seen in the past might relate to specific versions. For what it's worth, when I was developing I tended to use 1.0.5 and seemed to have a lot of success with that - might be worth trying with that version?
Hey lazyatom,
The file's definitely being written (was checking by reading the microsd with a usb adapter) but I agree the test could be more thorough! I'll add your suggestions (and anything else I can think of such as making web requests now and then perhaps, and writing 9185 bytes to it to match size the web response) when I get a free moment in the working week!
I was using 1.0.5 but was hitting the error so upgraded to 1.0.6, can rollback and try again with 1.0.5.
Thank you for your pointers!
I think I've demonstrated that either:
Does anyone mind trying it with their Arduino and reporting back?
New Test Script: https://gist.github.com/Pezmc/7862e20d9dd952993f64
Output with 1.0.6:
Initializing SD card...card initialized.
Setting up network
Got ethernet
IP: 192.168.2.2
Deleted Log.txt
Total (bytes) written to Log.txt was 9185
All went well so trying to download google.com
Connected
Failed to write to SD card: Go.html
Trying to write again now the client is stopped
The test with the client stopped failed to create: Go.html
Trying again in 5 seconds
Deleted Log.txt
Total (bytes) written to Log.txt was 9185
All went well so trying to download google.com
Connected
Failed to write to SD card: Go.html
Trying to write again now the client is stopped
The test with the client stopped failed to create: Go.html
Trying again in 5 seconds
Deleted Log.txt
... It stalled and never got any further than this ...
Output with 1.0.5:
Initializing SD card...card initialized.
Setting up network
Got ethernet
IP: 192.168.2.2
Deleted Log.txt
Log.txt was 0
All went well so trying to download google.com
Connected
Failed to write to SD card: Go.html
Trying to write again now the client is stopped
The test with the client stopped failed to create: Go.html
Trying again in 5 seconds
Log.txt
Log.txt was 0
All went well so trying to download google.com
Connected
Failed to write to SD card: Go.html
Trying to write again now the client is stopped
The test with the client stopped failed to create: Go.html
Trying again in 5 seconds
Log.txt
Log.txt was 0
AllR+¥
±¥é¥¹SD card...card initialized.
Setting up network
Got ethernet
IP: 192.168.2.2
Deleted Log.txt
Total (bytes) written to Log.txt was 33686018
All went well so trying to download google.com
Connected
Failed to write to SD card: Go.html
Trying to write again now the client is stopped
The test with the client stopped failed to create: Go.html
Trying again in 5 seconds
Deleted Log.txt
Total (bytes) written to Log.txt was 33686018
Output with 1.5.7:
Initializing SD card...card initialized.
Setting up network
Got ethernet
IP: 192.168.2.2
Deleted Log.txt
Failed to write to SD card: Log.txt
Trying again in 5 seconds
Deleted Log.txt
Failed to write to SD card: Log.txt
Trying again in 5 seconds
Deleted Log.txt
Failed to write to SD card: Log.txt
Trying again in 5 seconds
Deleted Log.txt
Failed to write to SD card: Log.txt
Trying again in 5 seconds
Deleted Log.txt
Failed to write to SD card: Log.txt
Hi @Pezmc,
did you find a solution ?
I get the exact same error :/
Regards,
Julien
Hi Julien, no I was never able to track down the exact issue, even with several days worth of tweaking!
Hi @Pezmc,
So you just abandoned the idea of doing this project or did you use another sd card or an other ethernet shield ?
Really sad to not be able to work this out :(
Was playing with this at the weekend and never got it to work reliably, the cache file written as
cache.write(client.read());
is always 0 bytes long.I started wondering if this was my SD or ethernet board behaving weirdly so adapted a small test script that seems to run fine (see below).
Do you have any other suggestions as to what might be causing the problem? We tried removing the debouncing to reduce the flash memory usage below 30,000 but that didn't seem to help either
This is on an Arduino Uni with the Ethernet Shield and a 1gb/2gb/16gb microsd card (see the same issue with all three cards), have also tried formatting to Fat16 and Fat32 using various rools.
Test program which checks the card is working:
Output from test program:
Output from printer program in debug mode: