5 Replies Latest reply on Aug 4, 2015 2:59 PM by Intel_Alvarado

    minimum period possible in pwm

    gnadig

      Hi,

       

      Im trying to set period for pwm pin using period_us.I find its not taking value 500 microseconds or below that. I need to genrate a pwm with resolution of 30 microseconds. Could anyone pleas let me know what is the minimum  us possible on Galileo board or anyother alternative to generate pwm at 30us or lower values.

      config_percent works perfect if the time is in ms. But no functions at microsecond range.

       

      Thanks,

      Girish

        • 1. Re: minimum period possible in pwm
          Intel_Alvarado

          Hi

           

          According to EmutexLabs the valid range from the PCA9685 is from 666666 to 41666666 nanoseconds”. This means that the Galileo Gen 2 is not likely to reach the 30us you need for your application. You are using a Galileo Gen 1 or Gen 2?

           

          Sergio

          • 2. Re: minimum period possible in pwm
            gnadig

            Hi Intel_Alvarado,

             

            Thanks for response. I have intel galileo gen 2 board and an Edison board. Now trying it out with Edison. Seem to be working good so far. However I observed the following with Edison.

            1)  When I load my code with mraa method config_percent function it gives undefined symbol error.

            2)  But config_percent method is not available at microsecond resolution which is much needed I think. Because without that other alternative is to use the pulsewidth and period, which may not be so effective.

             

            Thanks and Regards,

            Girish

            • 3. Re: minimum period possible in pwm
              Intel_Alvarado

              Hi,

               

              I agree that using other alternatives may not be as efficient as using the config_percent, but this method is going to give an error if it is configured with values not within the valid range. Is the method working correctly with values inside the valid range?

               

              Sergio

              • 4. Re: minimum period possible in pwm
                gnadig

                Hi,

                 

                No not able to get the desired result, there are two things here.

                 

                1) How to use pwm->enable(true/false).

                     To set Hight bit I was using pwm->enable(true) with usleep().

                     To set Low ibit I tried pwm->enable(false). with usleep()

                     When I use pwm->enable(false) with usleep() it is not generating the required timing we can observe a flat low on oscilloscope.

                 

                2) Using pulsewidth_us(0).

                    I changed logic from step 1 to use only pulse width to create high /low in waveform.

                    enable is done only once in the begining.

                     pulsewidth set to 13 us while generating high waveform.

                     pulsewidht set to 0 while generating low part.

                    This creates waveform at required frequency but timing is not achevied. for example if Im genreating high for 200us then the resultant wave form say close to 350us.

                Not sure of how to make progress with this on Edison or galileo.

                 

                Regards,

                Girish

                • 5. Re: minimum period possible in pwm
                  Intel_Alvarado

                  Hi,

                   

                  When you say the resultant waveform do you mean that the high pulse of 200us that you wanted to achieve can’t be less than 350us or that the period of the signal results in 350us? Remember that the operational values of the pwm are from 666.6us to 41666.6us. If you are trying to get 200us and end up getting 350us in a high pulse the reason might be that you are using values not within the valid range.

                   

                  Sergio