delete data from flash in MDBT42?

Posted on
  • Hello ,
    as I understadn I can use about 40kb~ of memory in the MDBT42
    I have code that save into RAM and then move it to the flash

       GetData = JSON.parse(require("Storage").read("test­"));
       console.log("Clear Array finsih");
       console.log(    ScanResault.length);        

    I can see the RAM is clear without a problem
    then I send this information to another devcie and after a while I want to clear the flahs
    but I'm unable to do this
    this is the command I'm using :


    but it doesn't work


  • Using require("Storage").erase("test"); sounds absolutely fine. When you say 'doesn't work' what do you mean? It just doesn't appear to get rid of the file, or it gives you an error?

    Are you using firmware 2v05?

  • doesn't get rid of the file

    just to be sure - wher do I see the version?

  • wher do I see the version?

    If you just type reset() on the left hand side of the IDE you should see it under the logo - or process.env will tell you too.

  • VERSION: "2v04", GIT_COMMIT: "3956264e", BOARD: "MDBT42Q",
    FLASH: 524288, RAM: 65536, SERIAL: "3700071-fa641234", CONSOLE:
    "Serial1", MODULES: "Flash,Storage,hea" ... "S,crypto,neopixel",
    EXPTR: 536882364 }

    var res=process.memory();
     console.log("Memory free - " +;
       GetData = JSON.parse(require("Storage").read("Test­"));
       console.log("Clear Array finsih");

    when I run the code
    I get error that

    Uncaught Error: Unable to find or create file
     at line 35 col 63
    in function called from system

    but when I run list I can see the file


    maybe this is my problem?

    and how could it be ?

  • As a first step, please could you try installing up to date firmware? Looks like you're on 2v04 and there is 2v05 which has a fix for some storage related issues

  • I need to be neat the device fot this - I see
    I will do it latter and let you know
    thank you Gordon !

  • sorry, the firmware update has failed.

    The error was: TypeError: Failed to execute 'requestDevice' on
    'Bluetooth': required member filters is undefined.

    Please try again, or check out the Troubleshooting page for what to do

    I download the zip file -
    in the IDE selected
    Advanced Firmware Update
    selected the file
    did what the message said
    now the device red led is on
    but I still get the error
    what is wrong?

  • Are you on Mac OS? Please could you try uploading firmware using the instructions at­-updates (so using the nRF Connect app on Android/iOS instead)

  • Using WIndows7
    don't have MAC or android device here

  • Windows 7 doesn't even support Web Bluetooth I'm afraid, so the firmware updater built into the IDE won't work.

    Do you have an iOS device available? Or do you have no smartphone/tablet that can be used at all?

  • yes I do
    tablet with android 7 - will this works?

    I have also have a computer with win10 - better?

  • tablet with android 7 - will this works?

    Yes, that'd be perfect. Just use that to do firmware updates.

    I have also have a computer with win10 - better?

    That would be better for doing development, as you could use the online IDE at

    However for firmware updates the Android devices are actually faster

  • OK
    update the firmware to 2.05
    now how to continue?


  • Try require("Storage").eraseAll() to clear Storage to a fresh state - then see if you still have the problem?

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

delete data from flash in MDBT42?

Posted by Avatar for David1234321 @David1234321