Skip to content

Adding flexio pwm support for MCXW71 and MCXW72 devices. #92325

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

Merged

Conversation

EmilioCBen
Copy link
Contributor

Adding flexio pwm support for MCXW71 and MCXW72 devices.

Copy link

github-actions bot commented Jun 27, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-hal_nxp DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Jun 27, 2025
@EmilioCBen EmilioCBen force-pushed the feature/frdm_mcxw7x_flexio_pwm branch 2 times, most recently from c01b24e to ab33dcc Compare June 27, 2025 19:30
@kartben kartben assigned mmahadevan108 and dleach02 and unassigned anangl Jul 19, 2025
@EmilioCBen EmilioCBen force-pushed the feature/frdm_mcxw7x_flexio_pwm branch from ab33dcc to 5a2c34b Compare July 23, 2025 14:51
@zephyrbot zephyrbot requested a review from axelnxp July 23, 2025 14:52
@github-actions github-actions bot removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label Jul 23, 2025
mmahadevan108
mmahadevan108 previously approved these changes Jul 23, 2025
@EmilioCBen EmilioCBen force-pushed the feature/frdm_mcxw7x_flexio_pwm branch 2 times, most recently from 9c56472 to e8d7c82 Compare July 23, 2025 15:31
mmahadevan108
mmahadevan108 previously approved these changes Jul 23, 2025
@mmahadevan108
Copy link
Contributor

@EmilioCBen please fix the merge conflict.

is_only_low_or_high = true;
} else if (duty_cycle == period_cycles && !pulse_cycles) {
polarity = FLEXIO_PWM_ACTIVE_HIGH;
is_only_low_or_high = true;
}
Copy link
Member

Choose a reason for hiding this comment

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

@EmilioCBen the SonarCube is flagging this because it wants an empty "else" here for defensive programming reasons. So end this with:

} else {
   /* Some reasonable comment on why there isn't anything in the else block */
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the code, just hoping an empty else case doesn't get flagged.

@EmilioCBen EmilioCBen force-pushed the feature/frdm_mcxw7x_flexio_pwm branch 2 times, most recently from 3768a7e to 5bdc35b Compare July 28, 2025 14:46
mmahadevan108
mmahadevan108 previously approved these changes Jul 28, 2025
if (period_cycles == pulse_cycles) {
polarity = FLEXIO_PWM_ACTIVE_LOW;
is_only_low_or_high = true;
} else if (duty_cycle == period_cycles && !pulse_cycles) {
Copy link
Member

Choose a reason for hiding this comment

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

!pulse_cycles should be pulse_cycles == 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

dleach02
dleach02 previously approved these changes Aug 1, 2025
Updated the nxp flexio pwm driver to account
for when the duty cycle is 100% or 0%.
We switch off the counter of the flexio and
manually set the GPIO High or Low. Otherwise
Flexio Peripheral with default to a 50% duty
cycle behavior.
Factored out timerOutput variable.

Signed-off-by: Emilio Benavente <[email protected]>
Updated the nxp_mcxw7x dts to include a
flexio_pwm node.

Signed-off-by: Emilio Benavente <[email protected]>
Enabled testing for the flexio pwm on MCXW7X Platforms.

Signed-off-by: Emilio Benavente <[email protected]>
Copy link

sonarqubecloud bot commented Aug 6, 2025

@cfriedt cfriedt merged commit 1d66687 into zephyrproject-rtos:main Aug 8, 2025
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Clock Control area: PWM Pulse Width Modulation platform: NXP Drivers NXP Semiconductors, drivers platform: NXP NXP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants