imxrt: add support for PWM synchronization

This commit allows the PWM modules to be synchronized by an external
signal (other PWM module for example). The sync source can be selected
from configuration.

PWM module can also now generate a trigger when its timer reaches the duty
cycle. This trigger is used for the synchronization of other modules. It
can also be used for triggering ADC for example in the future.

Thanks to Rastislav Pavlanin and  Jan Spurek from NXP support for
suggestion which helped to solve the inter-module PWM synchronization
task.

Signed-off-by: Michal Lenc <michallenc@seznam.cz>
This commit is contained in:
Michal Lenc
2022-09-04 21:12:24 +02:00
committed by Masayuki Ishikawa
parent e586f86918
commit 7d877fbbc3
3 changed files with 597 additions and 39 deletions
@@ -168,6 +168,47 @@ Pulse width modulator supported in i.MX RT1010 and higher. Multiple channels opt
Output on pin B is currently supported only as a complementary option to pin A.
The lower-half of this driver is initialize by calling :c:func:`imxrt_pwminitialize`.
PWM module can be synchronized by an external signal. The external signal used for synchronization
is selected by IMXRT_FLEXPWMx_MODx_SYNC_SRC config option. The number in IMXRT_FLEXPWM4_MOD4_SYNC_SRC
corresponds with the XBAR number. Following numbers can be used for synchronization of PWMs with other
PWM module when using iMXRT1020, iMXRT1050 or iMXRT1060.
- PWM1 Module 1 = 40
- PWM1 Module 2 = 41
- PWM1 Module 3 = 42
- PWM1 Module 4 = 43
- PWM2 Module 1 = 44
- PWM2 Module 2 = 45
- PWM2 Module 3 = 46
- PWM2 Module 4 = 47
- PWM3 Module 1 = 48
- PWM3 Module 2 = 49
- PWM3 Module 3 = 50
- PWM3 Module 4 = 51
- PWM4 Module 1 = 52
- PWM4 Module 2 = 53
- PWM4 Module 3 = 54
- PWM4 Module 4 = 55
iMXRT1170 has different XBAR connections:
- PWM1 Module 1 = 74
- PWM1 Module 2 = 75
- PWM1 Module 3 = 76
- PWM1 Module 4 = 77
- PWM2 Module 1 = 78
- PWM2 Module 2 = 79
- PWM2 Module 3 = 80
- PWM2 Module 4 = 81
- PWM3 Module 1 = 82
- PWM3 Module 2 = 83
- PWM3 Module 3 = 84
- PWM3 Module 4 = 85
- PWM4 Module 1 = 86
- PWM4 Module 2 = 87
- PWM4 Module 3 = 88
- PWM4 Module 4 = 89
SAI
---