Can't flash heatermeter from linkmeter


 

Tom Kole

TVWBB Pro
I started this thread as per Bryan's request for discussing problems as new topics. I put together my heatermeter by following the schematics and reading many of the posts by all of the contributers on this site. I did not include the parts required for wireless probe assembly and installed the bootloader and flashed the heatermeter with a usbtiny. I bought a wrt54gl router that I flashed with the latest linkmeter firmware, and attached the heatermeter to the serial terminals on the router mainboard along with the 12V line from the router power connector. When I plugged in power, everything worked as expected. The unit reads temperatures from all probe ports, powers the blower, and displays properly on the LCD. Just for testing purposes, I tried to flash the AVR via the linkmeter interface and got the following error:

1051f2a9d6410072d44e2a47260f1217 /tmp/hm.hex
Stopping LinkMeter OK
hmdude: stk500_getsync(): not in sync: resp=0x0a
hmdude: stk500_getsync(): not in sync: resp=0x24
hmdude: stk500_getsync(): not in sync: resp=0x0a
hmdude: compiled on Feb 15 2012 at 15:43:06
Using port: /dev/ttyS1
Loading ihex file: "/tmp/hm.hex" (21948 bytes)
Starting sync (release RESET now)...
Sync: ERROR
Sync: ERROR
Sync: HeaterMeter
Sync: ERROR
Sync: ERROR
Update failed
Starting LinkMeter OK
Current HeaterMeter version is 20120628B

I then tried Bryan's suggestions from the main thread:

Originally posted by Bryan Mayland:
You may want to try running the update manually with verbose mode and seeing what you get. Log into the router over ssh/telnet and

cd /tmp
/etc/init.d/lucid stop
wget -O hm.hex http://capnbry.net/linkmeter/s.../heatermeter.cpp.hex
hmdude -v -v -v -v -U hm.hex

You can also check to see if your AVR has the old bootloader on it by replacing that last line with the lower baud rate
hmdude -v -v -v -v -U hm.hex -b 57600

If neither of those work, try hmdude (with the normal baud rate) except this time hold down the RESET button on the HeaterMeter and then press enter on the hmdude command and release RESET when it says to. If that works that would indicate your reset circuit isn't working

None of those options worked so I tried removing the board and re-burning the bootloader with the usbtiny. When I plugged everything back in I got nothing, no response from the heatermeter at all and the LCD was blank. I proceeded to take the board out again and then flash from the usbtiny. When I reassembled, I was back to where I started, but still no AVR flashing capability from linkmeter. My circuitry knowledge is limited and was wondering if anyone has any other suggestions? Should I just ignore and install updates via usbtiny when necessary?
 
Hey Tom, thanks for making a new thread. There's so many conversations going on in the giant thread, it is hard to follow.

What steps are you taking to burn with the tinyusb? Should be (from the Arduino software):
-- Tools -> Board -> Select Arduino Uno
-- Tools -> Programmer -> Select USBtinyISP
-- Tools -> Burn Bootloader
-- Should take a minute

At this point, your LCD will be blank because you've only got the bootloader. From there you need to install the HeaterMeter program via serial. Install the HeaterMeter board into the router.
<pre class="ip-ubbcode-code-pre">
cd /tmp
/etc/init.d/lucid stop
wget -O hm.hex http://capnbry.net/linkmeter/s.../heatermeter.cpp.hex
hmdude -U hm.hex
</pre>
EDIT: Note the forums software cuts off the url so you might need to right-click "copy url"

Before you press enter on the hmdude line, press and hold the RESET button on the HeaterMeter board, and press enter. After you see Starting sync (release RESET now)... release the RESET button.

Both these steps only need to be done the first time. The rest can be loaded through the AVR Firmware web interface.
 
I did all of those things with no luck. I keep getting the load error on the linkmeter side as above. I tried the manual reset too with no luck.
 
Doh! I was hoping you had flashed the program into the bootloader by mistake. Can you post me the output of hmdude with 4 "-v" options when trying to load the program via the commands from above? The last line would be:
hmdude -v -v -v -v -U hm.hex
 
I seem to be having similar if not the same problems.

I'm wondering if I am loading the software onto the Bootloader?

avrdude -c usbtiny -p atmega328P -U flash:w:heatermeter.cpp.hex


Connecting to capnbry.net (24.73.193.140:80)

