SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By VaultDweller
I was having problems reading some digital input using the Sparkfun GPIO block for the Intel Edison, so I decided to really simplify things. I created a very simple circuit with the 3.3 VCC connected to a 10k Ohm resistor (R1) and a jumper I could remove connecting it to ground, and a line between the resistor and the jumper going to GP44 on the GPIO board (See image below). In theory when the jumper is removed the pin should read high, and when the jumper is present it should read low. I created a very simple C++ program to just set the pin as input and read it 4 times per second, printing the response. What I saw happening was that when I started the program with no jumper it was reading high, and as soon as I added the jumper it would drop low, everything working as it should. However, once I took the jumper out it would stay low for about 5 seconds before going high again. When I hooked up my multimeter I could see as soon as I took the jumper out the voltage to the input pin was only around 1.2V for that 5 seconds (hence reading low) and would then go back to the 3.3. It is acting like there is a large capacitor it is charging. And sure enough, when I replaced the 10k Ohm resistor with a 1k Ohm resistor it now registers the change almost instantly (faster than I can notice at least). Worrying that it was something in my code I connected to the Edison using the serial port, ensured that GP44 was in input mode and read the values from "/sys/kernel/debug/gpio_debug/gpio44/current_value" and I was still seeing the same behavior. Is 0.33 mA not enough current to drive the input of this board? I'm very new to this so I don't fully understand how the internal pull up resistor may be effecting this, the pullmode is currently the default "pullup" and pullstrength is the default "50k", is this something I should change? I'm guessing this has something to do with the 3.3V level shifting on this board, but don't really understand what is happening. I'm mostly just curious as to why I apparently need to use a 1k resistor here.

Poorly drawn diagram:

C++ code used for testing:
Code: Select all
#include "mraa.hpp"  
int main() {  
  mraa_gpio_context pin31 = mraa_gpio_init(31);  
  mraa_gpio_dir(pin31, MRAA_GPIO_IN);  
  int in;  
  for (;;) {  
    printf("Read: %d \n",in);  
  return mraa::SUCCESS;  
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]