I’m aware of the fact that the BB does not come with a battery-backed RTC, so without further actions it is clear for me a “rtcwake -m off” will switch the BB of and never let come it back.
But assumed I use a cape such as the WaveShare Misc Cape that comes with a battery-backed RTC - does it work then and restart the BB even from being powered off? Means is there a connection between that RTC and the PMIC so that the BB can be restarted?
I have had a quick look and I don’t think this is possible. There would be no way to wake up the system from a cape once it has been shutdown as far as I can see.
If I needed to do as you suggest, I would probably add an stm32l011 or equivalent to a custom cape, or stand alone pcb. Provide 5V to this and then a mosfet switched output to power the BBB via the cape header or to the barrel jack.
You would also need a 3v3 LDO regulator to supply the stm32
Hook up the micro via I2C to the BBB. You can connect the 3v3 on the cape header to an i/o pin on the stm32 to detect once the BBB has shutdown and then switch off the 5V.
You can get the stm32l011 in very small packages with some extra i/o in case you also want to wake up on other signals. You could code the stm32 to appear as a standard RTC chip, that way you would not need to write a custom kernel driver and the system time would get set automatically when booting. This might require a kernel re-compile to set the system clock to something other than the internal RTC, or you could probably just disable the internal RTC in the device tree.
You would need to modify the device tree to add the external RTC.
Thanks for the feedback. From what I have seen the RTC is connected via I2C to the BB and the PMIC is also connected to I2C. From this I would have assumed it could work. Nevertheless it was not clear to me if they are connected to the same I2C and therefore really could communicate with each other…or if this is the case, if the RTC is able to directly communicate with the PMIC in general.
No, the RTC can’t do that. It is a slave device. Assuming the PMIC I2C is on one of the headers, you could hook up a micro to it and potentially you may be able to do something. But the micro would still need its own regulator from the 5V supply as when you shutdown the board, the 3.3V rail goes off.
You could look at the PMIC datasheet and see if there is an input pin that can power on the board when it is off and maybe drive it from an RTC IRQ, but if that was possible you are going to have to modify the BBB pcb to connect the signal to the PMIC.
The simplest solution is what I have outlined or some variation on it, or just live with a higher power consumption and do a suspend to RAM, although getting that to work maybe harder than the hardware solution.