mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 20:44:39 +08:00
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:
committed by
Masayuki Ishikawa
parent
e586f86918
commit
7d877fbbc3
@@ -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
|
||||
---
|
||||
|
||||
|
||||
@@ -592,6 +592,27 @@ config IMXRT_FLEXPWM1_MOD1_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD1_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM1_PWM1_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD1_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM1_MOD1_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD2
|
||||
@@ -604,6 +625,27 @@ config IMXRT_FLEXPWM1_MOD2_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD2_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM1_PWM2_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD2_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM1_MOD2_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD3
|
||||
@@ -616,6 +658,27 @@ config IMXRT_FLEXPWM1_MOD3_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD3_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM1_PWM3_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD3_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM1_MOD3_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD4
|
||||
@@ -628,6 +691,27 @@ config IMXRT_FLEXPWM1_MOD4_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD4_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM1_PWM4_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM1_MOD4_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM1_MOD4_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
endmenu # IMXRT_FLEXPWM1
|
||||
@@ -645,6 +729,27 @@ config IMXRT_FLEXPWM2_MOD1_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD1_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM2_PWM1_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD1_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM2_MOD1_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD2
|
||||
@@ -657,6 +762,27 @@ config IMXRT_FLEXPWM2_MOD2_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD2_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM2_PWM2_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD2_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM2_MOD2_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD3
|
||||
@@ -669,6 +795,27 @@ config IMXRT_FLEXPWM2_MOD3_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD3_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM2_PWM3_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD3_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM2_MOD3_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD4
|
||||
@@ -681,6 +828,27 @@ config IMXRT_FLEXPWM2_MOD4_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD4_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM2_PWM4_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM2_MOD4_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM2_MOD4_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
endmenu # IMXRT_FLEXPWM2
|
||||
@@ -698,6 +866,27 @@ config IMXRT_FLEXPWM3_MOD1_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD1_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM3_PWM1_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD1_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM3_MOD1_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD2
|
||||
@@ -710,6 +899,27 @@ config IMXRT_FLEXPWM3_MOD2_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD2_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM3_PWM2_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD2_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM3_MOD2_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD3
|
||||
@@ -722,6 +932,27 @@ config IMXRT_FLEXPWM3_MOD3_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD3_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM3_PWM3_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD3_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM3_MOD3_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD4
|
||||
@@ -734,6 +965,27 @@ config IMXRT_FLEXPWM3_MOD4_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD4_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM3_PWM4_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM3_MOD4_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM3_MOD4_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
endmenu # IMXRT_FLEXPWM3
|
||||
@@ -751,6 +1003,27 @@ config IMXRT_FLEXPWM4_MOD1_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD1_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM4_PWM1_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD1_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM4_MOD1_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD2
|
||||
@@ -763,6 +1036,27 @@ config IMXRT_FLEXPWM4_MOD2_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD2_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM4_PWM2_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD2_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM4_MOD2_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD3
|
||||
@@ -775,6 +1069,27 @@ config IMXRT_FLEXPWM4_MOD3_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD3_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM4_PWM3_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD3_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM4_MOD3_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD4
|
||||
@@ -787,6 +1102,27 @@ config IMXRT_FLEXPWM4_MOD4_COMP
|
||||
bool "Use complementary output"
|
||||
default n
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD4_TRIG
|
||||
bool "Enable trigger generation"
|
||||
default n
|
||||
---help---
|
||||
Use PWM submodule to trigger FLEXPWM4_PWM4_OUT_TRIG01 output
|
||||
from submodule 1. This can be used to generate an
|
||||
interrupt that can trigger ADC conversion or synchronize
|
||||
other PWMs for example.
|
||||
|
||||
config IMXRT_FLEXPWM4_MOD4_SYNC_SRC
|
||||
int "Synchronization source signal"
|
||||
default -1
|
||||
range -1 130
|
||||
---help---
|
||||
PWM module can be synchronized by an external signal. This
|
||||
config option selects the signal's source. The number in
|
||||
IMXRT_FLEXPWM4_MOD4_SYNC_SRC corresponds with the XBAR
|
||||
number (please refer to the documentation for XBAR numbers).
|
||||
|
||||
-1 (default value) means the module is not to be synchronized.
|
||||
|
||||
endif
|
||||
|
||||
endmenu # IMXRT_FLEXPWM4
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user