For the last week I am trying to get my hat wokring, however I think without result.
I am using 18650 Li-Ion batteries - 2x 3500mAh
The hat should be powered by passive POE (due time), however at the moment not connected as I need a additional equipment in my 19"Rack as my HP switches can only do active POE. But before getting that direction I wan to configure my hat correctly and make sure it works.
So I have a "fresh" Rasbian 64bit. I folled the manual for config. Whenever I use the info script:
sudo python pico_status1.4_hv4.0.py ********************************************** UPS PIco HV4.0 Status Version 1.4 Relase Date 13.03.2024 Compatible with Firmware 0x0168 and up ******************************************* hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --verbose option to see the details of our search for an access method. System Clock read from Date................: 2024-11-19 16:31:02 System Clock read from HWCLOCK.............: Error: {error_message} UPS PIco RTC Registers direct read.........: 2000-00-00 00:00:00 UPS PIco Firmware..........................: 0179 UPS PIco Bootloader........................: 41 UPS PIco PCB Version.......................: 54 UPS PIco PCB Defaut Battery................: Battery LiPO 'L' 0x4C UPS PIco Set Battery.......................: ERROR Raspberry Pi Core Temprature...............: 46 C Raspberry Pi Core Temprature read by PICo..: 46 C Embedded Fan Temp. Threshold...............: c5 C Embedded Fan Speed.........................: ON % of Total RPM Powering Mode..............................: Cable POWERED Power Backup Set Mode......................: Battery Backup Battery Level..............................: 1.0 V Super Capacitor Level......................: 0.8 V EPR/PPoE Powering Level....................: 0.0 V RPi(USB) Powering Level....................: 4.9 V Running Time on Battery....................: 129 min Battery Charger Status.....................: ERROR Max Allowed Battery charging curent........: 0.12 A Max Allowed On Board SCAP charging curent..: 0.0 A Power Source(s) Cable checking timeout.....: 1.58 Seconds Restart on Hold time.......................: 80 Seconds FSSD Durtion...............................: 158 Seconds Firmware loop..............................: Healthy - Running Properly Still Alive Timer..........................: Timer Disabled Raspberry Pi OFF waiting time..............: 133 Minutes Magic Switch Funtionality..................: de-Activated UPS PIco HV4.0 RS232(s) Setup..............: RPI_RS232_OFF -12/+12 V RS232 Driver Connection..........: ERROR RS232 PIco routing.........................: not implemented yet RS232(s) PIco sleep/wakeup data setup......: not implemented yet RS232(s) PIco sleep/wakeup data received...: not implemented yet Internal Relay State.......................: OFF User LED Green Activity....................: OFF User LED Blue Activity.....................: OFF Green LED mapping setup....................: CBL Blue LED mapping setup.....................: CBL A/D Converters Correction Factor...........: 128 A/D Converter 0 ...........................: 0.0 A/D Converter 1 ...........................: 0.0 Opto Coupler/Digital Input Level...........: 0.0 ******************************************* Powered by PiModules with help from ChatGPT 4.0 **********************************************
However whenever I connect my Li-Ion pack to the hat the device is jumping in a reboot loop. When I try to login by SSH, by the time I reach the prompt it reboots. Even with POGO disconnected (putting a sheet of paper in between.
When disconnecting the battery pack all works "fine".
So I thought it is depending on the battery config:
#raspberrypi:~ $ sudo i2cset -y 1 0x6b 0x07 0x4C #raspberrypi:~ $ sudo i2cget -y 1 0x6b 0x07 0xcc
Where I would suspect the return should be 0x4c, anyway, I tried to change the value:
#raspberrypi:~/Download/20240914 $ sudo i2cset -y 1 0x6b 0x07 0x49 #raspberrypi:~/Download/20240914 $ sudo i2cget -y 1 0x6b 0x07 0xc9
The response is not 0x49 like I suspected. I have followed the PDF, however it still states to modify /boot/config.txt
DO NOT EDIT THIS FILE The file you are looking for has moved to /boot/firmware/config.txt
However on Rasbian it was stated this should be /boot/firmware/config.txt
[PICO] ## Added for PIco enable_uart=1 # by default in RPI config dtoverlay=i2c-rtc,ds1307 dtparam=i2c_arm=on # when using raspi-config, this is added at the beginning of the file dtparam=i2c1_baudrate=5000
Seems something is not working correctly and I seem not be able to figure out what it is.
Another example, setting fan speed, in the manual it is referenced the wrong register in the samples, however when using this to adjust the temp when fan need sot turn on, also strange output:
#raspberrypi:~ $ sudo i2cset -y 1 0x6b 0x12 00 #raspberrypi:~ $ sudo i2cget -y 1 0x6b 0x12 0x80 #raspberrypi:~ $ sudo i2cset -y 1 0x6b 0x12 100 #raspberrypi:~ $ sudo i2cget -y 1 0x6b 0x12 0xe4 #raspberrypi:~ $ sudo i2cset -y 1 0x6b 0x12 60 #raspberrypi:~ $ sudo i2cget -y 1 0x6b 0x12 0xbc
I have installed and enabled the systemctl script. I have updated to latest firmware. Have defaulted many times. But currently out of clues. I am sure this will work, however I have somewhere a mistake which is difficult to figure out and a little help would be highly appreciated.
Config realtimeclock (not working either):
# /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. # Parameters can be specified after the module name. i2c-dev i2c-bcm2708 rtc-ds1307
I noticed that when the FAN is starting to run/running there is a high pitched noise coming of the board. Looks like something is interfering,can this be the relays?
When the batteries will not be mounted on the RPI directly, but in the enclosure, is the fan still needed, I like to keep it as silent as possible as they are mounted in various rooms (also sleeping rooms).
Hope some expert is able to help me on my way.
Hi,
Thank your for your post !
Lest start doing it step by step.
First of all please report the Firmware version you have installed on the PIco (OK. I red later that you have installed the latest one) but please report it to be sure
1. As I see you have some problems, I would suggest you to start with a ready image prepared by us, and then when you get some experience, move the the newest OS.
You can download it from here:
https://pimodules.com/firmware-updates
In the mean time I prepare an OS with the latest mentioned by you.
I will upload it tomorrow, on the same page.
Please also find here below answers to your questions:
However whenever I connect my Li-Ion pack to the hat the device is jumping in a reboot loop. When I try to login by SSH, by the time I reach the prompt it reboots. Even with POGO disconnected (putting a sheet of paper in between.
When disconnecting the battery pack all works "fine".
The most possible reason is that your battery is absolutely discharged. Also have you decreased the speed of the I2C to much lower rate ? This is very important, due to I2C streaching bug, we are using software/hardware handler for I2C
dtparam=i2c1_baudrate=5000
Try 10000
Now, I think your problem is due to I2C.
Can you please report of you have any extra hardware on top ?
Tomorrow I release a new image, should help you
Best Regards
Pi Master
Do you mean an rasbian image on this link:
https://pimodules.com/firmware-updates
I have looked, but could not find any only firmware, status i2c etc. Am I missing something?
let me check, we have had for a long time a huge problem with spamming, and obligated to move the servers as also the forum. I check and upload if needed. In any case prepare an image for you/other tomorrow
BR Pi Master
On a fresh Rasbian Lite 64bit image (previously I had a 8gB which needed to be replaced anyway):
#raspberrypi:~/PiModules $ sudo python pico_i2c3.py Traceback (most recent call last): File "/home/user/PiModules/pico_i2c3.py", line 13, in <module> import smbus ModuleNotFoundError: No module named 'smbus'
Then:
sudo apt install python3-smbus Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: i2c-tools libi2c0 read-edid Suggested packages: libi2c-dev The following NEW packages will be installed: i2c-tools libi2c0 python3-smbus read-edid 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 116 kB of archives. After this operation, 773 kB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://deb.debian.org/debian bookworm/main arm64 libi2c0 arm64 4.3-2+b3 [9,456 B] Get:2 http://deb.debian.org/debian bookworm/main arm64 i2c-tools arm64 4.3-2+b3 [78.6 kB] Get:3 http://deb.debian.org/debian bookworm/main arm64 python3-smbus arm64 4.3-2+b3 [11.8 kB] Get:4 http://deb.debian.org/debian bookworm/main arm64 read-edid arm64 3.0.2-1.1 [16.1 kB] Fetched 116 kB in 0s (1,817 kB/s) Selecting previously unselected package libi2c0:arm64. (Reading database ... 56711 files and directories currently installed.) Preparing to unpack .../libi2c0_4.3-2+b3_arm64.deb ... Unpacking libi2c0:arm64 (4.3-2+b3) ... Selecting previously unselected package i2c-tools. Preparing to unpack .../i2c-tools_4.3-2+b3_arm64.deb ... Unpacking i2c-tools (4.3-2+b3) ... Selecting previously unselected package python3-smbus:arm64. Preparing to unpack .../python3-smbus_4.3-2+b3_arm64.deb ... Unpacking python3-smbus:arm64 (4.3-2+b3) ... Selecting previously unselected package read-edid. Preparing to unpack .../read-edid_3.0.2-1.1_arm64.deb ... Unpacking read-edid (3.0.2-1.1) ... Setting up libi2c0:arm64 (4.3-2+b3) ... Setting up read-edid (3.0.2-1.1) ... Setting up i2c-tools (4.3-2+b3) ... Setting up python3-smbus:arm64 (4.3-2+b3) ... Processing triggers for man-db (2.11.2-2) ... Processing triggers for libc-bin (2.36-9+rpt2+deb12u9) ...
Then
sudo python pico_i2c3.py
No error while running this script.
Then systemctl script:
#raspberrypi:~/PiModules $ cat /lib/systemd/system/pico_i2c.service [Unit] Description=UPS PIco GPIO Free Raspberry Pi Interaction Service After=multi-user.target [Service] Type=idle ExecStart=/usr/bin/python /home/user/PiModules/pico_i2c3.py StandardOutput=inherit StandardError=inherit Restart=always [Install] WantedBy=multi-user.target
Then the config.txt adjustment:
cat /boot/firmware/config.txt # For more options and information see # http://rptl.io/configtxt # Some settings may impact device functionality. See link above for details # Uncomment some or all of these to enable the optional hardware interfaces dtparam=i2c_arm=on #dtparam=i2s=on #dtparam=spi=on # Enable audio (loads snd_bcm2835) dtparam=audio=on # Additional overlays and parameters are documented # /boot/firmware/overlays/README # Automatically load overlays for detected cameras camera_auto_detect=1 # Automatically load overlays for detected DSI displays display_auto_detect=1 # Automatically load initramfs files, if found auto_initramfs=1 # Enable DRM VC4 V3D driver dtoverlay=vc4-kms-v3d max_framebuffers=2 # Don't have the firmware create an initial video= setting in cmdline.txt. # Use the kernel's default instead. disable_fw_kms_setup=1 # Run in 64-bit mode arm_64bit=1 # Disable compensation for displays with overscan disable_overscan=1 # Run as fast as firmware / board allows arm_boost=1 [cm4] # Enable host mode on the 2711 built-in XHCI USB controller. # This line should be removed if the legacy DWC2 controller is required # (e.g. for USB device mode) or if USB support is not required. otg_mode=1 [cm5] dtoverlay=dwc2,dr_mode=host [all] enable_uart=1 [PICO] # Added for PIco enable_uart=1 dtoverlay=i2c-rtc,ds1307 dtparam=i2c_arm=on dtparam=i2c1_baudrate=10000
RTC prep in modules file:
cat /etc/modules # /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. # Parameters can be specified after the module name. i2c-dev i2c-bcm2708 rtc-ds1307
In the manual we have the following text, but if you followed the instruction before this seems duplicate, so skipping:
3. Edit by running the following line
sudo nano /boot/config.txt
4. and add the following to this file:
enable_uart=1
dtoverlay=i2c-rtc,ds1307
In a fresh copy of Rasbian there is no rc.local therefore these steps cannot be executed:
5. Edit by running the following line
sudo nano /etc/rc.local
6. and add the following line before “exit 0”
sleep 4; hwclock -s &
Then adjusting hwclock-set:
cat /lib/udev/hwclock-set #!/bin/sh # Reset the System Clock to UTC if the hardware clock from which it # was copied by the kernel was in localtime. dev=$1 #if [ -e /run/systemd/system ] ; then # exit 0 #fi /sbin/hwclock --rtc=$dev --systz /sbin/hwclock --rtc=$dev --hctosys
Date command (as rc.local is at boot)
#raspberrypi:/etc $ date Wed 20 Nov 19:36:17 CET 2024
After a reboot, without the rc.local, which is just a script to set the PI clock from RTC anyway, so should not impact:
#raspberrypi:~ $ sudo hwclock -s hwclock: Cannot access the Hardware Clock via any known method. hwclock: Use the --verbose option to see the details of our search for an access method.
Then pulled power completely and restarted to see what it would do:
#raspberrypi:~ $ date Wed 20 Nov 19:41:52 CET 2024 #raspberrypi:~ $ sudo hwclock -s #raspberrypi:~ $ sudo hwclock -w #raspberrypi:~ $ sudo hwclock -r 2024-11-20 19:43:41.374618+01:00
Oke, seems better now, now pico info:
#raspberrypi:~/PiModules $ sudo python pico_status1.4_hv4.0.py ********************************************** UPS PIco HV4.0 Status Version 1.4 Relase Date 13.03.2024 Compatible with Firmware 0x0168 and up ******************************************* System Clock read from Date................: 2024-11-20 19:44:38 System Clock read from HWCLOCK.............: 2024-11-20 19:44:37.573237+01:00 UPS PIco RTC Registers direct read.........: 2024-11-20 18:44:39 UPS PIco Firmware..........................: 0179 UPS PIco Bootloader........................: 41 UPS PIco PCB Version.......................: 54 UPS PIco PCB Defaut Battery................: Battery LiPO 'L' 0x4C UPS PIco Set Battery.......................: Battery Li-Ion 'I' 0x49 Raspberry Pi Core Temprature...............: 45 C Raspberry Pi Core Temprature read by PICo..: 45 C Embedded Fan Temp. Threshold...............: 45 C Embedded Fan Speed.........................: OFF % of Total RPM Powering Mode..............................: Cable POWERED Power Backup Set Mode......................: Battery Backup Battery Level..............................: 1.0 V Super Capacitor Level......................: 0.7 V EPR/PPoE Powering Level....................: 0.0 V RPi(USB) Powering Level....................: 4.8 V Running Time on Battery....................: 1 min Battery Charger Status.....................: ON Max Allowed Battery charging curent........: 0.12 A Max Allowed On Board SCAP charging curent..: 0.0 A Power Source(s) Cable checking timeout.....: 0.3 Seconds Restart on Hold time.......................: 00 Seconds FSSD Durtion...............................: 30 Seconds Firmware loop..............................: Healthy - Running Properly Still Alive Timer..........................: Timer Disabled Raspberry Pi OFF waiting time..............: 5 Minutes Magic Switch Funtionality..................: de-Activated UPS PIco HV4.0 RS232(s) Setup..............: RPI_RS232_OFF PICO_RS232_OFF -12/+12 V RS232 Driver Connection..........: none RS232 PIco routing.........................: not implemented yet RS232(s) PIco sleep/wakeup data setup......: not implemented yet RS232(s) PIco sleep/wakeup data received...: not implemented yet Internal Relay State.......................: OFF User LED Green Activity....................: OFF User LED Blue Activity.....................: OFF Green LED mapping setup....................: none Blue LED mapping setup.....................: none A/D Converters Correction Factor...........: 00 A/D Converter 0 ...........................: 0.0 A/D Converter 1 ...........................: 0.0 Opto Coupler/Digital Input Level...........: 0.0 ******************************************* Powered by PiModules with help from ChatGPT 4.0 **********************************************
Seems to be working now as well, next step power down, connect the Li-Ion.
Result, endless reboot, not able to login. So till here it works. Now booting without battery pack to see if i2cget/set works:
fttemp max value is 64 is presume
When using
#raspberrypi:~/PiModules $ sudo i2cset -y 1 0x6b 0x13 100 #raspberrypi:~/PiModules $ sudo i2cget -y 1 0x6b 0x13 0x64
This seems to work as well, however the output in Pico Status is not translating the HEX value to decimal value:
#raspberrypi:~/PiModules $ sudo i2cset -y 1 0x6b 0x13 30 #raspberrypi:~/PiModules $ sudo i2cget -y 1 0x6b 0x13 0x1e
Output status info:
Raspberry Pi Core Temprature...............: 47 C Raspberry Pi Core Temprature read by PICo..: 47 C Embedded Fan Temp. Threshold...............: 1e C Embedded Fan Speed.........................: ON % of Total RPM
With the command fan is disabled. So seems to be working, except a battery is not allowed.
sudo i2cset -y 1 0x6b 0x11 0x00 Raspberry Pi Core Temprature...............: 43 C Raspberry Pi Core Temprature read by PICo..: 42 C Embedded Fan Temp. Threshold...............: 1e C Embedded Fan Speed.........................: OFF % of Total RPM
Will see if I can test the Li-ion batteries on charging tomorrow.
Will batteries be charged when RPI is off but power connected?
Open items:
- Get battery working
- Convert rc.local to systemd?
Until I test it myself can not confirm. Good until now, however I need 1-2 days to do everything, and be back to you
BR Pi Master
No worries, this morning I have put the 18650 in my MC3000 charger and they will do a CDC session.
After they will be fulland capacity confirmed (then we can rule out batteries too low as well.
MC3000 shows 3.4V as "base" Voltage this morning.
3V4 is too low, logically (if you not changed the battery type), PIco will proceed with system shutdown
////////////////////////////////////// // working on picocmd.var.battype // setting up the low_bat_level level ////////////////////////////////////// void battype_selection(unsigned int8 battype) { // Batteries Definitions //- Battery LiPO'L'0x4C //- Battery Li-Ion'I'0x49 //- Battery LiFePO4'F'0x46 //- Battery NiMH'H'0x48 //- Battery SAL'A'0x41 //- Battery ISC'C'0x43//Internal Super Cap (100F) //- Battery ESC'D'0x44//External Super Cap (300F-500F-800F) //- Battery LiPO+SC'l'0x6C //- Battery Li-Ion+SC'i'0x69 //- Battery LiFePO4+SC'f'0x66 //- Battery NiMH+SC'h'0x68 //- Battery SAL+SC'a'0x61 switch(battype) { case 'L': case 'l': //- Battery Set to LiPO "L" low_bat_level=BAT_3V40; break; case 'I': case 'i': //- Battery Li-Ion"I" low_bat_level=BAT_3V30; break; case 'F': case 'f': //- Battery LiFePO4"F" low_bat_level=BAT_2V80; //picocmd.var.low_bat=2; break; case 'H': case 'h': //- Battery NiMH"H" low_bat_level=BAT_3V00; break; case 'A': case 'a': //- Battery SAL"A" low_bat_level=BAT_3V20; break; default: //- Battery Set to LiPO "L" low_bat_level=BAT_3V40; break; } }
@piadmin hmz, okay, well we wil test this afternoon when the cycle is finished. However this is quite odd as normally people purchase these batteries in a shop, the default power is like 3.4V (liIon), then everybody will have this problem. Is there not a way to charge and confirm in software when the batteries are ready to fulfill the UPS task?
Hope you get my point. As not everybody will have a LiIon charger at hand...
No one reported such problem until now, however next week we are releasing newer firmware, so add extra feature covering this, deep discharged battery.
BR Pi Master