We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Are the GPIOs SLOW?



  • Hello,

    Im porting a project from Arduino to Omega2. The code runs fine in Arduino.

    As a test, I wrote a simple C code to toggle a couple GPIOs as shown for Omega2

     while(1) {
       digitalWrite(PWM_LEFT_PIN,0);
       digitalWrite(PWM_RIGHT_PIN,1);
       usleep(5);
       digitalWrite(PWM_LEFT_PIN,1);
       digitalWrite(PWM_RIGHT_PIN,0);
       usleep(5);
     }
    

    The low level code im using to control the ports is here, called inside digitalWrite()

    https://github.com/Patryk27/omega2-gpio

    My test code should toggle the port every 5 micro seconds, however when i put it on the scope its closer to 75 microseconds.

    Am I doing something wrong?

    maybe the uSleep is causing it?

    Anybody has Idea?

    Thanks



  • Can you profile digitalWrite function only?
    Like this,

     while(1) {
       digitalWrite(PWM_LEFT_PIN,0);
       digitalWrite(PWM_LEFT_PIN,1);
     }
    

    With this code, what's the wavelength of output signal on LEFT_PIN ?


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.