problems to load modules from SD card

Posted on
  • Loading existing modules via Web IDE works fine for me but I'm also working on some new modules and I need to test them properly.
    I'm using HY-Mini 3.2" with integrated SD card reader. Card is formatted with FAT32 and for test purposes I'm placing currently available DS18B20.js module in /node_modules directory.
    Then I try to:

    var sensor = require("DS18B20").connect(A1);
    

    After that nothing comes back and terminal stops responding.
    Any ideas how to get that working? Should I somehow initialize SD module before I can use it?

  • Hi graf,

    Are you sure that Espruino can read the SD card? What happens if you type fs.readdir() - this should list all files in the root dir of the card (hopefully returning ["NODE_M~`"]).

    It's possible that the card is in the wrong format for Espruino? I think FAT32 should be fine though.

  • ERROR: Using '.' operator on non-object at line 1 col 3
    fs.readdir()
      ^
    undefined
    

    I should also point out that I'm using nightly build of 1.44 dated at 2013.12.12 as later versions appear to be broken.

  • Sorry, require("fs").readdir()

  • That's the same as with other modules so the cursor goes one line down and terminal stops responding. When I close terminal app and connect again then it is still locked.

  • Can you just try writing require("fs") ? it should just return =function () {}

    If that's the case then can you try a different SD card on it? It could be the filesystem library locks up while trying to read your card.

  • So to sum it up:

    • Board hangs whenever I require any module from the terminal with Micro SD card inserted. When it's not inserted then I get:
      > ERROR: Unable to list files : NO_FILESYSTEM
    • Board hangs only when I require the "fs" module with Web IDE
  • And to answer your last question: yes, it returns with

    =function () {}
    

    I will try to find a different card and try again.

  • Ok, so:

    • require("foo") -> hang
      * require("fs") -> ok
      * require("fs").readdir() -> hang

      I'd be pretty sure it's the way your SD card is formatted, or the size of it. Having said that I've tried up to 16gb cards and they seem to work fine.
  • Gordon thank you very much for your time. You were right it was a problem with this particular card. Tried with a different one and it works fine. You will get a pull request for a new module soon :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

problems to load modules from SD card

Posted by Avatar for graf @graf

Actions