hm.hex 11% |*** | 7038 0:00:07 ETA
hm.hex 29% |********* | 18718 0:00:04 ETA
hm.hex 48% |************** | 30398 0:00:03 ETA
hm.hex 68% |********************* | 43538 0:00:01 ETA
hm.hex 87% |*************************** | 55218 0:00:00 ETA
hm.hex 100% |*******************************| 61758 0:00:00 ETA
1051f2a9d6410072d44e2a47260f1217 /tmp/hm.hex
Stopping LinkMeter OK
hmdude: stk500_getsync(): not in sync: resp=0x0a
hmdude: stk500_getsync(): not in sync: resp=0x24
hmdude: stk500_getsync(): not in sync: resp=0x0a
hmdude: compiled on Feb 15 2012 at 15:43:06
Using port: /dev/ttyS1
Loading ihex file: "/tmp/hm.hex" (21948 bytes)
Starting sync (release RESET now)...
Sync: ERROR
Sync: ERROR
Sync: HeaterMeter
Sync: ERROR
Sync: ERROR
Update failed
Starting LinkMeter OK
Current HeaterMeter version is 20120527B

I'm wondering if I am loading the software onto the Bootloader ?

When I plug the board in the Fan comes on, the Pit reads a temp but the other probes are off. I tried the steps you mentioned and this is the output log I get.

oot@OpenWrt:~# cd /tmp
root@OpenWrt:/tmp# /etc/init.d/lucid stop
Stopping LuCId superserver: lucid.
root@OpenWrt:/tmp# wget -O hm.hex http://capnbry.net/linkmeter/snapshots/trunk/h
eatermeter.cpp.hex
Connecting to capnbry.net (24.73.193.140:80)
hm.hex 100% |*******************************| 61758 0:00:00 ETA
root@OpenWrt:/tmp# hmdude -U hm.hex
hmdude: compiled on Feb 15 2012 at 15:43:06
Using port: /dev/ttyS1
Loading ihex file: "hm.hex" (21948 bytes)
Starting sync (release RESET now)...
hmdude: stk500_getsync(): not in sync: resp=0x0a
Sync: ERROR
Sync: ERROR
hmdude: stk500_getsync(): not in sync: resp=0x24
Sync: HeaterMeter
hmdude: stk500_getsync(): not in sync: resp=0x0a
Sync: ERROR
Sync: ERROR
root@OpenWrt:/tmp# hmdude -v -v -v -v -U hm.hex
hmdude: compiled on Feb 15 2012 at 15:43:06
Using port: /dev/ttyS1
Loading ihex file: "hm.hex" (21948 bytes)
Starting sync (release RESET now)...
hmdude: Send: . [0a] / [2f] r [72] e [65] b [62] o [6f] o [6f] t [74] . [0a]
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: Recv: . [0a]
hmdude: stk500_getsync(): not in sync: resp=0x0a
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: Recv: $ [24]
hmdude: stk500_getsync(): not in sync: resp=0x24
Sync: HeaterMeter
hmdude: Send: . [0a] / [2f] r [72] e [65] b [62] o [6f] o [6f] t [74] . [0a]
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: Recv: . [0a]
hmdude: stk500_getsync(): not in sync: resp=0x0a
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR
root@OpenWrt:/tmp# wget -O hm.hex http://capnbry.net/linkmeter/snapshots/trunk/h
eatermeter.cpp.hex
Connecting to capnbry.net (24.73.193.140:80)
hm.hex 100% |*******************************| 61758 0:00:00 ETA
root@OpenWrt:/tmp# hmdude -V -V -V -V -U hm.hex
hmdude: compiled on Feb 15 2012 at 15:43:06
Unknown option '-V'
Unknown option '-V'
Unknown option '-V'
Unknown option '-V'
Using port: /dev/ttyS1
Loading ihex file: "hm.hex" (21948 bytes)
Starting sync (release RESET now)...
hmdude: stk500_getsync(): not in sync: resp=0x0a
Sync: ERROR
Sync: ERROR
hmdude: stk500_getsync(): not in sync: resp=0x24
Sync: HeaterMeter
hmdude: stk500_getsync(): not in sync: resp=0x0a
Sync: ERROR
Sync: ERROR
 
