AVR fuses ERROR


 

Steve_M

TVWBB Guru
I managed to get the TC circuit working on my 1st v4.2.4 board, but now I'm unable to update the ATmega chip. The system runs fine and I can make config changes, I just can't update the firmware. I've tried 2 different ATmega328 chips and get the same results.

echo -e "\\n/config\\n" > /dev/ttyAMA0 returns nothing

cat /dev/ttyAMA0 returns 4 x $HMSU lines followed by 1 x $HMAR line

lmclient LMDC,0 returns OK

avrupdate returns:

Stopping LinkMeter OK

LinkMeter platform is BCM2708
AVR fuses ERROR

Starting LinkMeter OK

On the J8 pads I have:

RST: 0v ( this will momentarily show 0.08v when running avrupdate )
TX: 3.3v
RX: 3.44v
 

Bryan Mayland

TVWBB Hall of Fame
You need to check continuity between MOSI, MISO, SCK, and GPIO25->Reset as those are what is used to flash the chip not ttyAMA0. The reset you can check just by watching the device. When you hit avrupdate you should see heatermeter blink off then back on (rebooting) if it does not that's your problem else it is the 3 other lines.
 

Steve_M

TVWBB Guru
You need to check continuity between MOSI, MISO, SCK, and GPIO25->Reset as those are what is used to flash the chip not ttyAMA0. The reset you can check just by watching the device. When you hit avrupdate you should see heatermeter blink off then back on (rebooting) if it does not that's your problem else it is the 3 other lines.

Those all trace out fine:

MOSI on RPI <> ATmega pin 17
MISO on RPI <> ATmega pin 18
SCK on RPI <> ATmega pin 19
G25 on RPI <> ATmega pin 1

On J8, RST doesn't pass a continuity test since there's a 0.1u cap in the path to ATmega pin 1

On the RPI I'm getting:

MOS = 3.3v
MIS = 0.01v
SCK = 3.5v
G25 = 3.3v

I have nothing to watch since this unit is without an LCD

Maybe this Gen 1 Model B RPI is bad?
 
Last edited:

Bryan Mayland

TVWBB Hall of Fame
Well it sounds like all the pins are connected ok then so I don't see any reason it shouldn't work. What do you get when you try to run this:
Code:
hmdude -v -v -v -v -b 128 -P/dev/spidev0.0
 

Steve_M

TVWBB Guru
# hmdude -v -v -v -v -b 128 -P/dev/spidev0.0
hmdude: compiled on Oct 3 2014 at 09:58:46
Using port: /dev/spidev0.0
SPI speed: 128 KHz
spi(ac, 53, 00, 00) = 00 00 00 00
Can't set AVR programming mode (0x00)
 

Bryan Mayland

TVWBB Hall of Fame
Ok so it isn't a bitrate problem, and no bytes are getting through at all. We can narrow it down to the reset or SPI if you do this. Open two terminals:
Code:
# In terminal 1
lmclient LMDC,0
cat /dev/ttyAMA0
Code:
# In terminal 2
hmdude -b 128 -P/dev/spidev0.0
The first you should see $HMSU lines and then when you run the hmdude command it should reset and you should see a $UCID line (micocontroller ID). If you see that then the reset is working but something is up with the SPI lines. If you don't see it, the reset isn't working. I'm not sure how to solve either of these but at least it might give you a direction to look.
 

Steve_M

TVWBB Guru
Yep. I see the $UCID entry each time I run hmdude

$HMSU,19,U,U,U,U,0,0,0,0*27
$HMSU,19,U,U,U,U,0,0,0,0*27
$HMSU,19,U,U,U,U,0,0,0,0*27
$HMAR,0,1,0,0,0,0*17

$UCID,HeaterMeter,20141222B*39
$HMSU,19,U,U,U,U,0,0,0,0*27
$HMAR,0,0,0,0,0,1*17
 

Bryan Mayland

TVWBB Hall of Fame
Well that's great so the reset is working perfectly so you can rule that out. The giant question now is what to do. You can't really check the data at the chip without a logic analyzer or at least an oscilloscope so I'm not sure where to go next.
 

Steve_M

TVWBB Guru
Well that's great so the reset is working perfectly so you can rule that out. The giant question now is what to do. You can't really check the data at the chip without a logic analyzer or at least an oscilloscope so I'm not sure where to go next.

I do have an o'scope, but it's probably not worth the trouble. I'm going to try with a different raspi to see if that works.
 

John Bostwick

TVWBB Wizard
I too have a few chips that have the same fault. I can change out the 328 and its fine. But the same chips continuesly fail on every heatermeter i have tried them on
 

Steve_M

TVWBB Guru
Looks to be related to the RasPi

Just Tried it with a Rev 2 Model B and it flashes fine.

# hmdude -v -v -v -v -v -v -b 128 -P/dev/spidev0.0
hmdude: compiled on Oct 3 2014 at 09:58:46
Using port: /dev/spidev0.0
SPI speed: 128 KHz
spi(ac, 53, 00, 00) = 00 00 53 00
AVR programming mode set
spi(30, 00, 00, 00) = 00 30 00 1e
spi(30, 00, 01, 00) = 00 30 00 95
spi(30, 00, 02, 00) = 00 30 00 0f
Device signature: ATmega328P
spi(50, 50, 00, 00) = 00 50 50 ff
Low: 0xff spi(58, 08, 00, 00) = 00 58 08 d7
High: 0xd7 spi(50, 08, 00, 00) = 00 50 08 fd
Ext: 0x05 spi(58, 00, 00, 00) = 00 58 00 ff
Lock: 0x3f

