Go Down

Topic: Use Mega 2560 to program a Atmel168A-PU (Read 3886 times) previous topic - next topic

CrossRoads

Hmm, you do seem pretty close. Keep at it.
If I had more chip types on hand I could try it out for you.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

Well, I suppose I could try the compiling part without chips too.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

CrossRoads

Oh -  you might also need a /variants folder with /atmega168a and pins_arduino.h from a 168 board type in it.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

johnwasser

To get the right bootloader I would start with the an existing 8MHz ATmega168 model (like the Pro Mini) and modify from there:
atmega168a.name=ATmega168A-PU on a breadboard (8 Mhz)

atmega168a.upload.tool=avrdude
atmega168a.upload.protocol=arduino

atmega168a.bootloader.tool=avrdude
atmega168a.bootloader.unlock_bits=0x3F
atmega168a.bootloader.lock_bits=0x0F

atmega168a.build.board=AVR_PRO
atmega168a.build.core=arduino:arduino
atmega168a.build.variant=arduino:standard

atmega168a.upload.maximum_size=14336
atmega168a.upload.maximum_data_size=1024
atmega168a.upload.speed=19200

atmega168a.bootloader.low_fuses=0xc6
atmega168a.bootloader.high_fuses=0xdd
atmega168a.bootloader.extended_fuses=0x00
atmega168a.bootloader.file=atmega/ATmegaBOOT_168_pro_8MHz.hex

atmega168a.build.mcu=atmega168a
atmega168a.build.f_cpu=8000000L
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

nerdegutta

Well, I suppose I could try the compiling part without chips too.
That would be awesome!
Oh -  you might also need a /variants folder with /atmega168a and pins_arduino.h from a 168 board type in it.
Where do I find the pins_arduino.h file?
To get the right bootloader I would start with the an existing 8MHz ATmega168 model (like the Pro Mini) and modify from there:
atmega168a.name=ATmega168A-PU on a breadboard (8 Mhz)

atmega168a.upload.tool=avrdude
atmega168a.upload.protocol=arduino

atmega168a.bootloader.tool=avrdude
atmega168a.bootloader.unlock_bits=0x3F
atmega168a.bootloader.lock_bits=0x0F

atmega168a.build.board=AVR_PRO
atmega168a.build.core=arduino:arduino
atmega168a.build.variant=arduino:standard

atmega168a.upload.maximum_size=14336
atmega168a.upload.maximum_data_size=1024
atmega168a.upload.speed=19200

atmega168a.bootloader.low_fuses=0xc6
atmega168a.bootloader.high_fuses=0xdd
atmega168a.bootloader.extended_fuses=0x00
atmega168a.bootloader.file=atmega/ATmegaBOOT_168_pro_8MHz.hex

atmega168a.build.mcu=atmega168a
atmega168a.build.f_cpu=8000000L


Nice! I'll try that!

Thanks!

- nerdegutta

nerdegutta

OK, so I've made a folder in the variants and called it atmega168a. In that folder I've copied the pins_arduino.h file from the standard folder.

I've edited the boards.txt file to jhonwasser's suggestion.

Now I get the following:


avrdude: AVR Part "atmega168a" not found



Under that, the program lists the valid parts.

I've changed the atmega168a to *p and tried again. Now I get:

avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x00


I feel we're getting closer....

- nerdegutta

johnwasser

avrdude: AVR Part "atmega168a" not found
My mistake.  The signature of the "168a" is the same as the "168" so change atmega168a.build.mcu in the boards.txt file back to "atmega168" which avrdude can already recognize.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

nerdegutta

Now I get this output:


         Using Port                    : /dev/ttyACM0
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: Send: 0 [30]   [20]


Any more ideas?

- nerdegutta

nerdegutta

Some progress. There seem to be some sort of communication going on. See attached file.

But...

In the log I find this:


         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us


What does this mean?

- nerdegutta

johnwasser

I don't know what that means but it looks like avrdude doesn't mind.  It looks like ArduinoISP a is successfully responding to the A, B, and E commands but does not respond to the P command. I wonder why that is. 
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

nerdegutta

I'm trowing in the towel on this one...  :(

I got the LED to blink, and I cheated, somehow... I used the board we made a few posts back, loaded the File->Examples->01. Basics->Blink sketch.

Compiled it.

Went down to the folder Arduino saves the *.HEX files, and executed the command:


sudo avrdude -c avrispmkii -p m168 -P usb -e -U flash:w:Blink.cpp.hex



Now avrdude programes the IC with my AVR MK II programmer.

It's strange why the programmer port, the usb, don't show in the Tools->Ports menu, but that is another story.

Well guys - It's been fun and I've learned a lot from the forum, and from johnwasser and CrossRoads, thanks.

I'll be seeing you in another thread - nerdegutta out!

Go Up