-
Notifications
You must be signed in to change notification settings - Fork 8k
LPTMR counter prescaler fix #95263
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
FelixWang47831
wants to merge
3
commits into
zephyrproject-rtos:main
Choose a base branch
from
nxp-upstream:LPTMR-counter-prescaler-fix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
LPTMR counter prescaler fix #95263
FelixWang47831
wants to merge
3
commits into
zephyrproject-rtos:main
from
nxp-upstream:LPTMR-counter-prescaler-fix
Conversation
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
fb35cd1
to
87c17cb
Compare
a9e7a06
to
ae525b2
Compare
Holt-Sun
reviewed
Sep 16, 2025
16db088
to
e2d7251
Compare
068f3c9
to
af34f81
Compare
af34f81
to
4e10b32
Compare
Holt-Sun
approved these changes
Oct 8, 2025
@FelixWang47831 need to address merge conflicts |
The lptmr0 has been enabled with default settings defined in dts/arm/nxp/nxp_rt118x.dtsi. Enable lptmr3 to test with designated prescaler. Signed-off-by: Felix Wang <[email protected]>
In current code, if timer-mode-sel is 0(Timer Counter Mode), bypass_prescaler_glitch will be 1, that makes prescaler setting be bypassed. But this setting is very useful, especially for long timing count. In this patch, we update prescale-glitch-filter default value to 0, to indicate prescaler and glitch filter are disabled, which comply the existing devices DTS setting (prescaler = 1). And if user sets prescale-glitch-filter properity other than 0, we should set bypass_prescaler_glitch to false to make prescaler work, and the clock frequence should be calculated with prescaler setting. Update prescaler field in dt-bindings to tell developer should use prescale-glitch-filter instead. Signed-off-by: Felix Wang <[email protected]>
For lptmr counter driver, since "prescaler" has been deprecated and replaced by prescale-glitch-filter. Update related setting in device tree files. Signed-off-by: Felix Wang <[email protected]>
4e10b32
to
ed9c807
Compare
|
Hi @dleach02 Has fixed conflicts. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area: Boards/SoCs
area: Counter
area: Devicetree Bindings
area: Tests
Issues related to a particular existing or missing test
platform: NXP Drivers
NXP Semiconductors, drivers
platform: NXP MCU
platform: NXP MPU
platform: NXP
NXP
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.
For previous code, if timer_mode_sel is set to 0(Time Counter Mode), bypass_prescaler_glitch will be 1-0 = 1, which means the prescaler does not work on time counter mode. But prescaler is very useful, especially for long timing count.
In this PR:
Update prescale_glitch_filter in dts bindings, add 0 in enum and the default value for this property has been changed to 0, to indicate prescaler and glitch filter are disabled.
Have checked all of device tree settings, the prescaler property are all 1, which means the clock are not prescaled. And in previous driver code, bypass_prescaler_glitch are always 1, the prescaler never works. Therefore this change will not bring running issue for existing boards.
If user sets prescale-glitch-filter properity other than 0, set bypass_prescaler_glitch to false to make prescaler work.
Calculate clock frequency with prescaler setting