AVR ASM Code availability?

18 replies [Last post]
steve
Offline
Joined: 28 Feb 2011

Hi

Have my livebox running HAH since upgrading both the firmware and adding the hardware to it last weekend and had a great afternoon with a few beers upgrading it :-) and been logging both 1wire temperatures and CCost via pachube.

My goal for your unit is to control (remotely) heating and water of a property I have abroad, major WAF here.

But I was wondering if your AVR code is available as I am interested in modding it, firstly I have fitted a 2X16 blue back lit LCD display for the WAF and also I had one to hand in my workshop, due to the 1X16 code the display is not showing correctly.

I would also like to modify the code to display time and date, plus other scrolling info.

Also in my haste in ordering I didn't stipulate the Homeeasy RF protocol over the lidl protocol... I understand if it’s not and I look forward to release of the Atmega upgraded

Steve

 

 

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
AVR code is available

Hi Steve,

Good to hear that you are making progress with the HAH. I also recall a great afternoon with a few beers ... it was sometime around  1980 ;-)

If you google for 'google code hah' you will find, as the first hit, the link to all of the source for the HAH project. Drill down to source/browse/trunk/userapps/hah/xap-livebox ... the BASCOM source code is there.

Many folks are waiting for the 'Universal RF' chip release. It is very close ... but still not quite ready for general release. If you need a specific capability ... the correct part can be had from the shop.

Cheers,
Derek.

percih70
Offline
Joined: 3 Jan 2011
hex file uploader

Here's two links on how to upload a hex file to an arduino board - ie once you have generated the new hex file in Bascom.

http://xloader.russemotto.com/

http://www.ngcoders.com/downloads/arduino-hex-uploader-and-programmer

lets know how you get on with the 16*2 display

cheers

Harry

brett
Offline
Providence, United States
Joined: 9 Jan 2010
AVR 328 Hex upload

I uploaded the HEX for the 328 AVR code its currently stand (v2.2) you need to switch to the 279.13 BETA HAH firmware if you want to play with it   Just flash an arduino up and then pop the chip into your existing HAH PCB and upgrade to your livebox /etc_ro_fs/update-dev hah-beta.dbzoo.com

http://code.google.com/p/livebox-hah/downloads/list

What new goodies do I get?

  • Universal RF - Derek has reported that it locks up after a while which is why this isn't Production yet.  I've not seen it do this thou.
  • I2C PPE support for the 8 PPE chips + all PCF8574 variants.
  • 1-WIRE ability to map a ROMID to an xAP endpoint.
  • AVR firmware command line enabled - # microcom -s 115200 /dev/ttyS0 (make sure xap-livebox is stopped first)

