GPIO speed and GPIO reversal speed

ruddyruddy Posts: 1New Member
Hi,
I bought two upboards, the operation system is ubilinux, I use eclipse to develop my program.
I have DAC chips that need the GPIO reversal speed is more than 800 kHz to control the sampling rate. But I tested today that, the reversal speed is about 90 kHz. The test code is example from /usr/share/marr/gpio-blink.cpp . The main code is
iopin=8;
signal(SIGINT, sig_handler);
mraa::Gpio gpio(iopin);
mraa::Result response = gpio.dir(mraa::DIR_OUT);
if (response != mraa::SUCCESS) {
mraa::printError(response);
return 1;
}

while (running == 0) {
response = gpio.write(1);
sleep(1);
response = gpio.write(0);
sleep(1);
}
return response;


I connect iopin=8 to the oscilloscope, I can see the period is about 2s, it demonstrates that the GPIO woks well.

then I replace the while loop as
while (running == 0) {
response = gpio.write(1);
response = gpio.write(0);
}

the delay function has been deleted, I check the oscilloscope, the period is about 11us. I think the reversal speed is quite low.
Do you have any idea to improve the reversal speed.
Another question, I saw the upboard supported high resolution timer at 1 ns, do you have some examples to use the high resolution timer.
Thank you very much.
Best regards
Ruddy

Comments

  • Nicola LunghiNicola Lunghi Posts: 131Emutex mod
    Dear ruddi100
    we are aware of the low GPIO speed on the UP/UP^2 and is due to a problem with the GPIO controller on the Intel SoC.
    Is possible to obtain higher speeds writing directly on SoC register but this is not so simple so require a custom implementation of the driver.
    Please contact us at [email protected] for a quote about this work.
    Regarding the High Resolution Timer we don't have example code to share about it but the driver is managed by Intel directly.
    Please ask this information on the Intel Customer Support https://communities.intel.com/community/tech

    Regards
    Nicola Lunghi
  • Nicola LunghiNicola Lunghi Posts: 131Emutex mod
    Also instead of using the GPIO directly to drive the motors for high speed application you could use driver board that are interfaced with I2C/SPI bus.
    That should permit higher and more dependable speed.
Sign In or Register to comment.