GPIO speed and GPIO reversal speed

ruddy
New Member Posts: 1
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
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
-
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 -
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.
Categories
- All Categories
- 105 Announcements & News
- 54 Product News - New Product/Product Change Notice/ End-of-life
- 186 Welcome Developers!
- 55 Unboxing & Project Sharing
- 50 Tech Updates
- 693 UP Products
- 11 UP 7000
- 1 UP Squared i12
- 10 UP Xtreme i12
- 11 UP Squared Pro 7000
- 1 UP Element i12 Edge
- 19 UP Squared V2
- 59 UP 4000
- 24 UP Xtreme i11
- 35 UP Squared 6000
- 60 UP Squared Pro
- 143 UP Xtreme
- 837 UP Squared
- 1.4K UP Board
- 89 UP Core Plus
- 222 UP Core
- 3 UP Xtreme Lite
- 44 UP AI Edge
- 216 Starter Kits & Peripheral