Skip to content

Commit 257e958

Browse files
committed
mimxrt: Update the PWM section.
The feature set has been reduced.
1 parent c685161 commit 257e958

File tree

3 files changed

+22
-29
lines changed

3 files changed

+22
-29
lines changed

docs/mimxrt/machine.PWM.rst

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Example usage::
3535
Constructors
3636
------------
3737

38-
.. class:: PWM(dest, freq, \*, duty_u16, duty_ns, keyword_arguments)
38+
.. class:: PWM(dest, freq, \*, duty, duty_u16, duty_ns, keyword_arguments)
3939
:noindex:
4040

4141
Construct and return a new PWM object using the following parameters:
@@ -47,7 +47,8 @@ Constructors
4747
If the object tuple is specified, the two pins act in complementary
4848
mode. These two pins must be the A/B channels of the same submodule.
4949
- *freq* should be an integer which sets the frequency in Hz for the
50-
PWM cycle. The valid frequency range is 15 Hz - > 1 MHz.
50+
PWM cycle. The valid frequency range is 15 Hz or 18Hz up to > 1 MHz.
51+
- *duty* sets the duty cycle as a percent value .
5152
- *duty_u16* sets the duty cycle as a ratio ``duty_u16 / 65536``.
5253
The duty cycle of a X channel can only be changed, if the A and B channel
5354
of the respective submodule is not used. Otherwise the duty_16 value of the
@@ -80,9 +81,6 @@ Constructors
8081
- *sync*\=True|False. If a channel of a module's submodule 0 is already active, other
8182
submodules of the same module can be forced to be synchronous to submodule 0. Their
8283
pulse period start then at at same clock cycle. The default is False.
83-
- *start*\=True|False. Start the PWM clock immediately. If set to False, you can define
84-
a group of channels first and then start them using the PWM.start() method. The
85-
default is True.
8684
- *xor*\=0|1|2. If set to 1 or 2, the channel will output the XORed signal from channels
8785
A or B. If set to 1 on channel A or B, both A and B will show the same signal. If set
8886
to 2, A and B will show alternating signals. For details and an illustration, please
@@ -92,14 +90,14 @@ Constructors
9290
channels are set to low. That allows connected H-bridges to switch off one side
9391
of a push-pull driver before switch on the other side.
9492

95-
*freq*, *duty_u16* and *duty_ns* may be given as keyword arguments as well. Only the
93+
*freq*, *duty*, *duty_u16* and *duty_ns* may be given as keyword arguments as well. Only the
9694
*freq* argument is mandatory.
9795

9896

9997
Methods
10098
-------
10199

102-
.. method:: PWM.init(freq, \*, duty_u16, duty_ns, keyword_arguments)
100+
.. method:: PWM.init(freq, \*, duty, duty_u16, duty_ns, keyword_arguments)
103101
:noindex:
104102

105103
Modify settings for the PWM object. See the above constructor for details
@@ -121,6 +119,17 @@ Methods
121119
With a single *value* argument the frequency is set to that value in Hz. The
122120
method may raise a ``ValueError`` if the frequency is outside the valid range.
123121

122+
.. method:: PWM.duty([value])
123+
:noindex:
124+
125+
Get or set the current percent duty cycle of the PWM output, as an unsigned
126+
value in the range 0 to 100 inclusive.
127+
128+
With no arguments the duty cycle is returned.
129+
130+
With a single *value* argument the duty cycle is set to that value, measured
131+
as the ratio ``value / 65536``.
132+
124133
.. method:: PWM.duty_u16([value])
125134
:noindex:
126135

@@ -141,29 +150,13 @@ Methods
141150

142151
With a single *value* argument the pulse width is set to that value.
143152

144-
.. method:: PWM.center([value])
145-
146-
Get or set the current pulse center of the PWM output, as an unsigned 16-bit
147-
value in the range 0 to 65535 inclusive.
148-
149-
With no arguments the center position is returned.
150-
151-
With a single *value* argument the center position is set to that value.
152-
153-
.. method:: PWM.start([mask])
154-
155-
Start the PWM of the respective FLEXPWM submodule or QTMR channel. If a mask is specified,
156-
the bits of it designate the respective submodules or channels.
157-
158-
.. method:: PWM.stop([mask])
159-
160-
This is an alias to PWM.deinit.
161-
162153
Pin Assignment
163154
--------------
164155

165-
Each FLEX submodule or QTMR module may run at different frequencies. The frequency range
166-
is 5 Hz to >1 MHz, with increasing error for frequency an duty cycle at higher frequencies.
156+
Each FLEX submodule or QTMR module may run at different frequencies. The lowest frequency
157+
is clock_freq/2**25, or 15Hz for MIMXRT1010 and MIMXRT1020, and 18 Hz for the other
158+
boards. The highest frequency with U16 resolution is clock_frequency/2**18 (1907 and 2288 Hz),
159+
the highest frequency with 1 percent resolution is clock_frequency/400 (1.25 and 1.5 MHz).
167160
Pins are specified in the same way as for the Pin class.
168161

169162
The following table shows the assignment of the board Pins to PWM units:

lib/nxp_driver

Submodule nxp_driver updated 1735 files

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy