2 Replies Latest reply on Jan 3, 2015 9:16 PM by mmi

    Edison : PWM accuracy

    yoneken

      It seems that there is a linear delay for pwm period..

       

      When I set a period 20[ms] and duty 0.075.

      There is 1.8[ms] delay.

       

      When I set a period 20[ms] and duty 0.5.

      There is 1.8[ms] delay.

       

      When I set a period 40[ms] and duty 0.5.

      There is 3.6[ms] delay.

       

      I cannot satisfy this bad accuracy.

      Is this a hardware issue or something?

        • 1. Re: Edison : PWM accuracy
          yoneken

          I wrote a code like this.

           

          #include <stdio.h>
          #include <mraa.h>

          int main(int argc, char *argv[])
          {
            mraa_init();

            mraa_pwm_context pwm;
            pwm = mraa_pwm_init(6);
            mraa_pwm_period_us(pwm, 20*1000); // 20[ms]
            mraa_pwm_enable(pwm, 1);

            mraa_pwm_write(pwm, 1.5/20.0);
            sleep(60);

            mraa_pwm_enable(pwm, 0);

            mraa_deinit();

            return 0;
          }

           

          This code makes 21.8[ms] PWM.

           

          Any help would be appreciated.

           

          Best,

          yoneken

          • 2. Re: Edison : PWM accuracy
            mmi

            I guess we have to wait until the MCU will be activated to get more exact pwm results - if we are talking about the pure Edison, not the Arduino.