Show Posts
Pages: 1 2 3 [4] 5 6
46  Forum 2005-2010 (read only) / Development / Re: Arduino on the ATMEGA168 on: November 14, 2006, 09:34:44 pm
Well, interestingly, if you look at its source there appears to be support in the Arduino bootloader code (the version I use for the Atmega168) for the Atmega32 (and other AVR processors not often discussed). The problem is that there is no actual support in the Arduino IDE for Atmega32.   It's crucial that the IDE know about the Atmega32 or it won't be able to do anything. If I was a little more adventurous I would have waded into the IDE source code to see what had changed to add Atmgea168 support and see if those changes, geared to the specifics of the Atmega32, could then added again. But I'd want one of the Arduino old school kids here to point me in the right direction first.
47  Forum 2005-2010 (read only) / Development / Re: Arduino on the ATMEGA168 on: November 13, 2006, 11:52:08 am
hmm, business opportunity!
paypal me $15 at and send me your snail mail address and i'll make you one.
$10 each for each additional atmega168 in the package.  if lots of people take advantage of this, you might have to wait for me to resupply.
48  Forum 2005-2010 (read only) / Development / Re: Arduino on the ATMEGA168 on: October 21, 2006, 02:55:20 pm
I kept hearing the term "fuse" and I had no reason to find out what it meant until you mentioned that it was probably my problem. I recommend that anyone who is curious check out this page:

I took a gamble and used the fuse settings you suggested and, happily, my Atmega168 is flashed with a proper Arduino bootloader!  Thanks so much!

