Closed 88gts closed 3 years ago
The xmas-icetube firmware too large to fit on the ATmega168, so you'll need to swap that chip for an ATmega328p. The "p" is also necessary to get the power saving features to extend backup battery life.
The error you're getting is happening just after the 16 kB mark, because the flash memory on the 168 is only 16 kB (0x4010 = 16400 = 16.02 kB). This error happens when loading code that is too large to fit in the flash memory.
Also, I would suggest installing the firmware with the Makefile (via "make install-all") to ensure that the eeprom, flash, and all fuses are all setup correctly. You'll need to change the "AVRISP ?= usbtiny" line in the Makefile to reflect your programmer.
Check out the firmware/README file for more details.
Good luck!
Thanks for the feedback, I went and picked up a couple 328ps, but now having trouble connecting. i was able to issue acrdude -c usbasp -p m168 to connect/flash the 168 chip. With the same programmer and tools, I cant connect to the 328p using avrdude -c usbasp -p m328p (also trying via make-install all). is there an extra initialization step i am missing? swapping back to the 168 does work so i dont think its an issue with this programmer.
avrdude -B 4 -P usb -c usbasp -p atmega328p -u -U lfuse:w:0x62:m -u -U hfuse:w:0xD1:m -u -U efuse:w:0x06:m -U flash:w:icetube_flash.hex:i -U eeprom:w:icetube_eeprom.hex:i -U lock:w:0x2B:m
avrdude: set SCK frequency to 187500 Hz
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: error: program enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
make: [Makefile:109: install-all] Error 1 (ignored)
Sounds like progress, at least. The initialization failed, rc=-1
error means that there is failed communication between the programmer and the chip. Have you tried the troubleshooting suggestions in the firmware/README file?
:: Programming Fails with an Arduino Chip ::
The Arduino Uno chip is an ATmega328p, but will not work in an Ice Tube Clock without reconfiguration. Arduino chips have their fuse settings configured to use an external 16 MHz oscillator for the system clock. The Ice Tube Clock does not provide a suitable external oscillator, and without an external oscillator, an Arduino chip will not function--not even to be reconfigured.
To provide an external oscillator for reconfiguration, insert the Arduino chip into an Arduino board. Next, connect a programmer to the ISP on the Arduino board and reprogram the fuses with the xmas-icetube Makefile: "make install-fuse". The ATmega328p's fuse settings are now configured to use the 8 MHz internal oscillator and can be installed and programmed as described in the INSTALLATION section.
This method is also described in the following thread:
http://forums.adafruit.com/viewtopic.php?p=184722#p184722
:: Other Programming Failures ::
First, ensure that the hardware is connected properly, as described in the installation instructions above. Second, double check the Makefile configuration section, paying particular attention to the AVRISP and AVRDUDEOPT macros. Third, try programming the chip at a lower bit rate by changing the "-B 2" option to "-B 25" in the AVRDUDEOPT macro:
AVRDUDEOPT ?= -B 25 -P usb -c $(AVRISP) -p $(AVRMCU)
Fourth, if the chip cannot be programmed in the clock, try programming it in a development board such as the Arduino Uno. Finally, it's possible that the chip is somehow damaged or bricked; usually, the simplest solution is to simply replace the ATmega328p with a new chip and try again.
Yes, I tried changing the -B value with no luck, I'm going to order an Arduino board and see. Will get back to you, thanks!
The Arduino board will help if these are pre-programmed Arduino chips. They would have been marketed as Arduino chips, though. For example, Adafruit calls them "Arduino bootloader-programmed chip (Atmega328P)".
With an Arduino chip, it is also possible to breadboard the clock pins to a 16 MHz crystal oscillator, connect an ISP header, and use the bread boarded setup to reprogram the chips to work in the clock.
As far as the "-B 25" option, I had one user report having to change the 25 to a much larger value. I can't remember what exactly he used, but if clock speed is the problem any value big enough will work.
works with the arduino board! thanks for the guidance, flashed and rocking! lets hope this resolves the clock drift :)
Congratulations! Well done.
I'm trying to compile fw simply for the drift correction, i am not having much luck.
With compiled firmware...
With working firmware...
Makefile
Using a ARCELI USBASP USBISP AVR USBasp_H6 Programmer