Bangle.js 2 stuck in bootloop. dfu flashing did not help

Posted on
Page
of 2
/ 2
Next
  • My Bangle.js 2 is in a bootloop since this morning.

    I See the bootscreen

    Booting....
    Checking storage...
    Storage OK.

    Booting...
    Checking storage...
    Storage OK.

    And so on.

    I can start the dfu mode and flash a firmware package but after reboot it loops again.

    I can not connect via Bluetooth with App Loader because the connection drops every few seconds.

    Any idea what I can do?

  • try this https://www.espruino.com/Bangle.js2#rese­tting-without-loading-any-code and then the step below it - delete all code

  • Sadly this does not work. Pressing the button keeps continuing the boot loop

  • Button should be released as described, if you still keep holding it then it will reboot.
    If you don't hold it then maybe your button is in fact stuck? See this
    http://forum.espruino.com/conversations/­378516/ Do you see the bootloader ===== line going across the screen even if you don't hold the button? Then it is probably stuck being pressed.

  • The instructions say

    You should now have the Bangle.js logo, version, and MAC address on screen, and you can release the button

    but my watch does not get into this state. It keeps rebooting with "Checking storage...
    Storage OK" and "Watchdog.
    DFU 2v12
    Check storage.
    No new FW.
    Booting...".

    My button is not stuck as I can switch to DFU mode by releasing the button while === are on the screen.

    I already let the battery run flat and charged it but it is still stuck.

  • then maybe try to release button earlier - already when checking storage shows, if it says watchdog then you are holding too long and watchdog reboots it

  • No chance to get between those two messages "Checking storage..." and "Storage OK" - it's like 1ms time between them.

    I tried several times to release the button at various times in the boot loop but no success.

    Maybe @Gordon has an idea what to do here :)

  • Do you have any idea what might have caused this? Did it 'just happen' one day, or were you developing with it?

    Holding the button should really have allowed you to boot to the Bangle logo and reconnect (unless you'd uploaded code that 'runs on reboot' - but that's hard to set up and there are warnings in the IDE).

    You could try installing the attached firmware - it'll use internal flash for Bangle.js rather than external, so might work ok. It'd help narrow down what the issue is - if it's code saved to flash then we might have to try and send some commands to clear out the external flash.


    1 Attachment

  • if it's code saved to flash then we might have to try and send some commands to clear out the external flash

    I now see you removed also the https://github.com/espruino/Espruino/blo­b/master/boards/BANGLEJS2.py#L171 SPIFLASH definition from NOFLASH build. Not sure it can break anything but in my experience with other watches it is harmless to keep it in and it is enough to just not use it in saved_code like you do here https://github.com/espruino/Espruino/blo­b/master/boards/BANGLEJS2_NOFLASH.py#L10­2

    The advantage when keeping SPIFLASH definition there is that while it is not available for require('Storage") you can still access it via require("Flash") so in this case one could read/write/erase it a bit more easily.

  • @Gordon the watch was stuck on friday morning and i reseted it by pressing the button for 6 seconds. It then switched into bootloop mode. I was wearing the watch before and did not upload any code for days.

    The firmware you attached boots!
    Should i stay on this or try to reflash a flash-build again?

  • Should i stay on this or try to reflash a flash-build again?

    With this build the 8MB SPI flash storage with your (broken?) data is unused. If you flash normal build back it will start rebooting again (you can try). You first need somehow to erase the SPI flash to get rid of the stuff that breaks the boot there and then you can go back.

  • You first need somehow to erase the SPI flash to get rid of the stuff that breaks the boot there and then you can go back.

    How do i do this?

  • Well, it is a bit tricky but still doable, you need to send direct spi flash commands like in https://www.microchip.com/forums/m910893­.aspx but I don't have exact line here, needs some experimenting. Maybe @Gordon has the code ready.

    What is easier for me is to enable the SPI flash for Flash API as mentioned in my post #9 and then the js code is easier, basically calling Flash.erasePage() described at https://www.espruino.com/Reference#Flash­ for addresses of external SPI flash which starts at 0x60000000 should do it so if you are adventurous you may try attached build or wait for @Gordon

    with attached build require("Flash").erasePage(0x60000000) should clean first block which should be enough, if not then more blocks can be cleared

    EDIT: attached build removed, newer one is in post below

  • I made another build, there were more lines removed in the NOFLASH build, here is another one with also this line https://github.com/espruino/Espruino/blo­b/master/boards/BANGLEJS2.py#L52 added back

    full change in board file I used is here

    diff --git a/boards/BANGLEJS2_NOFLASH.py b/boards/BANGLEJS2_NOFLASH.py
    index c741b4dd3..0d2424743 100644
    --- a/boards/BANGLEJS2_NOFLASH.py
    +++ b/boards/BANGLEJS2_NOFLASH.py
    @@ -51,6 +51,7 @@ info = {
          'LDFLAGS += -Xlinker --defsym=LD_APP_RAM_BASE=0x2ec0', # set RAM base to match MTU
          'DEFINES += -DESPR_DCDC_ENABLE=1', # Use DC/DC converter
          'ESPR_BLUETOOTH_ANCS=1', # Enable ANCS (Apple notifications) support
    +     'DEFINES += -DSPIFLASH_SLEEP_CMD', # SPI flash needs to be explicitly slept and woken up
          'DEFINES += -DAPP_TIMER_OP_QUEUE_SIZE=6', # Bangle.js accelerometer poll handler needs something else in queue size
          'DEFINES+=-DBLUETOOTH_NAME_PREFIX=\'"Ban­gle.js"\'',
          'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_ban­glejs_getBattery',
    @@ -162,7 +163,17 @@ devices = {
                 'addr' : 0x76, # both versions use the same address
                 'pin_sda' : 'D47',
                 'pin_scl' : 'D2'
    -  }
    +  },
    +  'SPIFLASH' : {
    +            'pin_cs' : 'D14',
    +            'pin_sck' : 'D16',
    +            'pin_mosi' : 'D15', # D0
    +            'pin_miso' : 'D13', # D1
    +#            'pin_wp' : 'D', # D2
    +#            'pin_rst' : 'D', # D3
    +            'size' : 4096*2048, # 8MB
    +            'memmap_base' : 0x60000000 # map into the address space (in software)
    +          }
     };
    
     # left-right, or top-bottom order
    

    1 Attachment

  • @fanoush i tried your build and erased that flash page. It worked!

    The Bangle booted with

    Checking storage...
    Storage is corrupt.
    Erasing Storage Area

    and now welcomes me with the welcome screen. I will restore my backup and see if everything works.

    Thank you so far!

  • After almost one day of usage it seems that everything works again as expected and before.

    Thanks again to fanoush and Gordon for the help.

  • Nice that it is working for you again :-)

    However it looks that with some bad luck the watchdog reboot caused by holding the button may break stuff. In this case I guess the reboot was triggered in the middle of flash write and for some reason the check at boot time did not detect this corruption and yet some other code later crashed on such bad data. If that happens again it would be good to have backup of SPI flash storage to reproduce and fix this crash (or maybe it was never ending loop).

    BTW, the watchdog reboot can be delayed a bit by enabling watchdog interrupt but I am not sure that the code handling the interrupt could do something about the pending flash write to avoid such corruption.

  • @myxor have you managed to run require("Flash").erasePage(0x60000000) and return to 'normal' firmware now?

    @fanoush thanks! I've just updated the NOFLASH firmware with those changes.

    This seems particularly rare - but if it happens to anyone again please post up before running require("Flash").erasePage(0x60000000). If I can clone the contents of flash memory and reproduce here I can figure out why it bootloops and ensure this doesn't happen again

  • have you managed to run require("Flash").erasePage(0x60000000) and return to 'normal' firmware now?

    Yes, exactly this. I erased that page and was able to flash normal firmware and boot.

  • Hi @Gordon, you wanted updates if this happened again! I'm pretty sure I'm experiencing the same issue myxor was having. My Bangle.js 2 is (currently) bootlooping in the same way they described and firmware reflashes aren't getting anywhere.

    I've also tried flashing both the modified firmware you originally uploaded, and the newer one that fanoush uploaded, and those haven't produced any change.

    Situ was, I had uploaded some new code of mine to the device from the web IDE maybe a minute ago, and was trying to get it connected back to my phone to try out a function I'd just written. The watch wasn't reconnecting to my phone after disconnecting from my computer, so I held the button to reset it. Screen went blank, got the normal WATCHDOG message, and after showing "BOOTING..." the backlight turned off and it rebooted into the same screen.

    Unsure if the code I uploaded caused the issue directly (doesn't look like it should, I can upload snippets) or I've done the same thing as myxor and corrupted the SPIFLASH.

    Can cooperate helping you get a clone of the flash if that's what you need.

  • Wow, ok - what firmware version were you on before?

    I've also tried flashing both the modified firmware you originally uploaded, and the newer one that fanoush uploaded

    So you mean even with the noflash builds, you can't get it to stay running without rebooting? If so that sounds like a different issue - please could you take a video of what the boot loop looks like?

    ... Or if the noflash images do at least boot, it'd be great if you could do me a flash dump so I can see if I can reproduce/fix it here.

  • Update! Got annoyed by the screen flashing next to my bed while I was waiting for it to discharge, so I kept looking around for any other ideas (sorry!). Saw some of the same recommendations to upgrade the firmware, and was reminded that there's a cutting-edge build I could try. Pushed through flashing that twice in the web IDE and once through nRF Connect on my android phone and it eventually loaded up alright. I checked the firmware version reported using the "About" app and there's been no issue since (about 30hrs have passed). Haven't reinstalled the "default apps" or had to upgrade the bootloader.

    Before this, I was running the most recent stable firmware, which I believe is 2v16?
    Bootloader said 2v15, which I gather is normal as you mentioned (somewhere else?) that the BL and FW dont necessarily have the same version. Rebooting the device now, it still says bootloader 2v15.

    Unfortunately, it didn't occur to me to take video of the loop, but from memory, I was seeing the white screen of the bootloader with the version number, "NO NEW FW" after checking storage(?), and the line "Booting...".
    The backlight would then turn off after a second, and after 5 or so more seconds it would go blank for a few ms and boot back up into the same screen.
    I was able to get into DFU mode just fine by holding the button during boot and releasing during the <====>, and as I've found flashing did work eventually. I was not able to boot without loading code by holding the button longer (tried up to a minute) and at no point was I able to get to the Bangle.js loading screen with the MAC address.

    Everything seems alright from my end now, but if you reckon there's anything I can do to help diagnose this in future, I'm able to help (again, sorry for moving forward on this so impatiently).

  • Before this, I was running the most recent stable firmware, which I believe is 2v16?

    Yes, it should be. That's very odd though as nothing's really been done in 2v16 that would impact the reliability too much: https://github.com/espruino/Espruino/blo­b/master/ChangeLog

    Bootloader said 2v15, which I gather is normal as you mentioned (somewhere else?)

    Yes, absolutely.

    Well, I'm just glad it's fixed for you! I'm not sure if there's much you can do now - unless you feel like trying to reinstall 2v16 and see if it errors again - then we could try imaging flash to track it down.

    ... but I'd be inclined just to leave it as-is!

  • I've switched back to 2v16 as I think I was having stability issues with the cutting-edge firmware, I'll let you know if this happens again.

  • Hi, would it be possible to make a noflash for the latest firmware? My bangle has intermittent flash issues and I would like to run it without but still be on the latest release.
    Thanks

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

Bangle.js 2 stuck in bootloop. dfu flashing did not help

Posted by Avatar for myxor @myxor

Actions