For those who need to properly set their Atmgea168 fuses in the future, the AVRdude command line is (depending on your programmer/serial port, I'm using the AVR-PG1 serial dongle on COM1):

avrdude -patmega168 -cponyser -Pcom1 -b9600 -u -v  -Uhfuse:w:0xdf:m -Ulfuse:w:0xc7:m -Uefuse:w:0x08:m
49  Forum 2005-2010 (read only) / Development / Re: Arduino on the ATMEGA168 on: October 21, 2006, 01:25:51 pm
For the time being I've given up on getting a bootloader to work on my Atmega168. I compiled my Arduino sketch using the Atmega168 processor setting and then went and dug the .hex file out of the applet folder in its project folder.  Then I uploaded it to Atmega168 using AVRdude and the AVR-PG1 dongle.  This all worked fine.

The sketch I'd uploaded has a known behavior of outputting (over the serial output) a line of space-delimited integers every two seconds.  Interestingly, I noticed that though it was working, it was doing so much more slowly than normal and the output was garbled at the expected baud rate.  So I did some experiments by changing the build.f_cpu in the preferences file, ultimately changing it from 16 MHz to just one MHz.  At 1 MHz the baud rate matched the one expected, meaning that somehow the compilation process for the Atmega168 is misjudging the baud rate timing by a factor of 16.  Mind you, I know for a fact that it is actually being clocked at 16MHz (an Atmega8 works exactly as expected in this same socket).  Does anyone have any theories about this peculiar behavior? I have a feeling this all will go a long way to explaining why the Atmega168 bootloader isn't working.
50  Forum 2005-2010 (read only) / Development / Re: Arduino on the ATMEGA168 on: October 20, 2006, 08:37:14 pm
I know about the processor selection menu and that isn't my problem.  But if you or anyone else can get a dump of the flash memory on a working Arduino Atmega168 and post it here somehow, maybe I could try that out.  I guess you'd have to use avrdude or a program like that - Arduino can't read processors at all.

51  Forum 2005-2010 (read only) / Development / Re: Arduino on the ATMEGA168 on: October 20, 2006, 03:11:23 pm
I just successfully wrote the ATmegaBOOT_168.hex file to my Atmega168 using the AVR-PG1 serial dongle
using avrdude and the command line
avrdude -patmega168 -cponyser -Pcom1 -b9600 -u -Uflash:w:a.hex
(where a.hex is a renamed ATmegaBOOT_168.hex)
What I wouldn't have given for someone to give me a real world example of that program in use!

Now, though, that reflashed Atmega168 is still unrecognized by the Arduino environment.
Has anyone ever used an Atmega168 in an Arduino board?
52  Forum 2005-2010 (read only) / Development / Re: Arduino on the ATMEGA168 on: September 29, 2006, 10:16:20 pm
by the way, the dongle programmer thing i'm using is the AVR-PG1.  What programming software should I be trying with this dongle, the olimex AVR-P28 board and the ATMEGA168? I'm totally new to microcontrollers and the AVR world, but I have extensive experience in digital electronics, usually making things happen with flip flops, logic gates, and what not.  the arduino board makes things so much easier, but I need a little more memory to write routines to drive an LCD display.
53  Forum 2005-2010 (read only) / Development / Re: Arduino on the ATMEGA168 on: September 29, 2006, 10:11:24 pm
 i used ponyprog for that .hex file (and though ponyprog claims it doesn't recognize the device, it does stuff when you hit ignore and then claims the write was successful). i'm not really clear on whether i should be flashing the flash or uploading to the eeprom - i know what these terms mean, but how they apply to the arduino have never been clear.  does the arduino pay any attention to eeprom?  anyway, my flashed atmega168 showed more signs of life when placed on an arduino board - that digital out 13 LED flashed a few times.  but the TX LED never flashed and it never turned into any sort of usable arduino.  is there any other atmel chip that fits in this socket that i could try?  lord knows they're cheap enough!
54  Forum 2005-2010 (read only) / Development / Arduino on the ATMEGA168 on: September 28, 2006, 10:08:34 pm
I've seen advertisements for Arduino boards with the Atmega168 programmed with the Arduino bootloader.  How is this done?  I've tried doing this in PonyProg (which doesn't claim to support the Atmega168 but can be used to write its flash memory) and the resulting Atmega doesn't boot when plugged into an Arduino board.

If someone can just point me to an atmega168 .hex bootloader file, i would be most pleased!

55  Forum 2005-2010 (read only) / Development / Re: atmega168 bootloading.. on: February 03, 2007, 01:19:05 am
I should add, by the way, that I use AVRdude (the free command line AVR tool) in WindowsXP to put  bootloaderd on my Atmega chips, not Arduino.  But once I'm done loading the bootloaders, I flip my 6PDT switch and use the Arduino IDE with my Olimex board.  To make it usable in the world of Arduino, all I had to do was replace the 8MHz crystal with a 16MHz one and hook up two wires to the serial chip.

When programming with AVRdude, these are the three command lines I use:

avrdude -patmega168 -cponyser -Pcom1 -b56000 -u -v  -Uhfuse:w:0xdf:m -Ulfuse:w:0xc7:m -Uefuse:w:0x08:m
(to set the fuses for the world of Arduino)
avrdude -patmega168 -cponyser -Pcom1 -b56000 -u -v  -Uflash:w:a.hex
(a.hex being a copy of the Atmega168 bootloader)
avrdude -patmega168  -b56000 -Pcom1  -cponyser  -V -U lock:w:0xCF:m
(to lock the bootloader part of the Atmega's flash memory)
56  Forum 2005-2010 (read only) / Development / Re: atmega168 bootloading.. on: February 03, 2007, 01:04:39 am
If you want to build a serial-capable ICSP burner for the Arduino, this is the circuit diagram:
I actually bought the programmer from Olimex and it works great
 but I later needed to build a second one myself on this Olimex breadboard:
 so I could flip a 6PDT switch to switch a single serial cable from "standard Arduino serial" to "ICSP burning" and back again.
(In the version of the circuit I built, I replaced whatever NPN transistors Olimex uses with standard 2N2222s and they worked fine.)

Here are some pics of my Olimex Arduino programmer, front and back, afterwards and before:

57  Forum 2005-2010 (read only) / Development / Re: bootloader is getting corrupted - why? on: November 18, 2006, 12:31:46 pm
If you look at the Arduino schematic:
you see that the ICSP port is just a reuse of normal digital lines.  I don't know the choreography that happens on this port when reprogramming with the ICSP, but it seems possible that, if you were really unlucky in a noisy relay/motor-filled environment, one that allowed noise to enter the Atmega8's Reset line, it would be possible to reflash the Atmega8 without intending to, thus damaging the bootloader or any programs loaded onto it. I've had this happen myself - I didn't actually know what had happened until I tried reloading the bootloader onto Atmega8s that I thought were dead - reviving them completely.
58  Forum 2005-2010 (read only) / Development / Re: Arduino and other Development Boards on: October 20, 2006, 11:51:56 am
Wow, you totally called it!  Sure enough, the Olimex had an 8MHz crystal.  Just to keep things easier when dealing with real Arduino boards, I decided to fix the problem by replacing the 8MHz crystal with a 16 MHz one.  I looked around my cluttered laboratory and found a four pin 16 MHz module (from an old experimental NCUBE multiprocessor ISA board).   (For the record, those modules have osc_out at pin 3, ground at pin 2, and VCC at pin 4.) I desoldered the old 8MHz crystal out of the Olimex and connected the osc_out pin from the module to pin 9 of the Atmega8.  Right away, I noted it booted up in half the time!  And then I could reprogram it over a serial line using the usual Arduino IDE.  This setup makes it possible to develop stand-alone Arduino gear for just the price of the Atmega and the Olimex board, and you get lots of board real estate as a bonus!
59  Forum 2005-2010 (read only) / Development / Arduino and other Development Boards on: October 20, 2006, 12:11:04 am
I have an Olimex AVR-P28 board ($14 from into which I inserted a spare Atmega8 that I programmed using the parallel port programmer.  Getting this to speak through the Olimex board's Max232 serial chip wasn't easy, since its pins are not connected to the Atmega at all - you have to do that yourself and the labels on the board appear to be reversed (or perhaps we're in weird Null-modem land).  I had to look up the Max232 schematic for guidance.  Pin 3 of the Atmega8 goes to pin 10 of the Max232 and (I think) pin 2 of the Atmega8 goes to pin 12 of the Max232.

With this setup, it is possible to read the serial output of a Atmega8 running a known program that outputs to the serial port.  What is strange, though, is that I have to set my terminal program to half the baud rate of the serial setting in the Arduino program (in other words, a Serial.begin(2400) results in 1200 baud communications).

I have not been able to upload a new program to the Atmega while it's on the Olimex board.  Perhaps the RX wire is going to the wrong pin of the Max232 or the baud-halving issue is throwing a monkey wrench into the process.  Does anyone have any ideas?  I like the Olimex board because of all the board real estate, which is good for a project that has already been completely debugged.
60  Forum 2005-2010 (read only) / Interfacing / Re: MaxSerial Diecimila spontaneous reset problem on: August 11, 2008, 09:02:09 am
Actually, scratch that about the ferrite toroid.  Something I wasn't paying attention to had fixed that problem and I unscientifically attributed it to the toroid (which I'm keeping just as a good luck charm).  What really fixed my problem was spiffed's idea of soldering pin 5 of the DB-9 connector to its mounting lug.  Now my MaxSerial Freeduino is rock solid across its 100 foot RS-232 connection, performing as reliably as a toaster.  I can even unplug the serial port and plug it back in again without triggering a reset.
Pages: 1 2 3 [4] 5 6