I've been very busy with the development of of the #LiFePO4wered/Pi+ lately, so updates here have been sparse, my excuses for that. That doesn't mean that nothing has been happening though! In fact, much of the development going on for the /Pi+ also benefits this project directly, since there is a large shared code base that has been extensively tested on both devices.
Let's go over what's new:
Hardware
The new layout with the improved footprint for the MIC2876 boost converter has been working very well, I have had much less assembly issues with this new batch. Lesson learned: don't just pick a footprint from the library that looks right, instead make sure it's as close to the manufacturers recommendations as possible or make your own!
The new layout also has a new design for the touch button:
How do you guys like it? And what it means?
I've been a little remiss on making true on the meaning of that logo, sorry about that. But very soon now, the source Eagle files for the LiFePO4wered/Pi and #LiFePO4wered/18650 (which is the charging base for the LiFePO4wered/Pi3) will be put up on GitHub! Yay! :)
Firmware
Much work has been done on firmware in the last couple of months. The LiFePO4wered/Pi and #LiFePO4wered/Pi+ share a code base, so improvements made for the one directly benefit the other as well. Here is a summary of the improvements that have spilled over to the LiFePO4wered/Pi:
- I2C write shadow buffer. This ensures multi-byte register values are always written atomically to prevent race conditions. The I2C peripheral on the MSP430G2231 is a pain because it requires so much babysitting in software, and the Raspberry Pi's I2C peripheral is a pain because it doesn't support clock stretching. Initially I had a shadow buffer for both read and write, but because the bytes coming out of the LiFePO4wered/Pi could never be 100% trusted (the first bit might be wrong because the software couldn't get to it in time), ensuring consistency for reads has been shifted to the Raspberry Pi code, and only the I2C write shadow buffer is left.
- I2C write unlock code. To prevent erroneous register writes when multiple processes are trying to access the LiFePO4wered/Pi, a write now needs to be preceded with an unlock code. Look at the host software source or the updated product brief for details.
- Timeouts for boot and shutdown states. Before, the LiFePO4wered/Pi would stay in these states until the right host event occurred. But if a Pi became unresponsive, these events wouldn't happen and the LiFePO4wered/Pi would just keep waiting. Now the timeouts ensure the power is turned off eventually if things are unresponsive. The timeouts can also be adjusted by the user.
- It is now possible to force the power output off by pressing and holding the touch button for 10 seconds. Nice for when you have started the LiFePO4wered/Pi without a Pi attached or if you have forgotten to insert an SD card.
- If the user wants to connect a hardware button, this was already possible by connecting a button in series with a 100pF capacitor between the T and G pads. Since support for mechanical buttons was added for the #LiFePO4wered/Pi+, this is now also available on the LiFePO4wered/Pi. Just set TOUCH_CAP_CYCLES to zero and connect a button between the T and G pads, no capacitor needed in that case.
- ADC values now have more precision. I already was doing a running average on the ADC readings, but now instead of scaling this back to 10-bit every time, I keep the 13-bit value. The result is better filtering, and less code.
- Added a host application watchdog function. When using this feature, your application needs to regularly reload the watchdog timer so it doesn't run out. If it fails to do so, the watchdog timer will expire. When it does, either the LED will start flashing an error pattern to let you know, or the system will be shut down. In combination with auto boot, this can be used to reboot the Pi to restart your application.
- Some general reliability enhancements and bug fixes.
And all of that functionality still fits in a 2K micro! :) These new features are present in all devices shipped since the beginning of 2018.
Host software
The host software has been updated to support the new registers in the new firmware. Other than that, there are some great enhancements even if you have an older device:
- If you do
lifepo4wered-cli get
without specifying a variable, the software will now dump all the available variables. This was a much requested feature. :)
- When reading variables, the host software will now require 3 identical readings before reporting the result. This is to prevent race conditions when reading multi-byte registers and issues with initial bits missing described above. We're basically patching a hardware issue in software.
- The host software will automatically retry I2C accesses if they fail.
- The write unlock code described above is automatically handled.
- Added sign extension for some variables, so we can now have negative calibration offsets and they behave correctly.
- Add bus access locks to prevent I2C bus contention if multiple processes are trying to access the LiFePO4wered/Pi at once (such as the daemon and a user program).
- Added Python and Node.js language bindings. These use the compiled shared library and as such benefit of all the reliability improvements described above.
With all of these enhancements, it is recommended you update the host side software even if you are using an older device! If you still have the source from when you installed on your device, just run:
git pull
./build.py
sudo ./INSTALL.sh
And you will be up-to-date! If not, just follow the installation instructions in the product brief.
So there you have it. Enjoy all the new LiFePO4wered goodness. :)
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.
Awesome Patrick, I will update soon. Keep on the great work. Greets Maikel
Are you sure? yes | no