08-02-2022, 04:43 AM
(08-02-2022, 03:50 AM)CounterPillow Wrote:(08-02-2022, 03:08 AM)GreyLinux Wrote: Unfortunately where I live I probably have a dozen or so power cuts a year , not as bad as some but enough to give me worry about the possible SD card corruption.
I use a Rockpro64 as a server and a NAS , I know I should invest in a emmc , but I'm not sure of a distro that supports it fully yet.
eMMC is supported by mainline kernels, so Debian/Armbian/Manjaro/etc. should work fine from eMMC. That won't prevent you from potentially getting filesystem corruption from power cuts though.
For immediate relief to your situation I think either an off-the-shelf UPS would do the trick, or a 12V lead-acid battery in parallel with the power input. This would keep the battery topped up while power is available, and if wall power gets removed, will automatically have the board powered from the battery. I'm no electrical engineer so I won't try to draw up a schematic, as I don't want to potentially spread a wrong circuit around.
For a more advanced solution, something like the TI BQ34110 might come in handy. It supports a wide range of battery chemistries, high capacities, high currents, and is designed for applications where the battery rarely gets discharged, like in UPSes. It communicates with the host through I²C, the only difficulty is that there is not yet a driver in Linux for this, but that can be remedied. The bigger issue is that this chip is currently unavailable due to supply issues, and won't be in stock until a year from now according to digikey.
So it'd be cool if we could find a comparable chip to the BQ34110. The BQ34Z110 looks promising, it only supports lead-acid but it is in stock. It also might actually have most of a driver already in drivers/power/supply/bq27xxx_battery_i2c.c. As for connecting the battery monitoring chip's I²C to the host board, something like Adafruit's STEMMA or SparkFun's QWIIC would be handy as a physical connector interface. That way people don't have to fiddle with individual jumper wires and PINE64 can just sell a STEMMA/QWIIC HAT for each board which is useful for things outside of the UPS.
Wow thats some incredible knowledge and could be a possible solution, I wonder if Pine64 would be interested in either developing the Hat you mention for each board or possibly a complete UPS solution. I had a quick look at the chips you linked, do you think the second one could work? it doesnt have the "integrated rarely discharged module" that the first one has, but as you said the chip shortage is going to be a long term issue .
I will try and do some research about your temporary solution regarding the 12V battery in parallel, hopefully I can post some finding back here.
Sorry I should have specified that of course emmc is supported in the linux kernel but I believe the newer 5.x.x kernels have some issues with the emmc modules, Ive seen some mention of it on the Armbian forum. I use the SkiffOS distro currently and havent tried out a emmc module to see if it works.
I thought that Emmc modules were more resilient than SD cards when it comes to power outages and corruption but I guess memory storage and read/writes during a power outage still can lead to filesystem corruption.