6 Replies Latest reply on Aug 23, 2018 12:27 AM by user_342122993

    Synchronous PWM stop, or best component to change frequencies?

    user_331986238

      Hi, looking at a design which uses a PWM to provide timing for a data acquisition subsystem.  The current asynchronous stop / update / start is causing problems.  Is there a way to get synchronous stops / starts under software control?

       

      We need to scan 2 to 7 inputs at 30Hz per input (multiplexer feeding an alarm circuit and a DelSig ADC).  This means providing a variable clock signal at (2 to 7) x 30Hz = 60Hz to 210Hz. 

       

      Each scan period includes:

      • Provide an initial pulse (1st output)
      • Delay 100us
      • Provide a separate pulse (2nd output)
      • Delay 3.2ms
      • Provide a separate pulse (3rd output)
      • Delay to the end of the 60..210Hz sample period

      This means changing the divisor to provide 60Hz to 210Hz, preferably with synchronous update:  when changing frequencies, we need:

      1. The current cycle to complete, THEN
      2. Update divisors and compare values, THEN
      3. Begin the next cycle using the new values.  

       

      Currently, the API only supports stopping asynchronously, at an indeterminate point in the cycle.

       

      Is there a way to support a synchronous update?  This would require either:

      1. Latching the new divisor and compare values, and clocking them in when the current cycle ends / new cycle begins, OR
      2. Support synchronous stop:
        1. Allow setting a Synchronous Stop flag,
        2. Fire an interrupt when the PWM stops (the ISR would then modify register values and restart the PWM),

       

      Is there a better component to use?

       

      Thanks!