2023-06-30 08:56 AM
Hello everyone,
I am working on a custom board based on stm32mp15x. I am trying to periodically wake up my system from the shutdown condition using the RTC. From the hardware point of view, I am using the STPMIC to restore the Vdd supply of the MPU, when the RTC alarm is triggered.
I am using an oscilloscope to monitor the VBAT and the Vdd pins, and I can see approximately 1.8V on the VBAT pin when the system is shutdown.
Looking around in this forum, I've found similar questions so I tried to patch TF-A to set the PWR_CR2 bits: PWR_CR2_RREN and PWR_CR2_BREN, but unsuccessfully. When I shutdown the system, after the RTC timer expires I obtain: (this makes me think that at least the signals are wired correctly)
[ 101.016028] systemd-shutdown[1]: Powering off.
[ 101.159164] reboot: Power down
INFO: PSCI Power Domain Map:
INFO: Domain Node : Level 1, parent_node -1, State ON (0x0)
INFO: Domain Node : Level 0, parent_node 0, State ON (0x0)
INFO: CPU Node : MPID 0x0, parent_node 0, State ON (0x0)
INFO: CPU Node : MPID 0x1, parent_node 0, State ON (0x0)
// after 1 minute (set with rtcwake)
PANIC at PC : 0x2ffd30e3
Could you please confirm that setting PWR_CR2_RREN and PWR_CR2_BREN bits in register PWR_CR2 is the right way to guarantee wakeup from shutdown using RTC? If so, can you please provide details on the kind of patch needed in the TF-A (I simply commented out the instructions clearing the bits above)? I am monitoring the value of register PWR_CR2 with
root@my-board:~# devmem2 0x50001008
/dev/mem opened.
Memory mapped at address 0xb6fdc000.
Read at address 0x50001008 (0xb6fdc008): 0x00010001
Am I missing something else?
Thank you in advance for the help, have a nice day
Solved! Go to Solution.
2023-07-03 01:27 AM
From the STM32MPU153 Reference Manual (RM0442), page 2313/3939:
"The RTC is functional in VBAT mode and in all low-power modes when it is clocked by the
LSE. When clocked by the LSI, the RTC is not functional in VBAT mode, but is functional in
all low-power modes."
Setting the RTC clock from LSI to LSE in the RCC clock source node of the TF-A devicetree solved the issue.
2023-07-03 01:27 AM
From the STM32MPU153 Reference Manual (RM0442), page 2313/3939:
"The RTC is functional in VBAT mode and in all low-power modes when it is clocked by the
LSE. When clocked by the LSI, the RTC is not functional in VBAT mode, but is functional in
all low-power modes."
Setting the RTC clock from LSI to LSE in the RCC clock source node of the TF-A devicetree solved the issue.