This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52832 PWM sequence endlessly by easyDMA

Hi, I'm developping endless PWM sequence.

That is ... Only one output pin and the signal from it is repeated with the same period of pulse but with two different duty setting contiguous and repeats back again.

3 cycles of Duty-A followed by 259 cycles of Duty-B and these total 262 cycles repeates forever. I would like to run PWM by itself to do that without any ISR support by CPU.

The scenario I suppose now is ... I need to set shortcuts that makes repeating behavior. At first, the same duty-A is applied for contiguous 3 PWM cycles. So, I can employ REFRESH=2 or ENDDELAY=2 setting to have following 2 cycle with the same duty that the first one does. Then, I need another duty-B. So, I need to employ the second sequence with REFRESH=258 or ENDDELAY=258 respectively as the first sequence. Then finally, for repeating those ones automatically, I need to set shortcut that invokes alternative sequence when the current sequence is done. Maybe a shortcut setting LOOPSDONE_SEQSTART0 would work fine initiated by TASKS_SEQSTART[0]. Regarding LOOP.CNT, a minimum non-ZERO value "1" would be enough.

Here, I have several questions in the scenario above: Q1: Which is better/reasonable employing REFRESH or ENDDELAY to get required numbers of repeating PWM with unchanged duty ? Q2: About DECODER.LOAD and SEQ[].CNT setting... I need only one output, so I need only one comarator. I do not want to allocate too much SRAM holding comparison value(s). Which .LOAD parameter is the proper one ? For only one comparator update, how much value should be set for .CNT ? Is that in-byte or in-number-of-halfwords ?

Or, am I completely misunderstanding and nRF52's easyDMA-ed PWM ?

Any comments or suggestions from NRF52 PWM experts ?

Regards, Shoichi Kojima

Parents
  • The reason why I used SEQ[1].CNT = 7, and SEQ[1].REFRESH = 36 in order to make it 259 cycles, is that the REFRESH value is ignored when CNT =1 for SEQ[1]. So you cannot have SEQ[1].CNT =1 and SEQ[1].REFRESH = 258 for SEQ[1]. This is explained in the PWM Product Specification, quote:

    SEQ[n].REFRESH and SEQ[n].ENDDELAY are ignored at the end of a complex sequence, indicated by a LOOPSDONE event. The reason for this is that the last value loaded from RAM is maintained until further action from software (restarting a new sequence, or stopping PWM generation).

    So you need SEQ[1].CNT > 1. The solution with SEQ[1].CNT = 7, and SEQ[1].REFRESH = 36 is fully reasonable and appliable in order to get 269 cycles.

Reply
  • The reason why I used SEQ[1].CNT = 7, and SEQ[1].REFRESH = 36 in order to make it 259 cycles, is that the REFRESH value is ignored when CNT =1 for SEQ[1]. So you cannot have SEQ[1].CNT =1 and SEQ[1].REFRESH = 258 for SEQ[1]. This is explained in the PWM Product Specification, quote:

    SEQ[n].REFRESH and SEQ[n].ENDDELAY are ignored at the end of a complex sequence, indicated by a LOOPSDONE event. The reason for this is that the last value loaded from RAM is maintained until further action from software (restarting a new sequence, or stopping PWM generation).

    So you need SEQ[1].CNT > 1. The solution with SEQ[1].CNT = 7, and SEQ[1].REFRESH = 36 is fully reasonable and appliable in order to get 269 cycles.

Children
No Data
Related