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?
Solved! Go to Solution.
Hi,
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.
-------------------------------------------------------------------------------
Hi,
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.
-------------------------------------------------------------------------------