Best PWM playback looping method

Hi,

I'm looking for the best method to play endless complex sequences (seq0 -> seq1 -> seq0 -> seq1 -> ...)

Method 1:
Set LOOPSDONE_SEQSTART0 in SHORTS register which will trigger the task SEQSTART[0] when LOOPDONE event is raised. This seems to work fine but when I look at the datasheet of the nRF52833, I see that LOOPDONE event is raised one PWM clock cycle after last SEQEND[1] event is raise. The task SEQSTART[0] is triggered also one PWM clock cycle later. My understanding is that there is two PWM clock cycles playing the last loaded duty cycle before the new sequence starts. Am I right?

Method 2:
Set the LOOP register to its highest value (65535) and update it every now and then (before it gets to 0) with the highest value. I haven't tested this method yet so would this work?

Do you see any better method to do it?

Thanks for you help!
Hugo

Parents
  • This seems to work fine but when I look at the datasheet of the nRF52833, I see that LOOPDONE event is raised one PWM clock cycle after last SEQEND[1] event is raise.

    Can you point to where in the datasheet this is conveyed, I could not find it.

    The task SEQSTART[0] is triggered also one PWM clock cycle later.

    I don't think this is true, can you point to where this is stated?

    Set the LOOP register to its highest value (65535) and update it every now and then (before it gets to 0) with the highest value. I haven't tested this method yet so would this work?

    I don't know if this method will work, as it depends entirely on how the PWM state-machine interfaces with the LOOP register.

  • Here is the image that describes my statements

    Has you can see in this image, the LOOPDONE event is raised one PWM clock cycle after last SEQEND[1] event is raise.

    Regards,
    Hugo

  • I think the Prod Spec is a bit vague on the LOOPDONE --> SEQSTART shortcut timing, but I don't really understand why you think this figure describes how "the LOOPDONE event is raised one PWM clock cycle after last SEQEND[1] event is raised". 

    Do you have a PWM scope of a LOOPDONE --> SEQSTART shortcut transition?

  • H Haakonsh,

    No I don't have a scope screenshot. I figured this behaviour with only the spec but if my understanding is wrong, it's a good thing.

    I'm using method two now and its working but I will need method one in future projects along with PPI to sync many PWM outputs. I aim to use the LOOPDONE event from one PWM output to trigger the SEQSTART0 task of the other PWM outputs and also its own SEQSTART0 task using the SHORT register.

    Thanks for you clarifications on the spec.

    Regards
    Hugo

Reply
  • H Haakonsh,

    No I don't have a scope screenshot. I figured this behaviour with only the spec but if my understanding is wrong, it's a good thing.

    I'm using method two now and its working but I will need method one in future projects along with PPI to sync many PWM outputs. I aim to use the LOOPDONE event from one PWM output to trigger the SEQSTART0 task of the other PWM outputs and also its own SEQSTART0 task using the SHORT register.

    Thanks for you clarifications on the spec.

    Regards
    Hugo

Children
No Data
Related