Analog Read does not work / board broken?

Hi,

I just got my GrovePI+ and after some struggle I got it to work…once… I could read use digital outputs: tested with /Software/Python/grove_led_blink.py.
I tested the board with RPI 1 B and RPI 2 B - the same poor result. I was very excited about the hardware because it seems to be a perfect solution for educational use but my enthusiasm faded in the process…
My observations:

  1. I grabbed latest software from github and run install script.

  2. I’ve started with firmware update:
    pi@raspberrypi ~/GrovePi/Firmware ./firmware_update.sh The firmware update finished correctly, and I got following detection result: pi@raspberrypi ~ sudo i2cdetect -y 1
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: – 04 – -- – -- – -- – -- – -- –
    10: – -- – -- – -- – -- – -- – -- – -- – --
    20: – -- – -- – -- – -- – -- – -- – -- – --
    30: – -- – -- – -- – -- – -- – -- – -- – --
    40: – -- – -- – -- – -- – -- – -- – -- – --
    50: – -- – -- – -- – -- – -- – -- – -- – --
    60: – -- – -- – -- – -- – -- – -- – -- – --
    70: – -- – -- – -- – --

  3. Next step was testing digital output:
    pi@raspberrypi ~/GrovePi/Software/Python $ sudo python grove_led_blink.py
    Success!

  4. Next test is the analog input with rotary sensor (removed the try/catch to better show the error):
    pi@raspberrypi ~/GrovePi/Software/Python $ sudo python grove_rotary_angle_sensor.py
    Traceback (most recent call last):
    File “grove_rotary_angle_sensor.py”, line 58, in <module>
    sensor_value = grovepi.analogRead(potentiometer)
    File “/home/pi/GrovePi/Software/Python/grovepi.py”, line 197, in analogRead
    bus.write_i2c_block_data(address, 1, aRead_cmd + [pin, unused, unused])
    IOError: [Errno 5] Input/output error

  5. It failed. I decided to run I2C detection again and there was a surprise:
    pi@raspberrypi ~/GrovePi/Software/Python $ sudo i2cdetect -y 1
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: – -- – 06 – -- – -- – -- – -- –
    10: – -- – -- – -- – -- – -- – -- – -- – --
    20: – -- – -- – -- – -- – -- – -- – -- – --
    30: – -- – -- – -- – -- – -- – -- – -- – --
    40: – -- – -- – -- – -- – -- – -- – -- – --
    50: – -- – -- – -- – -- – -- – -- – -- – --
    60: – -- – -- – -- – -- – -- – -- – -- – --
    70: – -- – -- – -- – --
    GrovePi+ board is no more visible at address 0x04??!!!

Could you help me to get it to work. I tried to contact Dexter this week and ask for replacement board based on following post:
http://www.dexterindustries.com/topic/readanalog-errno-5/
But I haven’t received any response. Maybe they are on vacation :slight_smile:

Cheers,
Radek

Hey Radek,
Thanks a lot for the detailed post. The 06 appearing on the i2cdetect does seem a bit weird and we haven’t seen that before. It would be great if you could try out a couple of things. Can you download the script that I have attached, make it executable sudo chmod +x grove_analog_test.txt and run it sudo ./grove_analog_test.txt. In the end it should start running the analog read on port A1.

If that does not work, can you try out the Dexter Industries flavour of Raspbian from here: http://www.dexterindustries.com/howto/raspberry-pi-tutorials/install-raspbian-for-robots-image-on-an-sd-card/ and then try the same test as before.

The problem might be a hardware problem or it might be a software problem too. It would great if you could try out the steps above and do let us know if the helps…

-Karan

Hey Karan,

thank you for quick response. Was executing the file line by line. The wget-s complete OK. The first command which failed was:
sudo python grove_firmware_version_check.py
Reading analog input failed the same way like before - with error.
See attached log.

I run the detect after the last command and this is the result - the board disappeared:
pi@raspberrypi ~/test $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – -- – -- – -- – -- – -- – -- –
10: – -- – -- – -- – -- – -- – -- – -- – --
20: – -- – -- – -- – -- – -- – -- – -- – --
30: – -- – -- – -- – -- – -- – -- – -- – --
40: – -- – -- – -- – -- – -- – -- – -- – --
50: – -- – -- – -- – -- – -- – -- – -- – --
60: – -- – -- – -- – -- – -- – -- – -- – --
70: – -- – -- – -- – --

Any ideas?
Best regards,
Radek

The test with Dexter image gave the same results - see attached.
Led blinks but analog read fails.

I hope it is a software problem…
Any advice?

Radek

Hey Radek,
Can you contact us through our contact page, under “General Questions and Feedback”http://www.dexterindustries.com/site/?page_id=65 and also mention a link to this discussion. I’ll also let the team know about this and we’ll send you a replacement ASAP.

Let me try a few more things at my end and it would be great if you could stick around for a bit and help us debug this problem while waiting for the replacement.

I’m sorry for the inconvenience.
-Karan

Hi Karan,

I’ve just send a message as you advised. I can aid you in debugging as much as you need it - no problem. Just let me know what to do.

Cheers,
Radek

Hey Radek,
We were able to replicate the problem at our end and it looks like it was a problem with the fuses which were burnt on the GrovePi. Can you try running the script that I have attached (Make the script executable sudo chmod +x grove_setup.txt and run it sudo ./grove_setup.txt.) and let us know if the problem goes away for you.

-Karan

Hi Karan,

Good and bad news:

  1. With dexter image - it works - yay! The analog is working.
  2. With my own image - I got a message during firmware update about fuses value changed if I want to keep it and I said yes. It does not work though - the same errors - I can not even get firmware version

I’ve updated my own image in #2 using the recommended procedure from github. So if somebody will by trying this method - he will run into the same problem.
Is there any documentation about the efuses I could read to understand what the problem was?

Thank you for all your help!
Cheers,
Radek

Hey Radek,
Great to hear that it is working with with the DI image.

tl;dr: I am pretty sure that the fuse error would be a harmless one, but can you repeat the process and paste the output that you get so that we can verify that it’s not a big change in the fuse settings.

Basically, setting the fuse is setting up certain registers to how you want the MCU to run. There are things like clock source, clock divider which have to be set for the first time when you use the MCU. We do this in the factory itself. Though you should be a bit careful with this, because you can permanently brick the MCU which will make the GrovePi useless and the only way to recover is to change the MCU. You can refer to the fuse documentation in the datasheet from here: http://www.atmel.com/images/doc8161.pdf (check page 295, Sec 27.2 Fuse Bits) or you can use this too: http://www.engbedded.com/fusecalc/. Some of the bit’s in the fuse don’t have any function, so they may be returned as something different. It is perfectly normal, but the software panics.

-Karan