ERROR: Could not open file : DISK_ERR #4773
Replies: 1 comment
-
Posted at 2015-06-09 by @gfwilliams That's a strange one. When you get DISK_ERR, can do do anything (eg. list files) or is it totally dead? Are you sure it's not that something is using the pin for something else, or even potentially a wiring issue? Calling To detect it, I think you could check for Posted at 2015-06-09 by net-tobi Everything is working well for the most of the time. Sometimes this error comes up and then I can't do anything with files before I set the SPI settings again. Can it be a problem with the SD card itself? The wiring seems to be ok for me. Posted at 2015-06-09 by @gfwilliams I guess it's possible. Hard to say - I don't think anyone else has had this kind of issue. Is anything else connected to the 3.3v line? If the voltage on it is unstable, that could throw off your SD card I guess? Posted at 2015-06-09 by net-tobi The reader needs 5V, so it's connected through a regulator with the battery. Posted at 2015-06-09 by @gfwilliams Ahh - is it one of those with circuitry to change the voltage levels on? I've only ever really connected directly so I guess that could be a problem - after all, the Espruino is only giving out 3.3v signals so if it's expecting 5v it could be unreliable? Posted at 2015-06-09 by net-tobi It is a little bit strange. When I upload the code and write save() in the console. Everything is working well. But when I call reset(); and load(); then I get DISK_ERR, but not directly. I do the following:
In the code.js there are subsequent file access routines. Posted at 2015-06-09 by @gfwilliams Ahh, ok - that could maybe be related to software SPI. You need to call Posted at 2015-06-09 by net-tobi Hmm... I call it from onInit as you can see in the code above. Posted at 2015-06-10 by net-tobi Sorted it out. But I am not happy with the solution. The problem was Serial1. The sim900 board was sending some bytes while the interpreter was executing some code. Unfortunately the bytes haven't been sent just to USB. It has been sent to the interpreter as well, which was confusing the code execution. This code piece in onInit() did it:
As well after some time this code piece produces the following warning:
Unfortunately I soldered the wires for connecting the sim900 to the Serial1 pins. Is there a way to set Serial2 to be the default fallback serial port when USB is not connected (maybe in some build parameters for the firmware)? I would be happy with disabling this feature totally as well. Best, Tobias Posted at 2015-06-10 by @gfwilliams That's kind of strange - if the device boots when not connected to USB, if you set the console just once in But yes, if you're building your own binary it's pretty easy to change the default serial port - the lines you need to change are here Posted at 2015-06-10 by net-tobi If I use the device just without USB it seems to be working (I am not 100% sure because I can't see any logs) but when it is connected I get the DISK_ERR and some weird characters in the console. You told me that USB.setConsole() in onInit should do it. But this didn't help. With the lines above this problems are not coming up. Did you see the warning message I put in the update of my post? Why does that come up after a while? Best, Tobias Posted at 2015-06-10 by net-tobi UPDATE: I had a question regarding the build process here. Forget about this post. I use vagrant now. Posted at 2015-06-10 by net-tobi I created my own build now for solving the Serial1 problem. As well I experienced that the DISK_ERR is not related to this line (beside the other problem I had):
I am currently able to solve it by just setting some interval. The following line helps as well:
Do you think it could be a problem with the software SPI when the Espruino goes in sleep mode? UPDATE: Is there a possibility to set the SD card settings in the build settings for the Pico as well? I saw there is a DEVICES section in the script for the regular Espruino. Can I use that in the script for the pico for the SD card as well? Posted at 2015-06-10 by @gfwilliams
Are you using
Well, that's telling you you're out of memory - but you're saying you don't get that without the I guess the only possibility there is that LoopbackA loops characters back to LoopbackB, which then stores (up to 512) of them. Any more get dropped off the end. If you were very short on memory I guess those extra 512 chars could cause you problems? Posted at 2015-06-10 by net-tobi Okay I'll make sure that it doesn't use deepSleep. Have you read my update regarding the build settings for the SD card under the post as well? What's the difference between setConsole(Serial) and Serial.setConsole() ? Posted at 2015-06-10 by @gfwilliams
Sorry, I missed the SD card question...
Yes, then you won't need To use it, just copy the SD card lines you'd have seen for the original board and change them as needed. Posted at 2015-06-10 by net-tobi Hmm.. it is not working. It states "ERROR: Unable to mount SD card : NOT_READY" Posted at 2015-06-10 by @gfwilliams Not sure what to suggest - maybe check in Which pins are you using? Posted at 2015-06-10 by net-tobi I had the following config:
The platform_config.h defines are looking good as well: #define SD_CS_PIN 8/* A8 / Posted at 2015-06-11 by @gfwilliams That is strange then - I really don't know what to suggest. It's not saying anything about the SD card not being configured, just that it can't find the SD? What if you then set up the SD card manually with the Are you sure those pins aren't used for anything else? For instance even initialising I2C3 without any arguments could pick pin A8 and use that. Posted at 2015-06-11 by net-tobi It just shows the message "ERROR: Unable to mount SD card : NOT_READY" nothing else. It is not saying anything about a missing configuration. When I do an E.connectSD it works as in the other build. I checked that I don't use the pins for something else. Is there maybe a parameter that I missed in the build settings? Posted at 2015-06-11 by @gfwilliams As far as I can see it should be fine - the relevant code is here However I notice you're using software SPI in your connectSD example - does it still work if you use hardware with:
and what if you try:
My only guess right now is that there might be some issue with the wiring/SD card and the speed of communication. Software SPI might happen to be the right speed, but if there are pauses in it because of interrupts/etc then that might confuse the SD card and would account for your unreliability. Posted at 2015-06-11 by net-tobi I solved the problem !!!! I didn't see that I swapped MISO and MOSI in my wiring... I saw it in the code that there must be something wrong. :) The strange thing is that it worked with
but not with
Thank you so much for your patience and for your help Gordon! Posted at 2015-06-11 by DrAzzy This should have thrown an error saying that the pins were not capable of that: SPI2.setup({mosi:B14,miso:B15,sck:B13}); Posted at 2015-06-11 by net-tobi Yes the command you mentioned did that. Using var spi = new SPI(); instead worked for some reason with the swapped MISO / MOSI settings... I changed my wiring, so now it perfectly works with SPI2.setup(...) Posted at 2015-06-12 by @gfwilliams Yes, it probably did - but when put into the firmware I guess it wouldn't have come up with any errors! :) @net-tobi when you use |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2015-06-09 by net-tobi
Hello,
I connected a SD card reader module to the Pico. I set it up the following way:
var spi = new SPI();
spi.setup({mosi:B14,miso:B15,sck:B13});
E.connectSDCard(spi, A8);
I experience in some situations that I receive "ERROR: Could not open file : DISK_ERR" errors for files that are definitely existing. After receiving the error message I have to set the above mentioned settings again to do subsequent file access.
What can cause this error? How can I handle it, so that my software automatically sets the configuration again when it got lost? I thought it could be a problem with E.unmountSD(), so I removed all unmounts in my code, but that didn't work.
Best,
Tobias
Beta Was this translation helpful? Give feedback.
All reactions