The beta build autodetects the AVR chip so it you put back the M8 it will still work (minus any RF settings as these aren't compatible) - The WEB gui also auto detects and hides various unsupported features such as 1-WIRE ROM mapping.

steve
Offline
Joined: 28 Feb 2011
Thanks for the info Harry,

Thanks for the info Harry, I'll keep you posted on progress with the 2x16 display, just waiting for a copy of Bascom to be delivered.

I have taken a look at the source AVR code and things there should be simple to modify for a 2X16 display, to get other info like date, time, local temp etc. I will need to modify the livebox XAP code.

Thanks to Derek for fast traking me to the AVR source code, and for this excellent project.. and any working code I change I'll post.

As Brett's previous post points out their's a taster of the 328 AVR code here too, I couldn't resist when I saw this and ordered two 328 chips on Friday from RS, and using a 328 arduino boot loader upgrades will be easy.

Just got another Live box of ebay to use as and R&D box.

Steve

brett
Offline
Providence, United States
Joined: 9 Jan 2010
SVN repository

One thing that might be an issue if you are building the xap-lua-engine (beta) branch.  I used swig version 2.0.1 to build the LUA/C glue logic if you try to compile with an older version it just won't.  Let me know if you run into issue compiling up this source branch as I've got a working copy on my dev box.    I updated the cross compile tools a while back as they where missing some libraries, ncurses I think, and perhaps another that is needed for LUA.  Just in case you have grabbed them before you might need to grab them again.  Let me know how you get one with the code as not too many people except me, only cause I wrote it, have really sat down and examined it in detail.  Hopeful you can follow my style.  Personally the BASCOM is aweful and I'd really like to ditch it re-write in C but I just don't have the time and sadly it does work so there isn't much to be gained except some personally happiness.

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Look in the BETA branch

You really should be using the BETA branch for looking at the source code I make no commitment that the BETA code has been backmerged to the trunk - certainly if you want to examine/modifyt he C code you *MUST* use the beta branch or you'll just not get very far.

http://livebox-hah.googlecode.com/svn/branches/xap-lua-engine/

percih70
Offline
Joined: 3 Jan 2011
Looks great with 16*2 display

Hello Steve

Yes - Ive added a 16*2 backlight display my R&D rig as well - I have to say it does look very cool.

(Tweaked Bascom line 164 to read "Config Lcd = 16 * 2 ")

 

Harry
steve
Offline
Joined: 28 Feb 2011
16X2 is the way to go

Hi Harry,

Happy you beat me to it and that it's a simple code change.

I'm still waiting for my copy of Bascom :-(

But I have this evening burned the 328 Hex and upgraded to the beta firmware for the livebox that Bret pointed out in a previous post... Now I have my home easy plug in modules working !!!.

Steve

steve
Offline
Joined: 28 Feb 2011
Thanks

Hi Brett

Uploaded the firmware and burned the HEX into a 328 AVR without a hitch. Everything has kicked off OK, registered 3 Homeeasy RF modules without a hitch :-).

I'll let you know If I have any lockups, but first impressions are positive

Steve

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Stability is everything

I'll be interested to hear how you go with this.

I was good for a day or two, then the URF stopped working. All other functions on the AVR seemed good. At this point I killed off xap-livebox and used microcom to drive the AVR interactively. There was an error reported in parsing the URF string.

We did subsequently tweak some of the Bascom stack settings. However, I've had no time to test this again. 

Derek.

percih70
Offline
Joined: 3 Jan 2011
photos of the 16*2 LCD

Added some photos of the new 16*2 LCD display added to a livebox.

http://harry-projects.blogspot.com/2011/04/adding-arduino-to-hah-livebox.html

 

Harry

steve
Offline
Joined: 28 Feb 2011
Looks Good

Hi Harry

Looking good,

Just for info I received my copy of Bascom last night and modded the AVR firmware to suit for the 16X2 display but using the new 328 code within the SVN

Steve

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
328 AVR Bootloader

Hi Steve,

Do you need the Ardunio bootloader on the 328 before you upload the HEX file?  I was going to buy a couple but then noticed that some had an Arduino bootloader and some didn't.  I will probably use AVRDUDE to program the 328 with Arduino  Duemilanove board, unless one of the programs mentioned above can also br used with the Arduino board.

Thanks for any advice,

 

Karl

brett
Offline
Providence, United States
Joined: 9 Jan 2010
A bootloader isn't necessary but preferable

The bootloader isn't necessary.   You can flash the HEX straight to the chip if you have an AVR ISP.  If you only have an Arduino to hand then you are going to need the 328's to have bootloaders so you can use AVRDUDE to flash the HEX.

Or if you have 2x Arduinos you can program one up as an ISP and use to install bootloaders on your other Arduino.  Having said that I tried this an never got it working property so I ended up using a real AVR ISP unit to install my bootloaders.

The programs mentioned above assume there is an bootloader installed without it they won't work.

Brett

steve
Offline
Joined: 28 Feb 2011
Hi Karl, As Brett has pointed

Hi Karl,

