Background:
I have been trying to get scripted scheduling working with a couple of new WittyPi 4 L3V7 on a Raspi 4 running Debian Bookworm.
Using a schedule.wpi like this:
BEGIN 2024-06-11 12:20:00 END 2024-06-11 12:35:00 ON M10 OFF M5
runScript.sh output showed the single shutdown and startup times I expected:
> wittypi/runScript.sh --------------- 2024-06-11 12:16:57 --------------- Schedule next shutdown at: 2024-06-11 12:30:00 Schedule next startup at: 2024-06-11 12:35:00 ---------------------------------------------------
The shutdown happened as expected, but then it immediately started up again. This was in the log:
[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.21) is started. [xxxx-xx-xx xx:xx:xx] System: Debian GNU/Linux 12 (bookworm), Kernel: Linux 6.6.31+rpt-rpi-v8, Architecture: arm64 [xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 4 Model B Rev 1.5 [xxxx-xx-xx xx:xx:xx] RTC offset register has value 0x79 [xxxx-xx-xx xx:xx:xx] Seems RTC has good time, write RTC time into system [xxxx-xx-xx xx:xx:xx] Writing RTC time to system... [2024-06-11 12:30:28] Done :-) [2024-06-11 12:30:28] Firmware ID: 0x37 [2024-06-11 12:30:28] Firmware Revison: 0x04 [2024-06-11 12:30:28] Current Vout=5.21V, Iout=1.26A [2024-06-11 12:30:28] System starts up because of the scheduled startup got delayed. [2024-06-11 12:30:28] Maybe the scheduled startup was due when Pi was running, or Pi had been shut down but TXD stayed HIGH to prevent the power cut. [2024-06-11 12:30:33] Send out the SYS_UP signal via GPIO-17 pin. [2024-06-11 12:30:33] Schedule script is interrupted, revising the schedule... [2024-06-11 12:30:33] Pending for incoming shutdown command...
This is what I was seeing consistently. If I cleared the scripted schedule and both input times and put in only a shutdown time it behaved like I expected. Based on the symptoms I found this post, which suggested a firmware <=5 may have a fix. The two boards I just got from Digikey last week are both 0x04. I followed the flashing instructions, using a fresh Debian Bullseye image to flash it from the pi GPIO. The output matched what the steps showed at each step, but when I moved it back to the original Raspi, it wouldn't power on.
Current Symptom:
After flashing from 0x04 to 0x06, I mounted the WittyPi4 L3V7 on a Raspi 4. Connected an official Raspi 3A power supply to the WittyPi. There is a solid green LED and flashing blue LED. Pressing the power button does nothing. Connecting a battery changes the blue to steady on, but still no change from the power button.
Disconnected power. Unmounted the WittyPi from the GPIO header, powered it and tried again. The symptoms are the same. Solid green, flashing or solid blue. No white or red LED. Power button changes nothing.
I put my second WittyPi on the Raspi, connected power and battery and it works like I expect.
Did I brick this? Any ideas? Thanks!
It seems the firmware was not properly flashed into the device.
Have you read this? https://www.uugear.com/portfolio/compile-flash-firmware-for-witty-pi-4/
Maybe you followed the old instructions and the new firmware didn't get flashed properly. The link above is the new one.
Yes, that's the procedure I used. Guess I'll try to flash it again.
Same result. Here's the verify step:
$ sudo avrdude -p attiny841 -C ~/avrdude_gpio.conf -c RasPi -v avrdude: Version 6.3-20171130 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/home/jeff/avrdude_gpio.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : unknown Using Programmer : RasPi AVR Part : ATtiny841 Chip Erase delay : 4500 us PAGEL : P00 BS2 : P00 RESET disposition : possible i/o RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 6 4 0 no 512 4 0 4000 4500 0xff 0xff signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 flash 65 6 16 0 yes 8192 16 512 4500 4500 0xff 0xff efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 Programmer Type : linuxgpio Description : Use the Linux sysfs interface to bitbang GPIO lines Pin assignment : /sys/class/gpio/gpio{n} RESET = 12 SCK = 24 MOSI = 23 MISO = 18 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9315 (probably t841) avrdude: safemode: lfuse reads as E2 avrdude: safemode: hfuse reads as DD avrdude: safemode: efuse reads as F5 avrdude: safemode: lfuse reads as E2 avrdude: safemode: hfuse reads as DD avrdude: safemode: efuse reads as F5 avrdude: safemode: Fuses OK (E:F5, H:DD, L:E2) avrdude done. Thank you.
Here's flashing:
$ sudo avrdude -p attiny841 -C ~/avrdude_gpio.conf -v -c RasPi -e -Uefuse:w:0xF5:m -Uhfuse:w:0xDD:m -Ulfuse:w:0xE2:m -Uflash:w:./WittyPi4_L3V7.ino.hex:i avrdude: Version 6.3-20171130 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch System wide configuration file is "/home/jeff/avrdude_gpio.conf" User configuration file is "/root/.avrduderc" User configuration file does not exist or is not a regular file, skipping Using Port : unknown Using Programmer : RasPi AVR Part : ATtiny841 Chip Erase delay : 4500 us PAGEL : P00 BS2 : P00 RESET disposition : possible i/o RETRY pulse : SCK serial program mode : yes parallel program mode : yes Timeout : 200 StabDelay : 100 CmdexeDelay : 25 SyncLoops : 32 ByteDelay : 0 PollIndex : 3 PollValue : 0x53 Memory Detail : Block Poll Page Polled Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- --------- eeprom 65 6 4 0 no 512 4 0 4000 4500 0xff 0xff signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00 flash 65 6 16 0 yes 8192 16 512 4500 4500 0xff 0xff efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00 Programmer Type : linuxgpio Description : Use the Linux sysfs interface to bitbang GPIO lines Pin assignment : /sys/class/gpio/gpio{n} RESET = 12 SCK = 24 MOSI = 23 MISO = 18 avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e9315 (probably t841) avrdude: safemode: lfuse reads as E2 avrdude: safemode: hfuse reads as DD avrdude: safemode: efuse reads as F5 avrdude: erasing chip avrdude: reading input file "0xF5" avrdude: writing efuse (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of efuse written avrdude: verifying efuse memory against 0xF5: avrdude: load data efuse data from input file 0xF5: avrdude: input file 0xF5 contains 1 bytes avrdude: reading on-chip efuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of efuse verified avrdude: reading input file "0xDD" avrdude: writing hfuse (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of hfuse written avrdude: verifying hfuse memory against 0xDD: avrdude: load data hfuse data from input file 0xDD: avrdude: input file 0xDD contains 1 bytes avrdude: reading on-chip hfuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of hfuse verified avrdude: reading input file "0xE2" avrdude: writing lfuse (1 bytes): Writing | ################################################## | 100% 0.00s avrdude: 1 bytes of lfuse written avrdude: verifying lfuse memory against 0xE2: avrdude: load data lfuse data from input file 0xE2: avrdude: input file 0xE2 contains 1 bytes avrdude: reading on-chip lfuse data: Reading | ################################################## | 100% 0.00s avrdude: verifying ... avrdude: 1 bytes of lfuse verified avrdude: reading input file "./WittyPi4_L3V7.ino.hex" avrdude: invalid record at line 1506 of "./WittyPi4_L3V7.ino.hex" avrdude: read from file './WittyPi4_L3V7.ino.hex' failed avrdude: safemode: lfuse reads as E2 avrdude: safemode: hfuse reads as DD avrdude: safemode: efuse reads as F5 avrdude: safemode: Fuses OK (E:F5, H:DD, L:E2) avrdude done. Thank you.
After complete I shut down the pi and then connected only power to the WittyPi. Green LED solid, blue flashing. Pressing the power button does nothing.
@drunkenungulate I think your firmware file is not correct:
avrdude: reading input file "./WittyPi4_L3V7.ino.hex" avrdude: invalid record at line 1506 of "./WittyPi4_L3V7.ino.hex" avrdude: read from file './WittyPi4_L3V7.ino.hex' failed
The proper way to save the firmware file to your local disk, is to right click the link and choose “Save Link As…” in the pop-up menu, and save the .hex file into the directory you choose, as mentioned in the tutorial.
Yep, thanks for your help. I had found the latest firmware on github earlier and had right-click, save as downloaded it already. But that got me github html and not the raw file. Didn't realize that while I was looking at the tutorial later. In my defense I did at least look for a checksum to verify the download.
It might be good to post SHA256 sums for the compiled files, both for download integrity verification and to help defend users against their own inattention/stupidity.
In any case it's working now. Thanks again!
@drunkenungulate as mentioned in the forum rules, one topic is for one main question only. I have moved your new post to: https://www.uugear.com/forums/technial-support-discussion/witty-pi-cuts-power-during-the-reboot/#post-962