Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor II
1,662 Views

ARRRRGH! Is there any way to switch GPIO faster ???!!!!

https://software.intel.com/en-us/user/1065274 Dallas P.

Fri, 03/20/2015 - 05:59

I really, Really, REALLY need to be able to switch GPIO pins from out to in faster. Surely there is a way to do this that doesn't require calling the Linux file I/O API (???!!!) like mraa_gpio_dir() does. The latency involved in this one simple mraa function is costing us over $100 per unit. If I can get this worked out I can read my sensors directly from GPIO and I don't need a PIC (and the associated cost and complexity) to do it for me. I mean the idea of adding additional computing resources to a platform suffering from an over abundance of processing power is just silly. Especially when all I need to do is read a few DTH11/22s.

I know that the actual hardware part of this works pretty quickly. I can generate the reset pulse then call mraa_gpio_dir() and see it switch almost immediately because I see the sensor able to drive the pin for the 80us presence pulse and all 40 subsequent bits of data. But I don't get control back quickly enough to start reading the pulses. I miss the presence pulse and 6-8 bits of the data. Is the actually hardware switching done by this code from mraa_gpio_dir() maybe?

if (advance_func->gpio_dir_replace != NULL) {

return advance_func->gpio_dir_replace(dev,dir);

}

if (advance_func->gpio_dir_pre != NULL) {

mraa_result_t pre_ret = (advance_func->gpio_dir_pre(dev,dir));

if (pre_ret != MRAA_SUCCESS) {

return pre_ret;

}

}

I've heard the "you shouldn't bit-bang under Linux" argument and I see the point, but there are very sound reasons (economics being a good one) to be able to interface to external components like the DHT22/11's via the GPIO. I mean it's the IoT for cryin' out loud. You wanna put Galileo/Edison in everything from waffle irons to tractors, you're gonna need to do a little more than blink LEDs. Well maybe not for the waffle iron application ...

Any pointers would really be appreciated.

Thx,

Dallas

3 Replies
Highlighted
Honored Contributor I
11 Views

Re: ARRRRGH! Is there any way to switch GPIO faster ???!!!!

https://software.intel.com/en-us/user/183576 matthias-hahn (Intel) Fri, 03/20/2015 - 06:23

as a workaround for 1-wire protocol you might consider using a diode and 2 GPIO?

Highlighted
New Contributor II
11 Views

Re: ARRRRGH! Is there any way to switch GPIO faster ???!!!!

https://software.intel.com/en-us/user/1065274 Dallas P. Fri, 03/20/2015 - 06:35

Yeah, we're pursing that now. At first I couldn't get it to work but I believe we boarded it up wrong. Eat's a lot of pins but I can live with it if I can leave off the PIC and associated I2C uart and muxes etc. ad infinitum.

Thanx for the quick response Matthias!

Highlighted
Community Manager
11 Views

Re: ARRRRGH! Is there any way to switch GPIO faster ???!!!!

Hi Dallas,

Were you able to to get a 2 pin solution working? I went the PIC route, but its become a lot of... frustration

0 Kudos