As Brett has pointed out, if you have an AVR ISP (as I'm presently doing) then go that way, they are cheap on flebay or you can build one, or as you have mentioned you can also use AVRDUDE and the Arduino bootloader.

I'm still slowly understanding BASCOM, and trying to work out how it's $loader and $loadersize work with the bootloader I'm using it's not one from BASCOM so maybe that's my issue! and the HAH AVR memory usage. From my recent experience I had a working boot loader with my modded 16X2LCD code for the HAH avr all looked good externally via the display but lost RF and 1 wire.

I went back to no bootloader and no BASCOM $loader or $loadersize and all worked well...

I'm just tinkering with the code in the evenings for interest but will post any minor changes I make, after all it's Brett and Derek who have put all the hard work into the present coding for this project and as you have seen from my requests are very open and happy to assist in any way they can.

Steve

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
ATMEGA328 Flashing

I've got hold of a couple of ATMEGA328P-PU's, but haven't been successful in programming with the latest AVR HEX file version 2.3.  The output from AVRDUDE is below and everything seemed to go ok, but when I put it in the HAH PCB the web interface reports Build: 279.19/1.0 and I can't control the relays from the WebGUI.  I've uploaded an Arduino sketch back to the 328, so I'm sure it's OK in itself.

I've also tried the microcom -s 115200 /dev/ttyS0 after killing xap-livebox, but there was no output.

Am I using the wrong ATMEGA328 chip or is the problem elsewhere, any ideas?

 

Thanks

Karl

 

C:\Users\Downloads\ArduinoUploader>avrdude -F -v -pm328p -cstk500v1 -P\\.\C
OM5 -b57600 -D -Uflash:w:"C:\Users\Downloads\livebox-urf.hex":i

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "C:\Users\Downloads\ArduinoUploa
der\avrdude.conf"

         Using Port            : \\.\COM5
         Using Programmer      : stk500v1
         Overriding Baud Rate  : 57600
         AVR Part              : ATMEGA328P
         Chip Erase delay      : 9000 us
         PAGEL                 : PD7
         BS2                   : PC2
         RESET disposition     : dedicated
         RETRY pulse           : SCK
         serial program mode   : yes
         parallel program mode : yes
         Timeout               : 200
         StabDelay             : 100
         CmdexeDelay           : 25
         SyncLoops             : 32
         ByteDelay             : 0
         PollIndex             : 3
         PollValue             : 0x53
         Memory Detail         :

                                  Block Poll               Page
      Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           eeprom        65     5     4    0 no       1024    4      0  3600  36
00 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  45
00 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0
 0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0
 0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "C:\Users\Downloads\livebox-urf.hex"
avrdude: writing flash (12204 bytes):

Writing | ################################################## | 100% 6.12s

avrdude: 12204 bytes of flash written
avrdude: verifying flash memory against C:\Users\Downloads\livebox-urf.hex:

avrdude: load data flash data from input file C:\Users\Downloads\livebox-ur
f.hex:
avrdude: input file C:\Users\Downloads\livebox-urf.hex contains 12204 bytes

avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 5.22s

avrdude: verifying ...
avrdude: 12204 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


C:\Users\Downloads\ArduinoUploader>





derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Chip is correct

The 328P is the correct part. I've never used avrdude, but note that if you bought a 'virigin' chip, it defaults to using its internal 1MHz clock and the 'divide clock by 8' fusebt will be set. If you bought a pre-prepared Arduino chip, it should have these settings already altered, but you might want to try changing the reset vector to avoid the Arduino bootloader being invoked.

Cheers,
Derek.

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
AVR Reset Vector and Clock Speed

Thanks Derek, that helps.  This is what I've bought, http://cgi.ebay.co.uk/ws/eBayISAPI.dll?ViewItem&item=320693024204&ssPage..., and it comes with a 16MHz XTAL.  But I think it could be the reset vector you mention, because if I put the chip back in the Arduino I can send a sketch to it, meaning the Arduino bootloader is being executed I guess. 

So I think my next step will be to change the reset vector and work out what the fusebt should be set to.

Thanks

 

Karl

Hardware Info