I can't confirm grove firmware version


#1

When i run grove_firmware_version_check.py on Raspberry Pi 3 connected to GrovePi+, i get the following:

sudo python grove_firmware_version_check.py
Traceback (most recent call last):
File “grove_firmware_version_check.py”, line 40, in
print(“GrovePi has firmware version: %s” %grovepi.version())
File “/home/pi/Desktop/GrovePi/Software/Python/grovepi.py”, line 265, in version
return “%s.%s.%s” % (number[1], number[2], number[3])
TypeError: ‘int’ object has no attribute ‘getitem

Please help me.


#2

Hi @koueidesune,


Identifying the problem

This error you’re getting can happen when the user is treating a variable as a list when in reality it may be anything else - in our case it’s just an int number. It’s trying to access specific elements of a list and an error is thrown, because the variable ain’t a list.


More about the problem

So, why is number variable just an integer and not a list, just as it should have been?

The grove_firmware_version_check.py file uses at some point the following function:

# Read I2C block
def read_i2c_block(address):
	for i in range(retries):
		try:
			return bus.read_i2c_block_data(address, 1)
		except IOError:
			if debug:
				print ("IOError")
	return -1

If there’s something we can read from the I2C device (the GrovePi board), then this function returns a list with the appropriate values, otherwise it just returns a -1.

-1 is returned when the GrovePi is not reachable, so I assume it doesn’t have the firmware installed.


##Solution

Please follow the 3 steps provided in the following screenshot.



Now run your program and see if it’s working now.
If it worked, please tell us.


Troubleshooting

If it’s still not working for you, please follow the next steps provided in the following screenshot. Please attach the log.txt file here so we can take a better look.



TL;DR

I think you don’t have the firmware installed on the GrovePi.


Thank you!


Error on firmware_version_test and ic2 test
#3

Hi there, I am having the same issue. I tried the above 3 steps, rebooted and still having the same issue.

Thanks,
John


#4

Hi @john2,

Please follow the above troubleshooter and attach here the log.txt file.


Another thing we can do is to manually update the firmware.
Open up a terminal in your Raspberry Pi and type the following command:
sudo bash ~/Desktop/GrovePi/Firmware/firmware_update.sh

We would like to have a screenshot of the output of this firmware_update.sh.


Also, please do not have anything attached to your GrovePi (any kind of devices like sensors, HDMI cables, ribbon cables, etc) while updating it.
Please attach a picture of your setup.


Thank you!


Error on firmware_version_test and ic2 test
#5

Please find attached the pictures of my setup and the log file

Dexter_Software_Update_log_2017_05_23__08_16_29.txt (19.3 KB)


#6

Doing the manual update from the command line was successful as well, but the firware check still fails. For some reason I’m having trouble uploading the screenshots, but there’s nothing exciting about them. I’ll get them up asap.


#7

Hi @john2,

Thank you for the photos you’ve shared. They look okay .


Summarize

Please correct me if I’m wrong:

  • The board is working since you’ve succeeded flashing it. That’s a start.

  • Running the grove_firmware_version_check.py throws a TypeError exception.


My test

I’ve ran grove_firmware_version_check.py with and without I2C blacklisted. Where the I2C was blacklisted, I got an SMBus exception, while the other one worked (obviously).


Interpreting

Since you’ve succeeded flashing the GrovePi, this means the board is functional, so I think we can rule out the idea of a faulty board.
On the other hand, getting that error when running grove_firmware_version_check.py means communication through I2C protocol is down - or maybe that the GrovePi is not responding.

If the I2C isn’t blacklisted, then it would throw an SMBus exception, but it doesn’t. Instead, it raises a TypeError exception, which generally comes from the fact that GrovePi is not responding.

The GrovePi not responding and having a functional board with version 1.2.7 on it makes me think there is some small inconsistency between the firmware and the software on the GrovePi. This inconsistency might come from using different versions of the software.

My best guess is that on the Raspberry Pi there’s something that’s holding the I2C line (not like another process -> the SMBus is thread-safe) and it might throw an identical error to the one you’ve encountered - I don’t think there’s a software inconsistency, but that’s a wild guess without more information.


Next steps

Unfortunately, you haven’t uploaded the log.txt file.
Please take a look at my 2nd post on this topic (quicklink here) and see that I’ve referred to what the Troubleshooter outputs when we diagnose the GrovePi. I think it may hold important feedback.

Also, are you running a custom distribution of linux? I mean, do you use anything else other than Raspbian For Robots?
It’s okay if you run your own custom setup, but things can go wrong when trying to diagnose, because we’d have different/inconsistent environments.
So, if you’ve got something else, can you make the switch to Raspbian For Robots? Just for now, until we get the problem solved.
Here’s a link to how to install Raspbian For Robots.


I’m waiting to see what happens next.

Thank you!


#8

Hi Robert, thank you for your detailed troubleshooting! I actually did upload the log file with the pictures, but just in case, here it is again.

https://drive.google.com/file/d/0B8t_S3iTno0uMkVBUVl0MFZTUmVtak8xSnJwTnFYODJoRVNn/view?usp=sharing

Also, to confirm:

  • I am running Raspbian for Robots.
  • Running the grove_firmware_version_check.py throws a TypeError exception.
  • I2C is enabled in the configuration

Also tried connecting it to a different Pi with same result.

Honestly, it looks like i2c is running, but not finding the GrovePi

pi@dex:/etc/modprobe.d $ sudo i2cdetect 1
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-1.
I will probe address range 0x03-0x77.
Continue? [Y/n]
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --


#9

Hi @john2,

##Assumption
Judging by the output of i2cdetect -y 1 I think there may be a cold-joint somewhere along the I2C line.
In order to confirm such a possibility, please mark the next 2 suggestions.


##Good suggestion
Do you have any Grove device that works on I2C?
If you have bought a GrovePi Starter Kit, then you also have received a Grove RGB LCD which works via the I2C.
You can test the I2C line with this device.


##Best suggestion
Apart from testing with a Grove device, the best option would be to test it with a bare Raspberry Pi and hook up to it an I2C device through the 4 pins : the SDA, SCL, VCC-3.3V and GND. I think it’s better to test it alone, because you don’t know how the GrovePi can interfere with the Raspberry Pi.


Conclusion

After you succeed hooking up an I2C device, then you run again the i2cdetect -y 1 command and post here the results.


Thank you!