0

Attiny85 works Atmega328 does not
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Attiny85 works Atmega328 does not

by Russell 27 on Mon Jan 16, 2017 5:12 pm

For the MAKE command to work it needs the information in the MAKEFILE. To view contents of makefile you need to open it in some kind of text program, you could use TextEdit, I like Sublime text. It's designed for programming files, and you can just drag and drop to open.

The MCU is defined as atmega328P, this needs to be changed to atmega328. Programmer is defined as USBtiny.
makefile1.png
makefile1.png (158.25 KiB) Viewed 163 times


Target is the name of your program file, this apparently comes from a preset directory. If you change the name behind target = to your program C file name minus the .c it will directly access the C file inside the directory folder.
makefile2.png
makefile2.png (174.1 KiB) Viewed 163 times


If you type make, program will partially compile. If you type make flash .hex is generated and flashed to chip if programmer is connected. This part of the instructions, (AVRDUDE) -c $(PROGRAMMER_TYPE) -p $(MCU) $(PROGRAMMER_ARGS) -U flash:w:$<, is what tells avrdude to flash the chip. You can manually type something very similar to this directly in avrdude to flash .hex. Make clean cleans all compiled files.
makefile3.png
makefile3.png (137.8 KiB) Viewed 163 times
Russell 27
 
Posts: 236
Joined: Thu Sep 12, 2013 3:59 pm

Re: Attiny85 works Atmega328 does not

by Russell 27 on Mon Jan 16, 2017 5:17 pm

Here is a slightly older makefile that came from the same series you are working with. It seems a little more simple in use, I've used it myself. I changed the variables, you should be able to compile this as is for 328. Its for a simple knight rider led flash.

knightrider.zip
(3.74 KiB) Downloaded 17 times
Russell 27
 
Posts: 236
Joined: Thu Sep 12, 2013 3:59 pm

Re: Attiny85 works Atmega328 does not

by ceraum on Mon Jan 16, 2017 5:51 pm

Hi Russel,

Thanks for the sample file - but that too has the same error. And it is the 328p I'm interested in, I edited the Makefile to include the correct chip and programmer (and nothing else). My apologies for typing quickly and leaving the "p" off in all my posts.

Once again, when I run make in either my original folder, or your sample I get the error: unknown MCU 'atmega328p' specified (with or without the p according to how I type it in the Makefile, which I tried with yours too). It lists the supported MCUs and no .hex files are created, and certainly nothing is flashed.

The only hint I can provide is that when I enter: avr-gcc -v
I get: gcc version 4.1.1

That's not the latest is it?

Buddy, I would have given this up for lost if it were not for your help. Thanks again.

BTW - I'm using TextMate, which is my personal favorite on the Mac, although are days when I miss Notepad++. I will take a look at your suggestions too.

ceraum
 
Posts: 11
Joined: Sun Feb 22, 2015 2:50 pm

Re: Attiny85 works Atmega328 does not

by Russell 27 on Mon Jan 16, 2017 6:08 pm

Maybe some of your tool chain became corrupted. May be best to uninstall fully and reinstall. When I set up crosspack avr I didn't have to do anything extra, including path changes. The latest version of crosspack should be GCC 4.8.1. There's a lot to know, hope you get it figured.

R
Russell 27
 
Posts: 236
Joined: Thu Sep 12, 2013 3:59 pm

Re: Attiny85 works Atmega328 does not

by ceraum on Mon Jan 16, 2017 6:34 pm

Hiya Russel,

Seems a sensible suggestion - something clearly went awry.

I will give that a go (more Google searches - Yeah!)

Thanks for sticking with me and I will report back on my progress - you are a star.

ceraum
 
Posts: 11
Joined: Sun Feb 22, 2015 2:50 pm

Re: Attiny85 works Atmega328 does not

by ceraum on Tue Jan 17, 2017 10:13 am

Hi all,

Tantalizing progress.

I was finally able (I think ) fully uninstall all the components - this is a record for me in the future as well as anyone else who hits this problem.

CrossPack-AVR has an uninstall utility, which is a snap to run and found in the main directory.

Then I removed avrdude by entering "brew remove avrdude" in the terminal

This didn't quite do it as after re-installing the latest version I was still getting the same error (and avr-gcc still was the older version), but manually deleting the files avr-gcc and avr-gcc-4.1.1 from my folder usr/local/bin did the trick.

After installing CrossPack-AVR for the umpteenth time I was able to run make, and wonder of wonders, the file compiled!!!

Honestly, without Russel sticking with me I don't know what I would have done.

Not sure when I can next pull out my box of wires to test on the chip, but this feels good.

Thanks again!

ceraum
 
Posts: 11
Joined: Sun Feb 22, 2015 2:50 pm

Please be positive and constructive with your questions and comments.