User Tools

Site Tools


flash_the_atmega

This is an old revision of the document!


Get the firmware

You can either take a pre-built firmware package from http://www.smarthomatic.org/builds/builds.html or build your own firmware. If you take the prebuilt package, extract it and continue with “Flashing the controller”.

Build your own firmware

Get a copy of the project, if you haven't already. When you're running Debian (or another Linux) this will do the job:

git clone git://github.com/breaker27/smarthomatic

Go into the base station firmware directory, build the firmware

pi@ninjablock ~/test $ cd smarthomatic/firmware/shc_basestation/
pi@ninjablock ~/test/smarthomatic/firmware/shc_basestation $ make
avr-gcc -c -gdwarf-2 -DF_CPU=20000000UL -DUART_BAUD_RATE=19200UL -DUART_RX=1UL -Os -mmcu=atmega328 -I.  -fdata-sections -ffunction-sections -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wundef -std=c99  -Wa,-adhlns=build/
[...]
avr-objdump -h -S build/shc_basestation.elf > build/shc_basestation.lss
avr-nm -n build/shc_basestation.elf > build/shc_basestation.sym

Fuses:
  LFUSE = 0xF7
  HFUSE = 0xD1
  EFUSE = 0x07

Image size:
   text    data     bss     dec     hex filename
  17264      33     739   18036    4674 build/shc_basestation.elf
pi@ninjablock ~/test/smarthomatic/firmware/shc_basestation $

Flashing the controller

pi@ninjablock ~/test/smarthomatic/firmware/shc_basestation $ avrdude -P /dev/ttyACM0 -c STK500 -p m328p -U flash:w:bin/ohc_basestation.hex -U lfuse:w:0xf7:m -U hfuse:w:0xd1:m -U efuse:w:0x07:m
flash_the_atmega.1380805231.txt.gz · Last modified: 2013/10/04 18:56 (external edit)