5 Replies Latest reply on Apr 28, 2015 2:17 PM by user_14586677

    PWM with Single-Shot

    adam.kadolph

      I am attempting to generate some fast signals to control some leds (WS2812B driver for NeoPixel LEDs).

         

      I have decided to go with the PWM module on the PSoC 4 in a Single-shot Multi reload configuration. I also have PWM setup for 2 outputs, one for my '1' bit and one for my '0' bit waveform.

         
            
      • The '1' bit waveform reqires a ~850ns high time and a ~450ns low time (+/-150ns)
      •     
      • The '0' bit waveform reqires a ~450ns high time and a ~850ns low time (+/-150ns)
      •    
         

      Since the periods are the same i kept them on the same PWM module. Now, I added a multiplexor on the output to allow me to switch between the two waveforms and control a single output pin. The multiplexor is switched via a control register module, single output.

         

      The timing from PWM generator is spot on, the problem i run into is that the time to reload into the next bit pattern takes too long. The period of the PWM is ~1.3us and then there is ~5us delay until the next bit waveform is generated.

         

      Lastly, each LED is a 24bit RGB, so i need to generate 24x a combination of  '1' and '0' waveforms.

         

      I have 2 questions for this project:

         
            
      1. Is there a way to remove the delay (~5us) in between each signal being generated in PWM one shot mode? I only have a multiplexor on the PWM output. Once i re-trigger it should be really quick.
      2.     
      3. Is there a better way to generate these waveforms (timer, counter, etc..) ?
      4.    
         

      I was hoping to try a different way than just adding NOPs in a for loop.