Skip to content

Enable rtc on rt700 #93006

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Holt-Sun
Copy link

Updated rtc driver to support NXP RT700.

  1. Update nxp irtc driver to fix issue in init and alarm get function.
  2. Update RTC device tree binding to support "share-counter".
  3. Update RT700 dtsi to support rtc0 for cpu0 and rtc1 for cpu1.
  4. Update readme.

Enable rt700 RTC unittest.

@@ -11,6 +11,7 @@

const struct device *const rtc = DEVICE_DT_GET(DT_ALIAS(rtc));

#if !(DT_PROP(DT_ALIAS(rtc), share_counter))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can not go in a common sample, board/soc specific logic stays with the board/soc, if really needed, in a board specific sample in samples/boards/nxp/ :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Move the #if (DT_PROP(DT_ALIAS(rtc), share_counter)) into rtc_nxp_irtc.c nxp_irtc_set_time function. Please review.

Comment on lines 43 to 47
share-counter:
type: boolean
description: |
This slave irtc instance shares the data and time counters of the master irtc instance.
This means the code cannot set the data and time counters, but can only read them.
Copy link
Collaborator

@bjarki-andreasen bjarki-andreasen Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property should be enforced on the driver level, by implementing the set_time API like

static int set_time_not_perm(const struct device *dev, const struct rtc_time *timeptr)
{
        ARG_UNUSED(timeptr);
        return -EPERM;
}

static DEVICE_API(...) = {
        .set_time = set_time_not_perm,
        ...
};

the sample does not need to be updated, it will correclty print "Cannot write date time: -1"

Copy link
Author

@Holt-Sun Holt-Sun Jul 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, please review.

Holt-Sun added 2 commits July 12, 2025 20:44
1. Update nxp irtc driver to fix issue in init and alarm function.
2. Update RTC device tree binding to support "share-counter".
3. Update RT700 dtsi to support rtc0 for cpu0 and rtc1 for cpu1.
4. Update readme.

Signed-off-by: Holt.Sun <holt.sun@nxp.com>
1. Update overlay and project conf for RT700.
2. Update test_alarm.c to disable RTC irq so that callback function won't be called to clear the pending interrupt.

Signed-off-by: Holt.Sun <holt.sun@nxp.com>
@Holt-Sun Holt-Sun force-pushed the enable-rtc-on-rt700 branch from 55a2226 to 620191f Compare July 12, 2025 12:53
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: RTC Real Time Clock area: Samples Samples platform: NXP Drivers NXP Semiconductors, drivers platform: NXP NXP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants