which bootloader is used for the 328p

74 views
Skip to first unread message

george magiros

unread,
Nov 22, 2010, 11:44:17 PM11/22/10
to nycresistormi...@googlegroups.com
I tried to make the bootloader in ./arduino-Arduino-012b4b0/hardware/arduino/bootloaders/atmega for the atmega328p, unfortunately it fails to compile.  Executing "make atmega328" in that directory gives me: 

avr-gcc -g -Wall -O2 -mmcu=atmega328p -DF_CPU=16000000L   '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600   -c -o ATmegaBOOT_168.o ATmegaBOOT_168.c
ATmegaBOOT_168.c: In function ‘main’:
ATmegaBOOT_168.c:586: error: ‘EEWE’ undeclared (first use in this function)
ATmegaBOOT_168.c:586: error: (Each undeclared identifier is reported only once
ATmegaBOOT_168.c:586: error: for each function it appears in.)
make: *** [ATmegaBOOT_168.o] Error 1

I can fix the error by appending  "|| defined(__AVR_ATmega328P__)" to line 583, but it begs the question, what bootloader does the arduino use for the atmega328p.  Does it use the precompiled hex in that directory or does it use another bootloader like in ../optiboot which does compile without errors when you execute "make atmega328"?

George
212-799-1720

On Mon, Nov 22, 2010 at 3:39 AM, jarek <jare...@gmail.com> wrote:
The holidays are around the corner, and many of us are hand-making
presents for friends and family using the electronics skills we've
picked up over the past year. Using an Arduino is the easiest way to
prototype your labor of love, and now it's time to package up your
present. But spending $40 on an Arduino board for each programmable
set of LEDs you want to give can become very costly.

I'm teaching a class on December 5th at NYCResistor on how to take
your Arduino-based prototype and translate it into a circuit that does
exactly what your prototype does, while leaving the actual Arduino
out. Using techniques you'll learn in this class, you'll be able to
keep the cost of your finished product down, save your Arduino for
future experiments, and reduce the time it takes to construct each
finished product if you're thinking of mass production.

This will be the 3rd time I'll be teaching this class, and using
critique and advice from previous students, I have designed a special
programming shield that will be provided for all students to keep and
is included in the cost of the class. This programming shield
simplifies the programming process so that we can spend more time on
the circuit design portion of the class.

To sign up for the class and find out more, visit the eventbrite page
for the class: http://www.eventbrite.com/event/1057152973

--
You received this message because you are subscribed to the Google Groups "NYCResistor:Microcontrollers" group.
To post to this group, send email to nycresistormi...@googlegroups.com.
To unsubscribe from this group, send email to nycresistormicrocon...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nycresistormicrocontrollers?hl=en.


george magiros

unread,
Nov 23, 2010, 12:45:20 PM11/23/10
to nycresistormi...@googlegroups.com
Ok I found the list of boards and their respective bootloaders in arduino-Arduino-012b4b0/hardware/arduino/boards.txt.  At least I know which bootloader goes where now.   The Duemilanove does use the same ATmegaBOOT_168.c bootloader that I tried to compile unsuccessfully for the atmega328p.  I looked at the AVR datasheet and the 328p uses the bit EEPE not the bit EEWE so at least I have the correct header file if not the latest avr-gcc.  I'll try to compile the whole arduino package from scratch and see what happens

Anyway, I put together a little reset circuit someone might like.  The one thing I don't like about the standard FTDI to arduino bootloader interface is that it requires four lines: TX, RX, GND and RTS (to toggle reset).   Three lines would be for me since I could replace the FTDI header on the arduino (or other AVR based circuit) with a stereo minijack.  So what follows is a simple circuit to drive the AVR reset line low whenever is a modem break of longer than 11 ms is sent from the host.  To access the bootloader you now first send a break, which resets the AVR, and then immediately run avrdude to access the bootloader before it times out into your code.  You can also reset the AVR while debugging by sending a modem break which is nice.  To burn a hex file I use the following command (9600 baud or whatever):

    echo '~#~!avrdude -c avrisp -b 9600 -P /dev/ttyUSB0 -p m328p -U flash:w:file.hex' | cu -l /dev/ttyUSB0

I couldn't use echo '~#~.' | cu -l /dev/ttyUSB0; avrdude ... because cu takes too long to hangup and terminate.  Note, ~# sends a modem break and ~. hangs up.

George
212-799-1720

Scanned Document.png
http://img683.imageshack.us/img683/2470/scanneddocument.png


Scanned Document.png
Reply all
Reply to author
Forward
0 new messages