GrovePi+ disaapears from I2C on read_byte()

Hey guys,

I mentioned this issue earlier, but I have been having intermittent issues with the I2C ports on the GrovePi+ and Raspberry Pi B+. I’m on firmware v1.2.5 and have done the fuse fix (to get an analog GSR sensor working). I seem to be able to make the IOError go away if I reduced the frequency of reading the byte down to 2 seconds, but my professor is saying that that is not enough for what we need to do.

The particular sensor I am looking at is the Fingerclip heart rate sensor with case. I am using the datasheet of the PAH8001EI-2G for reference, although I haven’t even gotten to reading particular registers yet. I was reading up on certain incompatibilities between I2C and SMBus, and was wondering if those are handled by the GrovePi+ (more specifically the specs relating to v_high and v_low).

The output of i2cdetect -y 1 after it crashes is blank, but before it crashes it detects the Grove at 4x04 and my Heart rate sensor at 0x50. When running my code, it tends to output two consecutive IOErrors, then returns to normal. If it crashes, it outputs more than two IOErrors.

Here is my code I am using:


from smbus import SMBus
from time import sleep
import RPi.GPIO as GPIO

# compatibility for different versions of RasPi
# rev 2 or 3 will use bus address 1
# rev 1 will use bus address 0
rev = GPIO.RPI_REVISION
if rev == 2 or rev == 3:
	b = SMBus(1)
else:
	b = SMBus(0)

GPR_I2C_DEV_ID = 0x50

# test to see if this is always I2C-1
address = 0x50

# Pulse will return -1 in case of immediate IOError
pulse = -1

while True:
	# handling IOError incase Grove decides to go on a walk
	try:
		pulse = b.read_byte(address)
	except IOError:
		print("there was an IO Error")
	# print the pulse otherwise
	print(pulse)
	# wait two seconds
	sleep(2)

Again, if you end up with a heart rate sensor around, to reproduce this behavior quickly, reduce sleep to .1 and it should crash within 20 seconds.

Let me know if you need any other information. At this point I am thinking of bypassing the grove completely and using the raspberry pi’s GPIO pins.

EDIT : Also, if you know of a way I can bypass the Grove but still use the I2C port, let me know. We got the grove because the connections are so easy.

Hey,
This code is pretty much bypassing the GrovePi and only communicating with the heart rate sensor. If you want to completely remote the GrovePi from the I2C bus you should run this avrdude -c gpio -p m328p -e . This will erase the chip and the GrovePi will no longer be on the I2C bus (You can burn the firmware again by running the firmware update script).

Do let us know if this helps.

-Karan