1 Reply Latest reply on Feb 20, 2014 9:56 AM by JPMontero_Intel

    PWM signals from the Galileo



      I'm an electronic engineering student working on a robotics project. For an earlier robot I was using and arduino mega2560, and we needed to generate PWM signals for the H bridge for the two motors connected to the wheels. For each I needed to generate 2 PWM signals with an inverse phase and an easily changeable duty cycle to control motor speed.


      I was able to do this fairly easily by register level coding, modifying the signals generated from different timers like so :


      void PWM_Right_Motor(int direct){

          // direct : value between 0 and 255

          // pin 9 functioning with the value of direct and pin 10 functioning with its opposite

        //COM2 A1 and A0 at 1 for inverse PWM mode, just B1 at 1 for normal PWM

        TCCR2A = _BV(COM2A1) | _BV(COM2A0) | _BV(COM2B1) | _BV(WGM20); // 8 bit phase correct PWM mode

        TCCR2B = _BV(CS20);// prescale = 1 CS2






      I've now been given a Galileo Intel for a second robot, and I need to control the PWM signals in a similar way (set a frequency, have two perfectly in sync but opposed phase signals, and be able to easily modify the duty cycle of both from my main C code)


      I've not been able to do this so far, could someone point me in the direction of a tutorial for how to achieve this kind of thing or give me some pointers?


      I found this tutorial : http://www.malinov.com/Home/sergey-s-blog/intelgalileo-programminggpiofromlinux


      It seems to be the kind of thing I need to do, but I have never programmed in this way or used SysFs. I have not yet begun my embedded linux classes.


      Thanks for any help and guidance!