hexagon5un / AVR-Programming

Code examples for the book "Make: AVR Programming"
http://littlehacks.org/AVR-Programming
MIT License
744 stars 340 forks source link

Instructions for using examples with ATtiny chips #32

Closed DavidAntliff closed 6 years ago

DavidAntliff commented 6 years ago

I'm using the book with an ATtiny84, and while I understand that this chip doesn't have a USART I can't see why some of the examples wouldn't work if I can get them to compile.

However I'm trying to work out how to exclude the USART from being compiled - short of deleting USART.c, is there a better way?

Also, I'm not 100% convinced that the fuse values in the default makefiles are correct for the ATtiny84 and the last thing I want to do is brick the chip... in particular the Extended fuse value differs - in the Makefile it is set to 0x00 but the default fuse value for the ATtiny84 is 0xFF. It looks like writing 0x00 to efuse will enable SELFPRGEN which seems benign, but I'm not sure.

ATmega168 on the left, ATtiny84 on the right:

image

DavidAntliff commented 6 years ago

In case this is useful to anyone else in future, I was able to skip the compilation of USART.c in the Makefile by modifying:

SOURCES=$(wildcard *.c $(LIBDIR)/*.c)

to:

SOURCES:=$(filter-out $(LIBDIR)/USART.c, $(wildcard *.c $(LIBDIR)/*.c))

I took a gamble on the fuses and it seems to be OK...

DavidAntliff commented 5 years ago

Thank you past me for this useful hint!