KL16Z Adjusting TPM duration through DMA

cancel
Showing results for 
Search instead for 
Did you mean: 

KL16Z Adjusting TPM duration through DMA

Jump to solution
146 Views
turtius
Contributor I

Hello, I have setup TPM for PWM which is center aligned. Now  for my application i needed to change the frequency with a given duration and that was done by updating the MOD register and using a timer  to stop the pulse when the duration was reached by clearing the MOD register but this consumed far too many cycles so i started looking at DMA .So regarding the subject, is there a way to set the duration of the pulse through DMA so that the buffer does not need to hold every single pulse?

 

 

Labels (1)
0 Kudos
1 Solution
129 Views
nxf56274
NXP TechSupport
NXP TechSupport

Hi,

tpm.PNG

You do not need DMA. From this picture, CMOD[1:0] != 0:0, you use the CPWM mod. So you can directly write the new MOD value. The value will stored in buffer. When the counter changes from MOD to MOD-1, the MOD will updated from buffer. And your duration is also changed.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

1 Reply
130 Views
nxf56274
NXP TechSupport
NXP TechSupport

Hi,

tpm.PNG

You do not need DMA. From this picture, CMOD[1:0] != 0:0, you use the CPWM mod. So you can directly write the new MOD value. The value will stored in buffer. When the counter changes from MOD to MOD-1, the MOD will updated from buffer. And your duration is also changed.

Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 days after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post