Go Down

Topic: Problem programming 168 with avrdude (Read 458 times) previous topic - next topic

kymatica

Hi! I just got a pair of Arduino NG's.
I'm running linux and am an experienced C programmer so I didn't want to use the arduino IDE but installed the crosscompilation toolchain from source, and the arduino-core 0007 archive..
I'm using GCC 4.1.0, Binutils 2.17, avr-libc 1.4.5 and avrdude 5.3.1

Please help, I would really want to get this started...

I'm using these settings in my Makefile:

PORT = /dev/ttyUSB0
TARGET = arduino-test
ARDUINO = /Files/AVR-Cross/arduino-core
SRC = $(TARGET).c $(ARDUINO)/buffer.c $(ARDUINO)/pins_arduino.c \
 $(ARDUINO)/Serial.c $(ARDUINO)/uart.c $(ARDUINO)/wiring.c
CXXSRC = $(ARDUINO)/HardwareSerial.cpp $(ARDUINO)/WRandom.cpp
MCU = atmega168
F_CPU = 16000000
FORMAT = ihex
UPLOAD_RATE = 19200


I compiled the led blink code successfully, but had troubles uploading it... then I realized that MCU should be atmega168 and not atmega8, after that change I successfully uploaded the code and got it to run. But the LED blinked way too fast (not 1000ms) and I tried changing it to 10000 in the code and compiling and uploading it again, but then it just went black. And now I can't get it to run! (whatever delay values I use in the led blink code).

Here's the output from avrdude:

avrdude -v -F -p atmega168 -P /dev/ttyUSB0 -c stk500 -b 19200 -U flash:w:arduino-test.hex

avrdude: Version 5.3.1, compiled on Mar  7 2007 at 23:35:38
       Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

       System wide configuration file is "/Files/AVR-Cross/etc/avrdude.conf"
       User configuration file is "/Users/lijon/.avrduderc"
       User configuration file does not exist or is not a regular file, skipping

       Using Port            : /dev/ttyUSB0
       Using Programmer      : stk500
       Overriding Baud Rate  : 19200
avrdude: successfully opened stk500v1 device -- please use -c stk500v1
       AVR Part              : ATMEGA168
       Chip Erase delay      : 9000 us
       PAGEL                 : PD7
       BS2                   : PC2
       RESET disposition     : dedicated
       RETRY pulse           : SCK
       serial program mode   : yes
       parallel program mode : yes
       Timeout               : 200
       StabDelay             : 100
       CmdexeDelay           : 25
       SyncLoops             : 32
       ByteDelay             : 0
       PollIndex             : 3
       PollValue             : 0x53
       Memory Detail         :

                                Block Poll               Page                       Polled
         Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
         ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
         eeprom        65     5     4    0 no        512    4      0  3600  3600 0xff 0xff
         flash         65     6   128    0 yes     16384  128    128  4500  4500 0xff 0xff
         lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
         hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
         efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
         lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
         calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
         signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

       Programmer Type : STK500
       Description     : Atmel STK500
       Hardware Version: 2
       Firmware Version: 1.15
       Vtarget         : 0.0 V
       Varef           : 0.0 V
       Oscillator      : Off
       SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
       To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "arduino-test.hex"
avrdude: input file arduino-test.hex auto detected as Intel Hex
avrdude: writing flash (4294 bytes):

Writing | ################################################## | 100% 3.25s

avrdude: 4294 bytes of flash written
avrdude: verifying flash memory against arduino-test.hex:
avrdude: load data flash data from input file arduino-test.hex:
avrdude: input file arduino-test.hex auto detected as Intel Hex
avrdude: input file arduino-test.hex contains 4294 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.23s

avrdude: verifying ...
avrdude: 4294 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


It seems to quit the bootloader after some time though, since I can't re-upload anything if I wait too long after pressing the RESET button on the board... So perhaps it's running something??

Also, is it correct that the bootloader should flash the LED on pin 13 three times and then stay black when pressing the RESET button?
Back to top       


Go Up