avrdude -c usbtiny -p atmega328P -U flash:w:heatermeter.cpp.hex
Actually, and here is one of the many many things about AVR development that gets confusing, you're flashing a user program to the right place *but* the default behavior of avrdude is to erase the chip if you tell it to write to flash. If you flash the bootloader, then flash heatermeter using that command line, it will erase the bootloader even though they both live in different sections of the flash.

I only know this because I wrote a super-slimmed down version of avrdude that's used on the LinkMeters.
-- You can only write to flash from an ICSP if the contents of the flash word at that memory location are 0xff
-- Performing a chip erase sets all memory and EEPROM to 0xff
-- To get around the problem of people not knowing they have to erase the chip before flashing new code, avrdude automatically performs a chip erase when you pass anything of the form "-U flash:w:*"

If you want to preload the chip with the bootloader and HeaterMeter before putting it in the router:
avrdude -c usbtiny -p atmega328P -U flash:w
icon_redface.gif
ptiboot_atmega328.hex:i

avrdude -c usbtiny -p atmega328P -D -U flash:w:heatermeter.cpp.hex:i

Note the -D in the second command line to disable the automatic chip erase. This should theoretically work because the first command erased all the flash. I've never tried it but I know the chips are capable of flashing in two parts because I did it this weekend with hmdude.
 
For some reason it is not liking the optiboot

I have my USBTINY plugged into my mac then I have the Arduino UNO plugged into the USBTINY via the cable

What I did was burn the bootloader from ardunio 1.0.1 and then used the avrdude command to write the heater meter hex.

avrdude -c usbtiny -p atmega328p -U flash:w
icon_redface.gif
ptiboot_atmega328.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

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
avrdude: reading input file "optiboot_atmega328.hex"
avrdude: error opening optiboot_atmega328.hex: No such file or directory
avrdude: input file optiboot_atmega328.hex auto detected as invalid format
avrdude: can't open input file optiboot_atmega328.hex: No such file or directory
avrdude: read from file 'optiboot_atmega328.hex' failed
 
Got the Optiboot loaded.

Probe 0 is getting a Temp reading
Probe 1,2,3 show as OFF (not disabled)
Fan is spinning

I don't have the LCD hooked up at the moment or the buttons.

Any ideas about the probes?
 
I created a new thread for your different problem to keep this one about problems loading the firmware.

I also notice I forgot the :i at the end of the avrdude command lines, I don't remember if that's needed but I'm glad you figured it out.
 
Thanks and sorry for hijacking your thread Kole.

I didn't realize it was ok to create new topics for the heater meter stuff. I thought that you were trying ti keep all hetermeter stuff to a single thread
 
Bryan, here is the output you requested:

root@OpenWrt:/tmp# hmdude -v -v -v -v -U hm.hex
hmdude: compiled on Feb 15 2012 at 15:43:06
Using port: /dev/ttyS1
Loading ihex file: "hm.hex" (21948 bytes)
Starting sync (release RESET now)...
hmdude: Send: . [0a] / [2f] r [72] e [65] b [62] o [6f] o [6f] t [74] . [0a]
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: Recv: . [0a]
hmdude: stk500_getsync(): not in sync: resp=0x0a
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: Recv: $ [24]
hmdude: stk500_getsync(): not in sync: resp=0x24
Sync: HeaterMeter
hmdude: Send: . [0a] / [2f] r [72] e [65] b [62] o [6f] o [6f] t [74] . [0a]
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: Recv: . [0a]
hmdude: stk500_getsync(): not in sync: resp=0x0a
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR
 
Originally posted by Dennis C:
Thanks and sorry for hijacking your thread Kole.

I didn't realize it was ok to create new topics for the heater meter stuff. I thought that you were trying ti keep all hetermeter stuff to a single thread

No problem. Were you able to install the bootloader and flash via the linkmeter? If so, what exactly did you do?
 
OK, all fixed. I originally burned the bootloader and flashed the AVR using the usbtiny and the info in this link:

https://github.com/CapnBry/Hea...er/wiki/Installation

When I did that and installed the heatermeter in the linkmeter, everything worked in terms of temp, fan, and lcd control but I had no ability to flash the avr firmware from the web interface and got the errors above. After reburning the bootloader, I instead entered the following in a telnet session from the link above under the "installing heatermeter from the router" section:

wget -O /tmp/hm.hex http://capnbry.net/linkmeter/s.../heatermeter.cpp.hex
avrupdate

This time the flash worked and when I went to the web interface and tried flashing from there, I got this:

