Low power RTC alarm on IMX6ul

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Low power RTC alarm on IMX6ul

Jump to solution
4,275 Views
sguy
Contributor III

Is it possible to power up the IMX6ul using a low power RTC alarm?

On the Reference Manual, the RTC alarm is only mentioned on the High Power RTC (SNVS_HP section).  This section states that "this alarm cannot wake up the entire system if it is powered off".

However, the svns resisters section includes a SNVS_LP Time Alarm register, and it look like the Linux device driver do set it.

Can I program the IMX6UL to start from a power down (only SNVS_LP power domain powered) on a predefined time?

Thanks.

Labels (3)
1 Solution
2,792 Views
sguy
Contributor III

Hi,

The solution was the following patches to the Linux kernel:

[PATCH] rtc: snvs: add a missing write sync — ARM, OMAP, Xscale Linux Kernel 

[PATCH 0/2] imx: Fix power-up on RTC alarm — ARM, OMAP, Xscale Linux Kernel 

Those patches were accepted to the upstream kernel. I'm not sure if/when NXP picked them to their kernel fork.

You can also find those patches on my github repo:

Commits · mobiwize/linux-2.6-imx · GitHub (last three patches on the linked branch)

View solution in original post

11 Replies
2,792 Views
sguy
Contributor III

My next question is how do I get this to work from Linux.

I tried the command

# echo +120 > /sys/class/rtc/rtc0/wakealarm && shutdown -h now

which, to my understanding, should shutdown the system, then after around 2 minutes, bring it up again.

On my system, it failed to power on the device.

The Linux driver on "drivers/rtc/rtc-snvs.c", appears to write the LP time alarm registered you mentioned.

What am I doing wrong?

0 Kudos
2,792 Views
igorpadykov
NXP Employee
NXP Employee

some examples can be found in imx-test package (../mxc_rtc)
www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz

0 Kudos
2,792 Views
sguy
Contributor III

Thank you.

Those examples don't include the use case I'm looking for.

They do include waking up from sleep modes, but don't include waking from power off state (in which only the SNVS_LP power domain is powered).

0 Kudos
2,792 Views
pratyushtomar
Contributor IV

Hi Guy,

Did you find any way to wake up from shutdown by setting RTC alarm.  Earlier I was using  "Linux imx6ulevk 4.1.15-1.1.1+gd5d7c02" and after changing mask value from 0x61 to 0x6b for snvs_poweroff: snvs-poweroff  in imx6ul.dtsi the wake up from shutdown was working after setting RTC alarm. But after upgrading kernel to "Linux imx6ulevk 4.1.15-1.2.0+g77f6154" this mask value is not working. Can you help me out if you have any solution for this? 

2,792 Views
nickbedbury
Contributor III

I needed the modification (0x61 to 0x6b) suggested by @Pratyush Tomar for this to work.  Patches described by Guy were already integrated to kernel 4.9-1.0.x

0 Kudos
2,793 Views
sguy
Contributor III

Hi,

The solution was the following patches to the Linux kernel:

[PATCH] rtc: snvs: add a missing write sync — ARM, OMAP, Xscale Linux Kernel 

[PATCH 0/2] imx: Fix power-up on RTC alarm — ARM, OMAP, Xscale Linux Kernel 

Those patches were accepted to the upstream kernel. I'm not sure if/when NXP picked them to their kernel fork.

You can also find those patches on my github repo:

Commits · mobiwize/linux-2.6-imx · GitHub (last three patches on the linked branch)

2,792 Views
pratyushtomar
Contributor IV

Hi Guy I applied the patches and rtc wakeup is working fine but in some cases it fails. I am using ATWILC3000 wifi module on my board. If I urn on wifi after booting then rtc wakeup from shutdown doesn't work even if I turn off wifi after shutdown. While if I don't turn on wifi anytime after booting then rtc wakeup from shutdown work perfectly fine every time. The wifi is connected to board with SPI. What can be the reason for such behaviour? 

0 Kudos
2,792 Views
sguy
Contributor III

I don't have any experience with this WIFI module, so I can only guess.

 

Two thing that I would try:

  1. Turn off the WIFI module before the shutdown. Maybe the SPI communication during the shutdown is responsible for the behavior.
  2. When the RTC power-on doesn't work, try to power on the chip using the ONOFF pin. This will help you to determine if the issue is related only to the RTC boot, or is a part of a general boot issue.
0 Kudos
2,792 Views
pratyushtomar
Contributor IV

Thanks for your reply Guy.

1) Turning off wifi module doesn't work. The RTC wake up fails in this case also. So RTC wake up works only if I don't turn ON wifi at all.

2) The chip can be powered on using ON/OFF pin when RTC power-on doesn't work.

Thus it definitely looks like RTC related and somehow connected SPI issue. RTC works perfectly fine if wifi is not turned on and that's why it is pretty strange. 

0 Kudos
2,792 Views
igorpadykov
NXP Employee
NXP Employee

one can use these examples as starting point for developing own application.

Also NXP has service for helping customers developing new drivers,  NXP Professional Services:

http://www.nxp.com/support/nxp-professional-services:PROFESSIONAL-SERVICE

Best regards
igor

0 Kudos
2,792 Views
igorpadykov
NXP Employee
NXP Employee

Hi Guy

>Can I program the IMX6UL to start from a power down (only SNVS_LP power domain powered) on a predefined time?

seems yes, as signal PMIC_ON_REQ (which turns on/off pmic)  is powered by SNVS power domain

as described in Figure 46-2  SNVS Power Domains, Figure 49-1 Chip reset scheme under PMU control,

Figure 49-3 Chip on/off state flow diagram  i.MX6UL Reference Manual (rev.1  4/2016)

http://cache.freescale.com/files/32bit/doc/ref_manual/IMX6ULRM.pdf

From sect.7.3.3.2 Time counter alarm Security Reference Manual for the i.MX 6UltraLite Applications Processor

(could be provided through creating service request):

SNVS_LP has its own 32-bit LP Time Alarm register. As illustrated in Figure 7-7, this
register generates an SRTC time alarm once the secure real time clock's 32 most
significant bits match with the LP Time Alarm register. The time alarm can generate an
interrupt to alert the host processor and can wake the host processor from one of its lowpower
modes. This alarm can also wake up the entire system in the power-down mode by
asserting the wake-up external output signal.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos