Cool stuff for Raspberry Pi, Arduino and all electronics hobby projects
Notifications
Clear all

[Solved / Archived] Witty Pi 4: shutdown not working (boot up reason = 0x02)

6 Posts
2 Users
0 Likes
243 Views
(@insideoutgrp)
Posts: 9
Active Member
Topic starter
 

We have a strange issue where sometimes (randomly) on our estate, some devices will stop paying attention to the shutdown time.

Even if we set a new shutdown time, or reboot the device (so it reads a new date for the schedule) it will just stay on.

When reading the i2c alarms, the previous boot up reason is shown as 0x02 i.e. it thinks it shutdown correctly but it didn't and so doesn't seem to ever attempt it again.

How do we best get this to start actioning the shutdown/schedule again - without power cycling the whole hat/device (as these are remote)

Thanks
Jay

 
Posted : 17/07/2024 11:31 am
(@admin)
Posts: 448
Member Admin
 

Firstly please edit your topic and clearly state which product you are refering to.

Secondly please provide at least part of the log for checking.

 
Posted : 17/07/2024 11:37 am
(@insideoutgrp)
Posts: 9
Active Member
Topic starter
 

@admin 

See below logs, the 06-13 it boots up at 08:00 as planned, it seemed to reboot for unknown reason at 20:30 (could be power cut etc) and then after that it doesn't shut down on the 13th, so on the 14th you can see it says Unknown startup reason in the logs and no longer shuts down on schedule after this point 

 

2024-06-13 08:00:25] Done 🙂
[2024-06-13 08:00:25] Firmware ID: 0x26
[2024-06-13 08:00:25] Firmware Revison: 0x05
[2024-06-13 08:00:25] Current Vin=13.56V, Vout=4.88V, Iout=0.73A
[2024-06-13 08:00:25] System starts up because scheduled startup is due.
[2024-06-13 08:00:30] Send out the SYS_UP signal via GPIO-17 pin.
[2024-06-13 08:00:31] Pending for incoming shutdown command...
[2024-06-13 08:00:31] Schedule next shutdown at: 2024-06-13 22:00:00
[2024-06-13 08:00:31] Schedule next startup at: 2024-06-14 08:00:00
[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.15) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 3 Model B Plus Rev 1.4
[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-13 20:30:37] Done 🙂
[2024-06-13 20:30:37] Firmware ID: 0x26
[2024-06-13 20:30:37] Firmware Revison: 0x05
[2024-06-13 20:30:37] Current Vin=12.76V, Vout=4.88V, Iout=0.81A
[2024-06-13 20:30:37] System starts up because scheduled startup is due.
[2024-06-13 20:30:42] Send out the SYS_UP signal via GPIO-17 pin.
[2024-06-13 20:30:43] Pending for incoming shutdown command...
[2024-06-13 20:30:43] Schedule next shutdown at: 2024-06-13 22:00:00
[2024-06-13 20:30:43] Schedule next startup at: 2024-06-14 08:00:00
[xxxx-xx-xx xx:xx:xx] Witty Pi daemon (v4.15) is started.
[xxxx-xx-xx xx:xx:xx] Running on Raspberry Pi 3 Model B Plus Rev 1.4
[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-14 18:45:41] Done 🙂
[2024-06-14 18:45:41] Firmware ID: 0x26
[2024-06-14 18:45:41] Firmware Revison: 0x05
[2024-06-14 18:45:41] Current Vin=13.5V, Vout=4.88V, Iout=0.79A
[2024-06-14 18:45:41] Unknown/incorrect startup reason: 0x02

 
Posted : 17/07/2024 12:02 pm
(@admin)
Posts: 448
Member Admin
 

Reason 0x02 is defined in firmware as REASON_ALARM2, which is for scheduled shutdown.

Showing a reason for shutdown during startup, means the firmware doesn't write the actual reason for startup into the register. We have added two new reasons for startup in firmeare revision 0x06:

  • 0x0A - Power supply is newly connected
  • 0x0B - Device is reboot

Because your firmware version is 0x05, if your device was reboot, or the device started up because the power supply was newly connected, the firmware didn't write the startup reason and hence the previous written reason (for shutdown) can be read in the log.

I noticed something not normal in your log, it seems the shutdown was not done gracefuly, because the software (daemon.sh) didn't detect the shutdown. In normal case you should see "Halting all processes and then shutdown Raspberry Pi..." in log, when the device was shut down. However in your log there is no such log record, which indicates the shutdown was not a normal one.

Many users neglect such issue, thinking it is a small problem -- it is not, a normally configured Witty Pi should have its shutdown being detected by the software.

You may want to check the GPIO connection, it is possible that some pins are not well connected (e.g. GPIO-4, GPIO-17 etc.).

 

 
Posted : 17/07/2024 5:00 pm
(@insideoutgrp)
Posts: 9
Active Member
Topic starter
 

I've done some more research on this

So i'm not sure the reason it powered down as you're right this is an older firmware - it could have crashed and rebooted via watchdog, or had a power cut etc but I got the client to power cycle the unit - and since then it has successfully been following the shutdown/startup schedule as it should have, so doesn't seem to be a loose GPIO connection.

Is there any way remotely to 'force' the unit to resync its schedule/time etc - i've tried rebooting (so it writes a new schedule), i've tried picking a new schedule script, changing the time/RTC but nothing except a physical power cycle seems to clear this issue. I wasn't sure if I pulled one of the gpio low it may force the system to emulate a button press or similar to shut down and then startup on its next schedule?

 
Posted : 25/07/2024 3:34 pm
(@admin)
Posts: 448
Member Admin
 

Pulling GPIO-4 to ground equals to press the power button on Witty Pi. This event will be detected by the software (and write to log) too.

Running "sudo shutdown now" will shutdown the system without letting the software know, also there will be no log record in wittyPi.log for such shutdown.

You need to figure out the actual reason that causes the issue, there is no such solution that can simply make things better without knowing how to.

 
Posted : 25/07/2024 4:02 pm
Join Waitlist We will inform you when the product arrives in stock. Please leave your valid email address below.