-
Notifications
You must be signed in to change notification settings - Fork 1.3k
atmel-samd: Brownout / low battery causes SPI flash erase on Circuit Playground Express #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have a simple fix that won't reset the filesystem if it reboots into safe mode. I did try to reproduce this with a bench supply, and only managed to make it happen a couple of times, erratically. I also wrote a high-duty-cycle blinky program on CPX that lit all the Neopixels, and ran a LiPo down, but could not get it to erase. @tdicola when you're back I could pass you a .uf2 with the fix and you can test it with the arc reactor project. |
@tdicola Patch is in branch |
@tdicola Pull request #319 would fix this, I think. I was able to break the filesystem a few times with the bench supply, and then after #319, I couldn't, but it wasn't really a good test. If you see this problem again after building the latest 2.x or using the upcoming 2.0.1 release, please reopen. |
Using cpx 2.1.0, I have the same problem very reproducible with multiple units. In my case the fs is wiped reliably by loosening and wiggling the Lipo battery connector to produce an intermittent contact. |
I had the same problem with a feather m0 express once, when I didn't remove the USB plug all the way. |
jafine on discord reports a CIRCUITPY erase with 2.2.0, perhaps due to a low battery. |
I observed this occurring multiple times while we were doing demoing the TR808 drum (with fruit attached). In order to recalibrate, we were un-plugging and re-plugging in a 3.7V lipo battery.One of our kid helpers was leaving the lipo plug loosely in the socket, so that she could quickly disconnect and reconnect. I suspect that it was the quick disconnection and reconnection of power that may have contributed to this. I can re-create the issue by replicating the the loose socket quick switching of power. Later I connected a JST push-button switch to prevent this, and noticed that it eventually wiped again. This follows with what @BillyDonahue mentioned previously with 2.1.0. |
Not sure if it's known or not, but this appears to be an issue still with 2.2.4 as well. My setup is the development kit, with the 3 AAA batteries, battery case and CPX. Often enough if the battery switch is shut off, the code is lost and filesystem is reformatted when the battery switch is turned back on. |
Huh, I wonder if its reproducible with a AAA switch because there is bounce on the switch. @croadfeldt Could you save file, load an arduino sketch and then switch it on and off. Its still not clear to us if this is a CircuitPython issue or a hardware/SPI flash issue. |
@tannewt Will do later this week when I have some time again. |
Thanks @croadfeldt! @dhalbert is looking into the brownout detector settings now too. |
Raising brownout voltage limit to 2.77V did not fix the problem. After testing by turning various things off, adding delays, etc., I think that the usual reason for this problem is the Usually what's written to So we could check to see whether the file contents is identical what we want to write, and skip the write in that case, which would be most of the time. I'll try this out. We can't really delay writing the contents of (tagging @ladyada) |
This will also save wear and tear on the flash. |
started w/ circuitpython 2.2.4 - running code.py - no usb connection, flop power switch on battery pack quickly results in wiped filesystem with just boot_txt compiled code running raw - no usb connection, flop power switch has no effect on code, operation redploy of circuitpython 2.2.4 - reinstall of code.py on filesystem, FWIW this persists through compiled code push from arduino IDE, this was a neat surprise when I put the 2.2.4 CP back on and my files re-appeared. |
@croadfeldt Could you try a couple of things:
|
Quick update.
Chris |
Thank you for the help @croadfeldt ! |
@croadfeldt Here is a more sophisticated update: |
@tannewt @dhalbert - you're welcome! Thanks for your work to make this all work so well. :) More results:
|
@croadfeldt ok, thanks! This is going into the next release. Your testing and your ability to break it have been very helpful 😃 Your batteries seem better than mine! |
Thanks again everyone! Glad to see this much improved! |
I've noticed an odd but somewhat nasty issue that appears to be reproducible. With Circuit Playground Express (but perhaps other M0 express and maybe M0 basic boards) if my project uses a lipo battery that runs low enough to brownout and turn off, after I swap in a new battery the entire SPI flash is erased and my old program is gone. It's happened twice in a row with my arc reactor project, and I have a feeling it always happens when power goes low like this (I've only ever run the battery completely dead twice and both times the FS was destroyed on next power up). My suspicion is in the low voltage or brownout state perhaps the SPI flash chip isn't readable and the board brownout resets, fails to read the flash, and assumes the FS is bad and erases it all (or maybe the FS was actually corrupted during the brownout).
Opening this as an issue for now to investigate further. I think we want to setup a board with a bench supply to VBAT and start it at 3.3 volts, then lower it bit by bit into brownout mode (probably around 2.5 volts or so) and see if it repros for easier investigation. I'm not sure there's a fix but if we can understand what's happening better perhaps there are workarounds or ways to prevent the FS from being destroyed.
The text was updated successfully, but these errors were encountered: