This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0G1507: Trigger PWM duty cycle update from COMP output

Part Number: MSPM0G1507

I would like to trigger a PWM update (change duty cycle)  using one of the COMPs.

What is the best way to achieve this without CPU intervention?

  • Hi Chris,

    Is the goal on Comparator toggle to change the PWM duty cycle to a specific, non-zero or non-100% value (e.g. 75%)? Or to set the PWM output fully high/low?

    For the latter, you can use the comparator fault mechanism to set the PWM output high or low when the comparator is active. The fault features provide a great number of options for changing the PWM behavior during a fault, as well as filtering any transients. The fault handler is only integrated into Advanced timer instances (TIMAx) however. 

    If you want to update the PWM to specific value (e.g. when comp goes high set duty cycle to 60%), you could do this using the DMA and the Event Framework. The COMP would be an event publisher, and the DMA the event subscriber. On published event, the DMA can be configured to update the associated capture compare register for your timer instance.

    Best Regards,
    Brandon Fisher

  • If using the timer fault handler can we assert the PWM high/low in less than 200ns?

    Thanks

  • Hi Chris,

    200ns from comparator output edge to PWM response, or 200ns including comparator delay? In either case the answer is yes. For the latter you will of course need the comparator in high speed mode (40ns propagation delay with 100mV overdrive). Any filtering you add would of course delay this.

    For the former, if you are not using the fault input filter, under 100ns is what I'd expect from fault signal (Comparator output change in this case), to fault assertion (PWM blanked). 

    Best Regards,
    Brandon Fisher