Avatar for hartmut

hartmut

Member since Jan 2017 • Last active Feb 2017
  • 0 conversations
  • 5 comments

Most recent activity

  • in ESP8266
    Avatar for hartmut

    Thats good news, @Wilberforce! Do you know when your spi code will be mature enough for testing with my esp32?

  • in ESP8266
    Avatar for 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?

  • in ESP8266
    Avatar for 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?

  • in ESP8266
    Avatar for hartmut

    It's not yet on github. I give it a try...
    I attached my firmware for those who have the patience of myself...

  • in ESP8266
    Avatar for 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:

    if ((LD_DWORD(&fs->win[BS_FilSysType]) & 0xFFFFFF) == 0x544146)         /* Check "FAT" string */
    

    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:

    var fs = require('fs');
    SPI1.setup({sck:D14, miso:D12, mosi:D13});
    SPI1.setup();
    E.connectSDCard(SPI1, D15);
    var e = require("ESP8266");
    e.setLog(2);
    console.log(fs.readdir("/"));
    

    For this is my first post here, I want to thank @Gordon 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. ;-)

Actions