Connecting to capnbry.net (24.73.193.140:80)

hm.hex 32% |********** | 21354 0:00:02 ETA
hm.hex 92% |**************************** | 60774 0:00:00 ETA
hm.hex 100% |*******************************| 61758 0:00:00 ETA
1051f2a9d6410072d44e2a47260f1217 /tmp/hm.hex
Stopping LinkMeter OK
hmdude: compiled on Feb 15 2012 at 15:43:06
Using port: /dev/ttyS1
Loading ihex file: "/tmp/hm.hex" (21948 bytes)
Starting sync (release RESET now)...
Sync: OK

0% | | 0 (0.0s)
5% |## | 1152 (0.2s)
10% |##### | 2304 (0.3s)
15% |####### | 3328 (0.5s)
20% |########## | 4480 (0.6s)
25% |############ | 5504 (0.8s)
30% |############### | 6656 (0.9s)
35% |################# | 7808 (1.1s)
40% |#################### | 8832 (1.3s)
45% |###################### | 9984 (1.4s)
50% |######################### | 11008 (1.6s)
55% |########################### | 12160 (1.7s)
60% |############################## | 13184 (1.9s)
65% |################################ | 14336 (2.0s)
70% |################################### | 15488 (2.2s)
75% |##################################### | 16512 (2.3s)
80% |######################################## | 17664 (2.5s)
85% |########################################## | 18688 (2.7s)
90% |############################################# | 19840 (2.8s)
95% |############################################### | 20864 (3.0s)
100% |##################################################| 21948 (3.1s)
Update successful
Starting LinkMeter OK
Current HeaterMeter version is 20120527B

Now I'm all set. Thank you Bryan.
 
Bryan, I noticed that the heatermeter versions are different between what is loaded via the linkmeter vs what is installed via the arduino software using usbtiny. Could that be what caused my issues?

Current HeaterMeter version is 20120628B

vs.

Current HeaterMeter version is 20120527B
 
Iiiiiit really shouldn't make a difference because that code hasn't changed in a while. I know the stuff you can build from the Arduino source in github is a newer version, but that just adds the alarm function. I'm not sure why one would work and not the other.

Glad you got it working though, I know how frustrating this whole project can be to build and get working. Hopefully the Pi incarnation will be a lot smoother.
 
That's good to hear!! I'm actually getting the same errors when I try re-flashing my AVR...I too get this via the webinterface or command-line under Linux. I can not flash AVR and my web interface is not working correctly as I can't update setpoint and or probe type, coefficients, etc; e.g. when I attempt to update the probes coefficients it puts all three values into A.

I ordered the AVR from Sparkfun with the bootloader already installed. My initial flash via the router was successful and everything worked except the LCD; ended up that I had flashed with the HexA file instead of hex. Re-flashed with the correct hex and that fixed my LCD but I lost the other functionality mentioned above.

Just ordered a usbtiny so will try doing what you did once it arrives.

Thanks again.



Originally posted by Tom Kole:
OK, all fixed. I originally burned the bootloader and flashed the AVR using the usbtiny and the info in this link:

https://github.com/CapnBry/Hea...er/wiki/Installation

When I did that and installed the heatermeter in the linkmeter, everything worked in terms of temp, fan, and lcd control but I had no ability to flash the avr firmware from the web interface and got the errors above. After reburning the bootloader, I instead entered the following in a telnet session from the link above under the "installing heatermeter from the router" section:

wget -O /tmp/hm.hex http://capnbry.net/linkmeter/s.../heatermeter.cpp.hex
avrupdate

This time the flash worked and when I went to the web interface and tried flashing from there, I got this:

---snip---
 
Just make sure that after you burn the bootloader with the usbtiny and arduino software, and install the heatermeter in the linkmeter, you press and hold reset on the heatermeter before hitting enter on the avrupdate command. You release the reset button as soon as you are prompted by the telnet output.

1. Connect heatermeter to usbtiny
2. Open arduino software
-- Tools -> Board -> Select Arduino Uno
-- Tools -> Programmer -> Select USBtinyISP
-- Tools -> Burn Bootloader
-- Should take a minute
3. Disconnect usbtiny and install heatermeter into linkmeter
4. telnet into linkmeter
5. Enter: wget -O /tmp/hm.hex http://capnbry.net/linkmeter/s.../heatermeter.cpp.hex (use full address)
6. press and hold reset on heatermeter
7. Enter: avrupdate
8. Release heatermeter reset when prompted
 
