FlashEEPROM timeout while writing

Posted on
  • Hi,

    Did anyone of you experience the same error?

    >var f = new (require("FlashEEPROM"))();
    ={
      "flash": function () { [native code] },
      "addr": 466944, "endAddr": 471040 }
    =undefined
    >f.write(0, "Hello");
    Uncaught InternalError: Timeout on jshFlashWrite
     at line 1 col 62
    ...,a.length,a.length>>8,0]),b);b+=4;4!=a.length&&(c=new Uint8A...
                                  ^
    in function "_write" called from line 2 col 102
    ...ory!";this._write(a.end,b,c)
                                  ^
    in function "write" called from line 1 col 19
    f.write(0, "Hello");
    

    Thanks
    Jens

  • Jens, I assume you entered this in the console pane of the Espruino Web IDE... Doing so may conflict with the sending of the statement(s) / uploading and the execution of them because of the single threaded execution of JavaScript and setup of communication from console to Espruino board and back. Try to paste it in the edit pane and upload the code to the board. If this does not help, place it in a function, upload the function, and then invoke it. Take a look at this conversation. It covers some aspects of what you experience, even thought he conversation title may no read like that to you. Look for the 2 cents posts.

  • @allObjects, Hi I tried all that you suggested and still have the timeout problem (in the web console pane as well as a program). Any other ideas? Funny seems that when I write a string with a specific length and read it afterwards I get a length number ox 0xff - so the length seemed to be stored somehow.

    Thanks
    Jens

  • Jens, what board are you using?

  • A puck.js (received about 1-2 weeks ago) with the 1v90 firmware.

  • Jens, take a look at this conversation about low level flash access. ...may be you already have... ;/

  • Hi @allObjects, Yep, I used the very simple example from @MaBe and that is what I get instead of his output:

    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v90 Copyright 2016 G.Williams
    >{
      "flash": function () { [native code] },
      "addr": 471040, "endAddr": 475136 }
    >Uncaught InternalError: Timeout on jshFlashWrite
     at line 1 col 62
    ...,a.length,a.length>>8,0]),b);b+=4;4!=a.length&&(c=new Uint8A...
                                  ^
    in function "_write" called from line 2 col 102
    ...ory!";this._write(a.end,b,c)
                                  ^
    in function "write" called from line 1 col 26
    f.write(0, 'Hello Flash.');
                             ^
    ÿÿÿÿÿÿÿÿÿÿÿÿ
    =undefined
    >
    
  • ...weird... let me test on my puck(s)... a bit later.

    I suspect that something else is going on while this write is happening... (not from your code, since you just use the bare @MaBe example).

  • That is strange. I just tried on the 1v90.12 build and it works fine for me - but I guess it's possible that there is some corrupted data already in flash.

    Could you try f.erase(); ?

  • Ok, I tried the code below:

    // Tested on Puck.js
    var f = new (require("FlashEEPROM"))();
    f.erase();
    console.log(f);
    f.write(0, 'Hello Flash.');
    console.log(E.toString(f.read(0)));
    

    and got:

    1v90 Copyright 2016 G.Williams
    >Uncaught InternalError: Timeout on jshFlashErasePage
     at line 1 col 31
    this.flash.erasePage(this.addr)
                                  ^
    in function "erase" called from line 1 col 9
    f.erase();
            ^
    {
      "flash": function () { [native code] },
      "addr": 471040, "endAddr": 475136 }
    Uncaught InternalError: Timeout on jshFlashWrite
     at line 1 col 62
    ...,a.length,a.length>>8,0]),b);b+=4;4!=a.length&&(c=new Uint8A...
                                  ^
    in function "_write" called from line 2 col 102
    ...ory!";this._write(a.end,b,c)
                                  ^
    in function "write" called from line 1 col 26
    f.write(0, 'Hello Flash.');
                             ^
    ÿÿÿÿÿÿÿÿÿÿÿÿ
    =undefined
    > 
    

    Am I doing something stupidly wrong or do I have a faulty puck?

    Thanks again

  • That's really interesting - it could be related to some other problems people have been having with saving to flash.

    Have you tried removing the battery from your puck and re-inserting it to power cycle it? It could be that the software has got into a strange state.

  • Ok, after a power cycle the flash worked as expected again. Unfortunately only for a very short time (after 3-5 more flash write attempts it breaks again).

    Hope this can be fixed soon.
    Thanks

  • Interesting - thanks for the update. By 'flash write attempts', what do you mean? From a clean power-on, what exactly did you do to get it to happen?

    I just uploaded that code repeatedly and I can't reproduce it.

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

FlashEEPROM timeout while writing

Posted by Avatar for user71506 @user71506

Actions