Wipy/Lopy4 losing firmware
I've experienced this a couple of times with both Wipy3/Lopy4 units - where they completely lose their firmware and the device is restored to factory settings. I suspect it has to do with the development units being powered by empty batteries which are incapable of supplying enough power during operation/transmission.
I will report back with more details - but wanted to post this and ask if other users have experienced similar issues?
@robert-hh I implemented your advice - but it seems the problem persists. Firstly a bit of background.
I have a LoPy4 on a Pytrack. It is transmitting the GPS coordinates over Lora every 10 seconds, as well as saving the records to local storage (not SD card). As Lora is 'fire and forget' I am concerned about missing GPS points when the unit is out of range. When the unit gets back to the office it connects via Wifi and uploads all the saved records, and it then deletes the records when a successful upload is completed.
I also implemented your advice and the unit measures the battery voltage once every 10 second cycle. At the moment I use it to determine if it is on battery voltage, or external power (through USB). But I also realized I don't do as you advised, in that I don't shut down the unit when the battery is nearly empty. I've looked at the different options to shutdown the device and I am unsure which would be the best?
Do I close all files (to prevent corrupting the file system) and put the unit into deep sleep and wake up every 60 seconds to check if power has been restored? Or is there a way to 'shut down' the unit and it will only wake up when power is restored? Do I have to turn of the WDT otherwise it will wake the unit when the WDT expires?
Second to this, why has a safety shutdown not been implemented in the low-level code? If a unit can only operate down to a specified voltage, the low-level can force close all open files, and shut down the unit. The lowest battery voltage I've measured is 3.048239V.
robert-hh last edited by
@HenroRitchie In the module pycoproc.py, which you use for PySense, there is a function called read_battery_voltage(). You can use that to test, whether the battery is low. Call:
The damage should only occur if you write to the flash. But one never knows what a code does, which goes haywire.
@robert-hh This is exactly what I mean - by factory settings I mean the device is in the same state that I received it in from Pycom, or after updating the firmware, and yes empty versions of main.py and boot.py is loaded.
Any advice to prevent this? I am using the Pysense board and from my understanding, there is no interrupt from the battery charger to tell the device to turn off when the battery is nearly empty.
robert-hh last edited by
@HenroRitchie What do you mean with factory settings? The Pycom devices have not factory settings, at least not for the firmware. It may happen that the file system gets corrupted, especially if the power drops during file writes. At that point you have to recreate the file system, which creates default (=empty) versions of main.py and boot.py.