Hello,
I am currently working on a project in which I would like to use DMA to update PWM pulse length on the Teensy 4 board. More specifically, I would like to use the PWM counter reset as a trigger for DMA to move data from an array in my code to one of the VALx registers of the PWM peripheral (in my case, VAL3 register of Submodule 0 of FlexPWM2). After reading through the manual (https://www.pjrc.com/teensy/IMXRT1060RM_rev2.pdf), Paul's PWM.c code (https://github.com/PaulStoffregen/cores/blob/master/teensy4/pwm.c), and some other forum posts, I realized that I should 1. use Paul's DMAChannel library and 2. also need to set a LDOK bit in addition to updating the VALx register in order to get the PWM pulse length to actually change. However, after working on this for a few days, I'm still not getting anywhere code-wise. Are there any examples of DMA being used in combination with PWM that I can take a look at, or alternatively, can anyone suggest a general layout for how my code might look?
Many thanks.
I am currently working on a project in which I would like to use DMA to update PWM pulse length on the Teensy 4 board. More specifically, I would like to use the PWM counter reset as a trigger for DMA to move data from an array in my code to one of the VALx registers of the PWM peripheral (in my case, VAL3 register of Submodule 0 of FlexPWM2). After reading through the manual (https://www.pjrc.com/teensy/IMXRT1060RM_rev2.pdf), Paul's PWM.c code (https://github.com/PaulStoffregen/cores/blob/master/teensy4/pwm.c), and some other forum posts, I realized that I should 1. use Paul's DMAChannel library and 2. also need to set a LDOK bit in addition to updating the VALx register in order to get the PWM pulse length to actually change. However, after working on this for a few days, I'm still not getting anywhere code-wise. Are there any examples of DMA being used in combination with PWM that I can take a look at, or alternatively, can anyone suggest a general layout for how my code might look?
Many thanks.