Binaries with "fs" SD card support NEEDED!!! #5627
Replies: 1 comment
-
Posted at 2016-09-05 by Wilberforce If I recall there was one line change required to get this to compile. You could try @jumjum online firmware builder, and turn on the fs module in the compile. Posted at 2016-09-05 by ManoBiletsky Thank you for your reply, I have looked but i don"t see the "fs" module there. Is it maybe named differently? Also you can add extensions to the firmware, but where would i find those? Posted at 2016-09-06 by Spocki Module fs depends on module E (for SD card management). The physical SD card has to be connected by ie SPI. Posted at 2016-09-12 by Wilberforce @ManoBiletsky To compile:
This change is also needed as the macro fails:
I've not tested with an SD card - however the modules loads!
Attachments: Posted at 2016-09-12 by ManoBiletsky Thank you so much! I will test it today. Posted at 2016-09-12 by ManoBiletsky a couple of questions: I upload the binaries with esptool? Posted at 2016-09-12 by Wilberforce @ManoBiletsky Yes upload the .bin files with esptool - like you did for the initial firmware. The block depends on which esp8266 board you have - just do what you did last time... As far as code changes - you will need to initialize the spi to however you have wired up the sd card. Posted at 2016-09-12 by ManoBiletsky Ah i see. i will give it a try. and i'll post my results here. Thanks again Posted at 2016-09-13 by ManoBiletsky Next problem.... with my initial upload i followed a tutorial on the espruino main site. There it said to flash using this line;
however there is no user2.bin in this line. So how do i figure out what location i must flash it to? Posted at 2016-09-13 by Wilberforce Just flash the user1. User2 is used for ota(over the air) updates. Posted at 2016-09-13 by ManoBiletsky hahaha, i just figured it out 30 seconds ago. Thanks anyway. when i try to compile/send .js script, i still get the fs library not found error. Posted at 2016-09-13 by Wilberforce The code posted above was changed needed in the c code to compile... Not related If you see v186.113 then you have the updated firmware. Ignore the warning about the missing module - it is because the normal esp8266 does not have the module and the web Ide doesn't know it is available. On the right hand side of the ide try:
You should see the 2nd line if the module loaded rather than Posted at 2016-09-13 by ManoBiletsky Indeed! it works. SD card not running yet. still figuring out what code to use. Ill keep you posted! thanks again! Posted at 2016-09-13 by ManoBiletsky this is my code:
but the output i am getting from the terminal window:
Posted at 2016-09-13 by @gfwilliams If you get Posted at 2016-09-13 by Wilberforce Have a look here: The Posted at 2016-09-13 by ManoBiletsky I tried changing the pin designation, but i get no change at all. When i change the CS pin to pin 5 i get no "sd card" error except 'connection lost' in the terminal window. i tried every possible pin combination. with and without the Nodemcu.D.. my wiring is correct because i have used the sd card in the arduino IDE and that works just fine. Posted at 2016-09-13 by @gfwilliams You could try software SPI:
You'd have to play with the pins too. Note that it's Posted at 2016-09-13 by ManoBiletsky using this:
i still get the same output:
Posted at 2016-09-13 by @gfwilliams Why did you swap the order of the lines around? Try:
it might help... Posted at 2016-09-13 by ManoBiletsky I allready tried that first. And i tried again to be shure just now.
Posted at 2016-09-14 by Wilberforce I think you need to simplify here. Forgot about the oninit() and wifi stuff. You want to get the simple case of the spi and init of the sd card sorted. Posted at 2016-09-14 by @gfwilliams I also notice you swapped the SPI pins around at some point:
Posted at 2016-09-14 by JumJum I also tried to get sdcard running with ESP8266.
Running this I got a reset about 2 secs later.
Running script above again error log and stackdump was sent to my terminal. This included information about the location where error occured. Posted at 2016-09-14 by Wilberforce Please take a picture of your wiring and do a table like this: http://forum.espruino.com/comments/12997920/
As you can see here NodeMCU.D7 is gpio13 I don't think your init it matching how you have wired up. Posted at 2016-09-15 by @gfwilliams If you don't want to use I guess it's possible that the SD card code took a while to execute and that caused a watchdog timer to reset the board? It shouldn't really take that long to initialise though... Posted at 2016-09-15 by ManoBiletsky I found, that when i change my CS pin to NodeMCU.D5 instead of the (accually) used D4, i get a 'Connection lost' error. When i use D4 i get 'SD card not found!' I use MOSI GPIO13, MISO GPIO12 and SCK GPIO14. Anyone knows the NodeMCU.Dx replacement for GPIO12? I guess it is D6 but not sure... Posted at 2016-09-15 by JumJum try this and you will see
Posted at 2016-09-15 by ManoBiletsky Ah, that worked great! Seems i got my pin assignments correct.
Posted at 2016-09-15 by Wilberforce Are you still trying to do this in an oninit() function, or are you trying the simple case? You should be able to paste the setup stuff directly into the left side of the ide Posted at 2016-09-15 by ManoBiletsky I tried both. But in the first place i always try to copy-paste-enter it line by line in the left terminal frame.
Posted at 2016-09-16 by JumJum I had same problem, after switching from D2 to GPIO15(hardware and software) NOT_READY went away, but then ESP8266 crashed during reading boot sector. Posted at 2016-09-17 by ManoBiletsky I tried the software SPI again and removed the "NodeMCU." before the pin. Like this:
And then i get this output. Maybe this says something to anyone?
Also with the Hardware SPI example, SPI1 is used. int the documentation it says that there should be options for SPI1,SPI2 and SPI3. Can it be that i should use the SPI2, because of the flash memory beeing attached to SPI1? Posted at 2016-09-17 by Wilberforce Please take a picture and document your wiring, otherwise this is just guess work. Posted at 2016-09-17 by ManoBiletsky See the attached schematic. Attachments: Posted at 2016-09-17 by ManoBiletsky I know my wiring is correct because i allready had it working with code from the Arduino IDE. I can't show you the wiring because it is on a pcb. There are no wires. (Look ma! No wires :) ) Posted at 2016-09-18 by Wilberforce @ManoBiletsky So looks like it is wired:
It looks like it should work ok. The SD card has been formatted with the correct File system? Posted at 2016-09-19 by ManoBiletsky Indeed! it was formatted as FAT16 before and later formatted as FAT32. Posted at 2017-01-02 by hartmut After 6 weeks of occasional tries I got my sdcard working, yeah! I confirm the "Fatal exception 9" of @jumjum in check_fs-function of libs/filesystem/fat_sd/ff.c in this line:
Espruino uses the FatFs lib of ChaN in version R0.10a. ChaN has a later version (http://elm-chan.org/fsw/ff/archives.html) which seem to be compatible and includes some bug fixes. One of them ist mentioned in the Changelog: "Fixed a potential problem of FAT access that can appear on disk error." The crashes were gone with the later version R0.10c. I have not testet it thoroughly yet, but it looks promising. Here is my small test code which was crashing the esp8266, and now it is printing the directory content as expected:
For this is my first post here, I want to thank @gfwilliams and all community members for the great work! I'm convinced that Espruino is the best platform for learning how to program microcontrollers these days, as long as you don't use a not officially supported device and experiment with sophisticated features which are not compiled in by default. ;-) Posted at 2017-01-03 by Wilberforce So you had to update the espruino source with the updated fs library? Is this on github, it would be great to do a pull request so this can be brought back into the project! Posted at 2017-01-05 by hartmut It's not yet on github. I give it a try... Attachments: Posted at 2017-01-09 by hartmut @wilberforce Sorry for the delay! Finally I've prepared the suggested pull request for you, but sadly my lib upgrade doesn't repair the esp8266 build by itself like I thought it would. By simply overwriting all files with the updated library, the esp8266 build worked. For the pull request I tried to carefully to adopt all changes from the espruino configuration to the new library, which results in a crash in fs.readdir() on esp8266. The real reason for the crashes on esp8266 lies in libs/filesystem/fat_sd/ffconf.h. For esp8266, the #define _WORD_ACCESS must be set to zero, maybe because of alignment restrictions on the LX106. Maybe someone more experienced than me is able to wrap the define _WORD_ACCESS 0 with an ifdef ESP8266_BOARD? Posted at 2017-01-10 by Wilberforce Thanks. I saw the pull request on github. Some of the esp memory reads need to be on four byte boundaries, so perhaps this is what is going on? Did you try on a later version of the library, it looks like it is up to version 13, rather than 10c? Posted at 2017-01-10 by hartmut No. I had two objectives, getting my sdcard in esp8266 to work and keeping the changes as small as possible to ease the integration in Espruino. The API of versions >10 was changed or rather expanded (f_findfirst(), f_findnext(), f_findclose(), f_expand(), changed behavior of f_readdir(), f_rename() and f_lseek(), added codepages, added exFAT). On the other side, the problematic option _WORD_ACCESS was removed in Version 12. ;-) I would try to integrate the latest version in Expruino, but I'm not very skilled in C/Makefiles/filesystems. Do you have the time to check my results? Did anyone request the extra features of later versions so far? Is there enough space left in the official devices? Posted at 2017-01-11 by Wilberforce Thanks - it looks like a Gordon has merged the changes on github. I'm currently working with @jumjum porting espruino to the esp32, which has much more resources. I'm looking at integrating the i2c and spi libs at present, so this work you have done with sd cards will be useful. There is a native virtual file system with the esp-idf, however the espruino implemention should sit on top of the spi code and just work. Posted at 2017-01-11 by hartmut Thats good news, @wilberforce! Do you know when your spi code will be mature enough for testing with my esp32? Posted at 2017-01-11 by Wilberforce No, it's a work in progress. And given that I don't have a carrier for an sdk card and only a breadboard I would heave to cobble the hardware together, making another possible failer point ! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2016-09-05 by ManoBiletsky
I am desperately looking for help!
I just started using Espruino on the ESP8266 modules. Everything went as smooth as butter, but i keep getting error messages like "module "fs" not found.
After searching on the internet i found a post that said, that there is a possibility that these libraries are not available in the esp8266-espruino binaries and that you have to build/compile them yourself with the needed libraries.
That post was 1 year old and i wondered if this is still the case, and if someone has binaries that allready contain SD/uSD support.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions