mimxrt/machine_rtc: Enable rtc.alarm for RT1176 and fix deepsleep. - #19641
Open
robert-hh wants to merge 3 commits into
Open
mimxrt/machine_rtc: Enable rtc.alarm for RT1176 and fix deepsleep.#19641robert-hh wants to merge 3 commits into
robert-hh wants to merge 3 commits into
Conversation
Use the RTC irq handler to call the handler if required. Defining the proper IRQ handler for the IRQ table was missing. Signed-off-by: robert-hh <robert@hammelrath.com>
That makes it available for the code and it is used by machine.deepsleep(). Signed-off-by: robert-hh <robert@hammelrath.com>
machine.deepsleep(ms) works now as intended by powering down the board for ms/1000 seconds and then resetting it. That can be repeated several times. For MIMXRT10xx MCUs machine.deepsleep() works as intended. The WAKEUP pin pull-up was enabled and set to 100k to ensure a high/low transition. machine.deepsleep() does not work as intended for mimxrt1176. It can be called once and recover from deepsleep by pulling the WAKEUP_DIG pin low, but then attempts to call machine.deepsleep with or without a timeout fail until a power cycle is done. So waking up from deepsleep using the WAKEUP_DIG pin is not enabled. It is however possible to wakeup the device with >1 sec low pulse at the ONOFF pin. Signed-off-by: robert-hh <robert@hammelrath.com>
Contributor
Author
|
The fix for rtc.alarm() is simple and was easy. I tried for a while to get wakeup by the WAKEUP Pin working for the RT1176. Even if some fixes are mentioned in the NXP forum, none of the worked. |
|
Code size report: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
machine.rtc.alarm() did not work with the RT1176 MCU. The reason was, that the proper IRQ handler was not enabled. Since machine.deepsleep(timeout) uses mechanism of rtc alarm, it did not work either.
This PR also changes machine.deepsleep() without timeout for the RT1176 MCU. This option which should allow to wake up the MCU from deepsleep with a low pulse at the WAKEUP pin was not reliable. When used, it worked once, and then both deepsleep variants failed until the next power cycle. It seems to be a hardware issue. To avoid the unexpected behavior, the wakeup by the WAKEUP pin for machine.deepsleep() is disabled now for the RT1176. It is still possible to wakeup the device from deepsleep with a >1 sec long low pulse at the ONOFF pin. That works for MIMXRT10xx devices as well.
Testing
Tested with MIMXRT1020EVK, Seeed Arch Mix, Teensy 4.1, OpenMV RT1062, MIMXRT1170EVK.
Generative AI
I did not use generative AI tools when creating this PR.