Code:
Stopping LinkMeter OK

LinkMeter platform is BCM2708
AVR fuses ffd705 OK

                          af4a465874cb4a45601919db7c79eeed  /tmp/hm.hex
hmdude: compiled on Oct  3 2014 at 09:58:46
Using port: /dev/spidev0.0
Loading ihex file: "/tmp/hm.hex" (23814 bytes)

    0% |                                                  |     0 (0.0s)
    0% |                                                  |     0 (0.0s)
    5% |##                                                |  1192 (0.1s)
   10% |#####                                             |  2382 (0.2s)
   15% |#######                                           |  3574 (0.4s)
   20% |##########                                        |  4764 (0.5s)
   25% |############                                      |  5954 (0.6s)
   30% |###############                                   |  7146 (0.7s)
   35% |#################                                 |  8336 (0.9s)
   40% |####################                              |  9526 (1.0s)
   45% |######################                            | 10718 (1.1s)
   50% |#########################                         | 11908 (1.2s)
   55% |###########################                       | 13098 (1.3s)
   60% |##############################                    | 14290 (1.5s)
   65% |################################                  | 15480 (1.6s)
   70% |###################################               | 16670 (1.7s)
   75% |#####################################             | 17862 (1.8s)
   80% |########################################          | 19052 (2.0s)
   85% |##########################################        | 20242 (2.1s)
   90% |#############################################     | 21434 (2.2s)
   95% |###############################################   | 22624 (2.3s)
  100% |##################################################| 23814 (2.4s)
Update successful
Starting LinkMeter OK

Swapped back the 256MB Model B and it's back to "AVR fuses ERROR"
 

John Bostwick

TVWBB Wizard
Thanks steve, i may need to check them with my other Rpi's then. I have a about 4 chips that have the same error with the fuses. I have them with working heatermeters and none of them have been able to program correctly. Then i put in a freshly new chips and it works just fine.

Now, instead of changing the chips, i will try changing the Pi's.
 

Steve_M

TVWBB Guru
Yeah, it's a strange one for sure. I even swapped the SD cards and wifi adapter, so the only different component was the bare bones RasPi. I wonder if this is a bug of some sort.
 

Bryan Mayland

TVWBB Hall of Fame
Wow that is crazy especially considering I developed HeaterMeter v4 on a 256MB Pi. I fried it by putting 5V to some of the I/O though so it is possible I broke something along the way. Welp thanks for working through the problem, I am sure our troubleshooting will be valuable to others.
 

Steve_M

TVWBB Guru
When I have time, I'll fire up a full version of raspbian on the 256 Model B and see if I can communicate with the ATmega chip on a breadboard.
 

Bryan Mayland

TVWBB Hall of Fame
or issue with the smaller memory size?
Nah we only use about 16MB. I've got a heatermeter running on a GL.iNET here here which has 64MB (huge for a mips router!) and it flashes just fine too. Not sure why the original doesn't work right, but I can say that it used to but there's no way to test any more, they stopped making those a year ago!
 

Steve_M

TVWBB Guru
Well, in some sort of freak accident, I managed to nuke my Rev 2 model B while putting it back onto the HM board. I think I'm just going to deem this first v4.2.4 board cursed and use it only for spare parts. The amount of time I've spent doing things to revive it is bordering on ridiculous! I think I'll spend my time working on adding a TC jack and probes to the servo damper instead!
 

Steve_M

TVWBB Guru
After some additional experimentation, it would appear that the SPI bus on my Gen 1 Model B is messed up.

I've got a fresh install of Raspbian running and have the HM board married to the RasPi, powered up over the 5v microusb port and am using avrdude compiled from https://github.com/kcuzner/avrdude

On the Gen 1 Model B

Code:
$ sudo /usr/local/bin/avrdude -c linuxspi -P /dev/spidev0.0 -p atmega328p  -U flash:r:"/dev/null":r 

avrdude: error: AVR device not responding
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

On another Gen 2 Model B:

Code:
$ sudo /usr/local/bin/avrdude -c linuxspi -P /dev/spidev0.0 -p atmega328p  -U flash:r:"/dev/null":r 

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f
avrdude: reading flash memory:

Reading | ################################################## | 100% 9.62s

avrdude: writing output file "/dev/null"

avrdude: safemode: Fuses OK (E:05, H:D7, L:FF)

avrdude done.  Thank you.
 

PatrickOttCA

New member
Ok so it isn't a bitrate problem, and no bytes are getting through at all. We can narrow it down to the reset or SPI if you do this. Open two terminals:
Code:
# In terminal 1
lmclient LMDC,0
cat /dev/ttyAMA0
Code:
# In terminal 2
hmdude -b 128 -P/dev/spidev0.0
The first you should see $HMSU lines and then when you run the hmdude command it should reset and you should see a $UCID line (micocontroller ID). If you see that then the reset is working but something is up with the SPI lines. If you don't see it, the reset isn't working. I'm not sure how to solve either of these but at least it might give you a direction to look.

Just finished my build, and I'm getting AVR fuses error too. I tried the commands above, but I don't get $HMSU or $UCID output. Any idea where I should concentrate my troubleshooting?

Thanks in advance!
 

 

Top