Hey,

i have the problem with the avr flash too.
I tried everything but nothing works.
At first I tried to flash it from the router with Putty(ssh because telnet doesn´t work) because i bought a chip with optiboot but I only got this:

root@LinkMeater:~# wget -O /tmp/hm.hex http://capnbry.net/linkmeter/snapshots/tr
unk/heatermeter.cpp.hex
Connecting to capnbry.net (24.73.193.140:80)
hm.hex 100% |*******************************| 64429 0:00:00 ETA
root@LinkMeater:~# avrupdate
38ef88174a746c0335e474f4c08b1a37 /tmp/hm.hex
Stopping LinkMeter OK
hmdude: compiled on Feb 15 2012 at 15:43:06
Using port: /dev/ttyS1
Loading ihex file: "/tmp/hm.hex" (22900 bytes)
Starting sync (release RESET now)...
Sync: ERROR
Sync: ERROR
Sync: ERROR
Sync: ERROR
Sync: ERROR
Update failed
Starting LinkMeter OK
Current HeaterMeter version is Unknown
root@LinkMeater:~#


Then I bought a USBTinyISP and installed the Bootloader again with arduino-1.0.1
After about a minute the programm says "Bootloader installed"
Then I go to sketchbook>heatermeater and upload but at the end of the upload i got this: avrdude: stk500_getsync(): not in sync: resp=0x00

I also tried the avrdude with avrdude -c usbtiny -p atmega328P -U flash:w:heatermeter.cpp.hex but this one says:


avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

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
avrdude: reading input file "heatermeter.cpp.hex"
avrdude: error opening heatermeter.cpp.hex: No such file or directory
avrdude: input file heatermeter.cpp.hex auto detected as invalid format
avrdude: can't open input file heatermeter.cpp.hex: No such file or directory
avrdude: write to file 'heatermeter.cpp.hex' failed

avrdude: safemode: Fuses OK

avrdude done. Thank you.

I placed the heatermeater.cpp.hex in C:/. Is that right?

I also tried this:

cd /tmp
/etc/init.d/lucid stop
wget -O hm.hex http://capnbry.net/linkmeter/snapshots/trunk/heatermeter.cpp.hex
hmdude -v -v -v -v -U hm.hex

But I got this:


root@LinkMeater:/tmp# wget -O hm.hex http://capnbry.net/linkmeter/snapshots/trun
k/heatermeter.cpp.hex
Connecting to capnbry.net (24.73.193.140:80)
hm.hex 100% |*******************************| 64429 0:00:00 ETA
root@LinkMeater:/tmp# hmdude -v -v -v -v -U hm.hex
hmdude: compiled on Feb 15 2012 at 15:43:06
Using port: /dev/ttyS1
Loading ihex file: "hm.hex" (22900 bytes)
Starting sync (release RESET now)...
hmdude: Send: . [0a] / [2f] r [72] e [65] b [62] o [6f] o [6f] t [74] . [0a]
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR
hmdude: Send: 0 [30] [20]
hmdude: Send: 0 [30] [20]
hmdude: ser_recv(): programmer is not responding
Sync: ERROR

Here is a Picture of my Heatermeaterboard v3.2
Maybe someone could see if I did something wrong



I also have one wire connected from the router to J7/1 at the board



Is that right?

Can anybody please help me???
(Sorry for my english, I´m from germany)
 
Have you connected the Heatermeter to the Router using the Serial connection. That one wire will give you +12v to the board, but its not grounded, so it would not be on. To have a communicate to the router and to have it grounded to the router it needs to be connected to the serial connector of the router using the 5 pin connector that is next to the reset button on the heatermeter.

If you are using USBTinyISP and arduino-1.0.1

Download the zip
https://github.com/CapnBry/HeaterMeter/downloads

Then open the zip and find arduino

Take the file folder arduino and move it to Documents>arduino-1.0.1-windows>arduino-1.0.1>examples

Then you have to put the libaries into the library folder

open the zip again and find arduino>libaries

Copy the folders to

Documents>arduino-1.0.1-windows>arduino-1.0.1>libaries

It should now verify

In arduino-1.0.1

File>examples>arduino>heatermeter then when the new window opens click verify
 

 

Back
Top