Grovepi crashing

I have a grovepi+ that keeps crashing. I’m not entirely sure whats going on.

After 6-20h it gets semi-non-responsive, but answers on i2c. The grovepi itself can’t read i2c at this point, but it can communicate when the rpi is the master.

I’ve added watchdog reset to the grovepi code, but it doesn’t help. What is even stranger is that flashing doesn’t work until powercycling:

$ avrdude -c gpio -p m328p -U flash:w:firmware.hex 

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip.
...
Reading | ################################################## | 100% 13.47s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x0c != 0x00
avrdude: verification error; content mismatch

avrdude: safemode: lfuse changed! Was ff, and is now 0
Would you like this fuse to be changed back? [y/n] 

After powercycling everything works fine again, but it seems a bit stupid to have another rpi to powercycle this one.
Should I just write this off as a faulty unit or has anyone else seen anything similar?

Actually, seems I was wrong. It worked before, but now it no longer flashes. (Not even with resetting the fuses again.)

I guess this one is garbage and can’t be rescued.

Problem is that I have another grovepi+ that also keeps crashing, but at least it comes back after a gpio pin 8 reset cycle… so far.
The only stable grovepi I have is now an old GrovePi without +. I guess I can’t get more of those? :stuck_out_tongue:

Hey Mirar,
Can you give a bit more details about how you have added the watchdog code. Have you tried burning the latest firmware https://github.com/DexterInd/GrovePi/blob/master/Firmware/Source/v1.2/grove_pi_v1_2_5/grove_pi_v1_2_5.cpp.hex and upgrading the software too to see if it helps. We haven’t seen both the errors that you are getting before. Both the power-cycle to reset and the GrovePi crashing.

Can you run the firmware update script first: https://github.com/DexterInd/GrovePi/blob/master/Firmware/firmware_update.sh so that the fuses are back to the right state.

-Karan

Yes, it doesn’t flash anymore even with the fuses reset… Might experiment more on it later.

I used AVR wdt_enable/wdt_reset on a 4s timer, first in the loop() and then in actually receiving an i2c command.
http://www.nongnu.org/avr-libc/user-manual/group__avr__watchdog.html
It worked fine and it reset as expected on not receiving i2c commands for four seconds. But it still hangs randomly with no recovering except on a gpio pin 8 reset. It’s very confusing and shouldn’t be possible. (Unless it hangs in a higher priority interrupt and the watchdog still needs to execute an interrupt.)

I suspect it’s because I used relays on it and the grovepi+ can’t handle the electrical shocks. The grovepi-non-plus does fine after soon a year without a single hanging, the one that is running the relay four times a day (curtains) hangs about once every one-three weeks and the one that can’t be flashed now switched relays about once a minute (driving a radiator) and hanged about 1-2 times on 24h. So the relays and grove+/non+ is the big difference. Since I right now only have three it’s not the biggest sample group.

If I have time I will check the power fluctuation when the relay is switching - I got a nice new oscilloscope that I want to learn how to use anyway. Probably not the next days though. (Time…)

Hey Mirar,
There is not a big difference b/w the GrovePi and the GrovePi+ in terms of how it handles sensors like a relay so I am not sure that why you are getting the problem. Since you are working with relays, there are 2 possibilities: 1) you somehow programmed bad fuses on the Atmega328p on the GrovePi and bricked it (we have seen this a few times) or 2) Power fluctuations might have killed the atmega.

It would be great if you could investigate this a bit more with your oscope and let us know what you find.

If you have a hot air rework station you should be able to replace the Atmega 328p with a chip from Sparkfun/Adafruit/Mouser/Digikey and try getting it to work again.

-Karan

I now have yet another Pi with yet another GrovePI+ that started crashing hard on relay switches:

All is fine:

pi@library:~/library$ 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:          -- 04 -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- 39 -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77                         

Play with the relays a bit (digitalWrite), less than 5 tries before it hangs:

pi@library:~/library$ 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: -- -- -- -- -- -- -- -- -- 39 -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77                         

reset it, and it shows up again:

pi@library:~/library$ ./gpio 8 export out off; sleep 1; ./gpio 8 on
pi@library:~/library$ 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:          -- 04 -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- 39 -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77                         

The GrovePi without plus (the only one I have) keeps working fine after over a year. I’m confused.
Am I the only one with this issue?

Hey,
We haven’t seen the issue before with the GrovePi. Can you use i2cdetect -y 1 instead of the i2cdetect 1 command. Can you try updating the firmware and software and see if the problem is still there.

-Karan