• Firmware Version: 2v11.251
    I just plugged my BangleJS2 into my computer after letting the battery drain after about a week of use(was polling from the pressure sensor, so I'd figure battery isn't going to last the whole 4).

    However, shortly after plugging it in I glanced down at the watch as I had noticed it was on the setup screen on the last step which told me to press the hardware button to proceed.

    I pressed the button and was brought to Anton Clock and everything had reset, I lost everything.
    I want to see if I can figure out what happened and see if I can help contribute a fix to this. Lucky for me I had my projects I'd worked on backed up and the only annoyance is I have to reinstall everything.

  • I have seen this repeatedly as well. Even without battery drain. Just seems to reset sometimes....

  • Thanks for the report. You're definitely on 2v11 firmware @jerryn?

    If you can find a way to reproduce this at all, please let me know. I believe what is happening is at some point the Bangle.js storage gets corrupted. When Bangle.js fully reboots it checks the Storage over, and if it is corrupted it deletes it and replaces it with the factory default.

    It's debatable whether it should do that of course - maybe it should just put up a menu asking about what to do. At least then we could leave it to we could look and see what was actually wrong with Storage...

    But in an ideal world Storage should never get messed up.

  • @Gordon Thanks for getting back to me. I hope you had a good holiday!
    I was responding mostly to "commiserate" with the orrignal post. In my case, the problem was not tied to battery drain/recharge, but it would just "spontaneously" reload the default apps.
    I'll try to explain what I have seen -- I apologize for not having a a clear reproducible issue.
    Normally I have been loading several apps and widgets - including the IOS integration and messages app. I then pair the watch to my iPhone and it works for a day or two then a few things seem to happen. First, the clock will appear to freeze at some time and when I press the button it restarts, but the time has reverted to GMT (I am at -5). If I then reboot, it reports the memory corrupted and does not even boot. I have to erase all apps and reload. This seems to happen after a few hours to days. For test, about 4 days ago, I just loaded the default apps and it has been running fine ever since. So, I assume there is something in one of the apps I am using that is causing the corruption. I will try to reload them one at at time and see how it goes. I hope some of that makes sense. Let me know if there is something you would like me to try.

  • @Gordon and yes, I am running 2v11

  • Thanks - and you're definitely on 2v11 firmware? It'd be good to know exactly which apps/widgets you have that seem to set this off.

    When it says 'Memory corrupted' if you leave it for a few minutes does it not automatically install the default apps? If not then it may be possible for me to download the contents of your Storage and debug what's going on...

    I guess it's possible it's even the combination of the iOS connection with messages - which will write new messages into Storage all the time.

  • yes regarding 2v11
    I will try adding more apps aver the next few days and see if I can trigger the failure again.

    I have seen a few failure modes. Many time int just reloads the default apps, but there have been time when it just stopped at the first screen and would not boot at all. I realize this is not overly helpful without better information. I'll try to capture it better if I can get it to recur.
    Should I continue post to this thread or would you prefer i start a new one when I have something to share?

  • Thanks - probably best just to post in this thread. It's a really tricky one - as soon as I can find a way to reproduce reliably I should hopefully be able to find out what's wrong pretty quickly.

  • With the default apps:

    Anton Clock
    Health Tracking
    Battery Level Widget
    Bluetooth Widget
    Lock Widget
    Bluetooth ID Widget

    It has been running normally for several days

    Yesterday, I added
    IOS integration and messages — paired with iPhone

    It has been running OK for about 15 hours.... I'll give it another day or so before adding another app.

  • @Gordon a bit more information. After more than a day of running with tit IOS integration and messages it is starting to act up. Frequently, every few hours, I find the watch in a state where the screen is "frozen" with the "loading" box displayed. I have to reboot it to get it back to working normally. This has happened about 4 or five times so far. Now the clock is working, but I am unable to examine any messages and I am unable get it to begin up the apps listing so I can check on them. Pressing the button starts the "loading" box, but it just disappears without showing my apps. In addition, tapping on the screen does not bring up messages even though it indicates messages are present. It does appear that the IOS integration is causing some issue. Is there anything I should do with it in this state before trying to reload it?
    Sometime it gets bit farther, -- I see the app list, but am still unable to actually do anything with them. it just freezes if I try to access an App.
    Now I find that "double tapping" the button gets me into the App listing, usually, and some Apps respond. About is OK, but selecting Messages just freezes when tapped.

    Sorry about the changing comments, but that is how it is evolving...

  • Thanks, that's really interesting. When you're disconnected from the iPhone do you still have the problem?

    If so, please could you disconnect from the iPhone, and connect to the Web IDE on your PC? If you then try entering the launcher/messages app/whatever hopefully there will be some messages displayed on the IDE screen. Please could you copy those and paste them here?

  • It does still happen when disconnected -- here is the WEB IDE output entering Messages

     ____                 _
    |  __|___ ___ ___ _ _|_|___ ___
    |  __|_ -| . |  _| | | |   | . |
    |____|___|  _|_| |___|_|_|_|___|
             |_| espruino.com
     2v11 (c) 2021 G.Williams
    Uncaught SyntaxError: Got EOF expected '­}'
     at line 31 col 346 in messages.app.js
  • Hi,

    I also had a "spontaneous factory reset" once. It was in the beginning of my development of Anton clock. I started with copying it into a new app but garbled the app.json entry. My "antwsclk" overwrote the "antonclk" files on the Bangle as I did not change the file names. After some back and forth, I removed my app and therefore (parts of) Anton clock - which was still the default clock at that moment (I had not understood the concept of "default clock" at that time...).

    However, I locked up the Bangle.js severely and the boot screen talked about "corrupted boot data" or did simply nothing. I left the Bangle alone for some 30 minutes and when I looked at it again, it obviously had performed a factory reset. Stock Anton clock etc.

    I did not see this behaviour again once I corrected my app.json entries. There was another factory reset lateron, but for that I can absolutly not say any suspicious circumstances - it just happened.

    Perhaps this helps more than it sounds...


  • I am hoping that this has been narrowed down to an issue with the IOS messaging. That seems to be the App the starts things going badly.
    I had mine in a really bad state a few weeks ago, but eventually was able to get in via the WEB IDE and delete the corrupted files. It took many tries to get connected, but eventually I think it was just that I had to clear the BLE device from my Mac in order to reconnect. It is nice to be able to recover no matter how confused it gets!

  • @Gordon Was the above error message of any help? Is there any other information you would like me to gather while it is in this state. If not, I will wipe it and reload it to see how it behaves.
    I did dump the messages.app.js file and it appears to be corrupted (attached screenshot showing what I think is the corrupted section). I'm new to this (if you haven't noticed ;-) is I may be mistaken, but this looks odd to me and probably explains the error message since the file cannot be properly parsed.

    Edited to add: In the future, I think I should turn off "Pretokenise" in the App Loader to make things more readable.

    1 Attachment

    • Screen Shot 2022-01-10 at 6.38.18 AM.png
  • @jerryn thanks! That is really useful.

    So... there was an issue in the 2v10 firmware where sometimes the flash memory wouldn't accept a write request (writes happen in blocks of 256 bytes), and that looks exactly like what happened here because exactly 3x256 bytes are unset. However it looks like you're on firmware 2v11 already judging by what you posted above?

    In 2v11 I was pretty sure I fixed that - it checks and rewrites the data up to three times to try and avoid any issues.

    Please could you try the following?

    • Connect with the Web IDE, and run reset(1)
    • Now run require("Storage").eraseAll(); - this will remove everything from the flash memory
    • Now copy and paste the following into the left of the IDE:

      var f = require("Flash"), l = 8*1024*1024;
      var d = new Uint8Array(256);
      for (var i=0;i<l;i+=256) {
      f.write(d, 0x60000000+i);
      var s = E.sum(f.read(256,0x60000000+i));
      if (s) console.log("Data not cleared at "+i+" = "+s);
      if ((i&65535) == 0) console.log("Check "+i);

    It'll take a few minutes to complete (it needs to count all the way to 8 million) but what it's doing is writing zeros to all of flash memory and seeing if it all completes ok. Please can you check if it says anything other than Check ###I just want to rule out there being a problem writing to a particular area of memory first.

    But it seems this is not specifically related to iOS integration. It's just that iOS integration writes the list of messages into flash memory, and that causes a bunch of writes. If those writes fail then there can end up being problems.

  • @Gordon Definitely running 2v11. All checks normal.

    2 Attachments

    • Screen Shot 2022-01-10 at 10.10.43 AM.png
    • Screen Shot 2022-01-10 at 10.07.02 AM.png
  • @Gordon after the above rest and flash test, I tried to reboot and it as stuck in a boot loop -see attached image. I tried reuploading the firmware. That went ok but it is still in the same boot loop.

    I am unable to connect via the web ide or app loader. How can I restore it?

    1 Attachment

    • 418736EA-EFDA-48C1-83E8-0A109B3A68AF.jpeg
  • Hi, thanks for that. It's great that all the checks finished ok. Sorry about this - when I did this I did a factory reset before the reboot, and maybe there are issues if you don't do that.

    You should at least be able to hold down the button until a little progress bar of '====' appears and then you can reflash the firmware. I'm checking on this now - it's possible that having the Storage all set to 0 is causing the firmware to hang (or take too long to boot). I'll let you know what happens.

    If so I'll get a fix in and a new firmware out - and once your load that new firmware it should all be fixed.

  • Thanks! I was able to reflash the firmware with 2v11..I also tried 2v11.12, but then it just went back to the boot loop.
    It looks like it reboots just a bit too quickly for the IDE or App loader to be able to connect.

  • Please can you try uploading firmware now? It should be at 2v11.14 - it'll sit at 'booting...' for a few minutes, but should then come back to defaults.

    I just added some changes that should fix this - the scan for files to load was taking forever because it thought there were 250,000 zero-length files on the flash, and that made it time out the watchdog timer.

    I now make it check the filesystem before it tries to read any files from it, and if it finds zero length files it assumes there's a problem and goes back to factory defaults, so that should fix this.

    Sorry about all the issues - it was stupid of me not to check what happens if it got rebooted in that state. I've updated the instructions to make it less likely this happens to folks in the future now.

  • @Gordon 2v11.14 worked! Thank you and don't worry about the issues. I am learning with each step!

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

Bangle.JS 2 reset itself after battery drain and recharge

Posted by Avatar for MrARM @MrARM