IOError and Installation Issues

Got my GrovePi and it is up and running. I followed the setup instructions from this link (though I did not update the OS as per the last step). Note too that I installed version 2015.03.20_Dexter_Industries_wheezy.img. There was a newer version on the repository, but there was no MD5 hash for it listed anywhere.

After setting up the wifi I attempted to do the initial test from this page (step 4). There was no file called grove_firmware_version_check.py, but I found one called grove_version_checky.py. It reported its version only as 255.255.255.255 which seems wrong, but the I2C program executed correctly (sudo i2cdetect -y 1).

On running the LED test program, everything is working as well. However, every so often there is an output of IOError. Despite this, there are no other ill effects observed. So, my questions are:

  1. What is the IOError indicating?
  2. What is the correct way to check the firmware
  3. Do I have the correct software installed?

Hey El Tea, you’re missing that file because it’s a relatively recent addition to the Github repo. All you need to do is change directories to the Github directory and do an update. When you refresh, you should see the file grove_firmware_version_check.py

1). The IOError: occasionally you’ll see an error on the communications bus. This isn’t really a problem unless you’re seeing nothing but errors. You can turn this off I think by commenting out a line in grovepi.py.
2). Update the github repo and run the above python file.
3). Sounds like you do!

John

OK, I did the software and firmware updates. All seems to be working. However…

I still get two kinds of errors. The odd part is that the program has this:

except IOError:
print “Custom IO Error”

But I see both these errors during execution:

IOError
Custom IO Error

They happen with no discernible pattern.

Is there a minimum wait time after making read/write requests? Is this the cause? Or is it something to do with features I’m not even using like I2C?

This could be important as I would like to use the sound sensor to measure events with precision in the 10 to 50ms range. Is that something I can do with a Model B and GrovePi+?

Mike

Hey El Tea,
It could be that you’re pinging the GrovePi too quickly (emphasis on could be). I think you should be able to ping it at least once every 100ms, depending on what you’re trying to read. I suspect 50ms could work though too. Putting a sleep in place often reduces these errors.
Care to share some code? Are you simply reading the the sound sensor, or are you doing something else as well?

Thanks. I didn’t realize that you need 100ms wait times between commands. However, I updated the code (it is not good code; my daughter and I are messing around with it) to ensure we had 100ms sleeps between commands and the issue persists. Here is the code:


red_led = 4
green_led = 3
blue_led = 7
spinny = 0

pinMode(red_led,"OUTPUT")
pinMode(green_led,"OUTPUT")
pinMode(blue_led,"OUTPUT")
pinMode(spinny,"INPUT")
time.sleep(1)

delay = 1.0

while True:
    try:
        #Blink the LED
        digitalWrite(red_led,1)         # Send HIGH to switch on LED
        digitalWrite(green_led,0)
        digitalWrite(blue_led,0)
        time.sleep(delay)

        digitalWrite(red_led,0)         # Send LOW to switch off LED
        digitalWrite(green_led,1)
        digitalWrite(blue_led,0)
        time.sleep(delay)

        digitalWrite(red_led,0)
        digitalWrite(green_led,0)
        digitalWrite(blue_led,1)
        time.sleep(delay)

        spinny_val = analogRead(spinny)
        delay = spinny_val/1023.0
        if delay < 0.1:
                delay = 0.1
        time.sleep(0.1)

    except KeyboardInterrupt:   # Turn LED off before stopping
        digitalWrite(red_led,0)
        digitalWrite(green_led,0)
        digitalWrite(blue_led,0)
        break
    except IOError:                             # Print "Error" if communication error encountered
        print "Our generated IOError"

Here is the output:


pi@raspberrypi ~/Desktop/GrovePi/Projects/Grace_Projects $ sudo python gracegrace.py
IOError
IOError
IOError
IOError
IOError
Our generated IOError
Our generated IOError
IOError
IOError

Hi,
Can you check the grovepi.py file in GrovePi/Software/python folder and see if it has the debug variable enabled or disabled. It should look something like this: https://github.com/DexterInd/GrovePi/blob/master/Software/Python/grovepi.py#L51. When the debug is 1, it prints IOError and when it’s 0 it does not .

Do let us know if this helps.
-Karan