Skip to content
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

Imx9 flexio pwm #12048

Merged
merged 2 commits into from
Apr 4, 2024
Merged

Imx9 flexio pwm #12048

merged 2 commits into from
Apr 4, 2024

Conversation

jlaitine
Copy link
Contributor

@jlaitine jlaitine commented Apr 4, 2024

Summary

This driver implements 16-bit PWMs by using flex-io module. The driver uses one flex-io timer as a trigger for the rest of the timers (generating frequency of the pwm), and the other drivers generate the duty pulse. This method provides 7 PWM outputs per flex-io module. Using both flex-io modules, one can obtain 14 PWM outputs.

There are a few other alternatives for using flex-io to generate PWM

  • the 8+8 bit timer mode, for which the NXP has provided an application note and examples. This is not sufficient for my use, I need more accurate PWM generation.
  • using an external timer to trigger the flex-io timers; this can achieve the same 16-bit precision but would free the one timer for PWM usage as well, giving 8+8 PWM outputs with 2 flex-io modules

This driver is easily extendable later for both of the above.

An alternative way to generate PWM is to use LPTPM timer modules on IMX9. But LPTPM modules are muxed to the same pins with I2C and SPI blocks, so if one needs to use all of those, LPTPM won't have enough pins available. I will however also provide a driver for LPTPM PWM generation later.

Impact

Enables PWM generation from FLEX-IO outputs for IMX9 platform

Testing

Tested on NXPs i.MX93 EVK board w. a logic analyzer

This is a high resolution PWM driver, utilizing one 16-bit Flex-IO timer for
generating PWM period and the rest of the timers to generate PWM duty cycles.

This means that the period has to be the same for every PWM generated from one
FLEXIO block, but this way we can get 16-bit resolution for the PWM signals.

For a typical IMX9 HW there are 8 timers for each Flex-IO block, which means
that by using this driver one can get 7 PWM outputs from one block.

This driver can be later extended to have configuration options to use all
8 channels per flex-io by either using 8+8 -bit timer (less resolution) or by
using an external trigger from an LPIT.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
@xiaoxiang781216 xiaoxiang781216 merged commit 193d490 into apache:master Apr 4, 2024
26 checks passed
@jlaitine jlaitine deleted the imx9_flexio_pwm branch April 17, 2024 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants