Author Topic: AVR device not responding  (Read 10857 times)

0 Members and 1 Guest are viewing this topic.

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
AVR device not responding
« on: August 03, 2007, 03:15:15 PM »
Hello everyone, I'm having a problem:

I soldered my circuit board together with an ATmega168, its for a sumobot. My problem is that when i went to program it i used the makefile from Admin's $50 photovore_v1 code (of course changing to the correct port values and stuff). The test program successfully loaded and my LED flashed. But for testing purposes i tried it out with a different makefile and the code compiled but when i clicked program it said AVR Device not responding. So i switched back to the working makefile and it still said AVR device not working

I've checked all the connections, I even moved the ATmega168 to another board that i know works, and it gave the same error. Is it possible the 2nd makefile dmged the IC?
« Last Edit: August 03, 2007, 05:55:33 PM by SomeSaba »

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Re: AVR device not responding
« Reply #1 on: August 03, 2007, 07:44:17 PM »
Also: This is what my error is:

> "make.exe" program

Creating load file for EEPROM: sumo_v2.eep
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" \
--change-section-lma .eeprom=0 -O ihex sumo_v2.elf sumo_v2.eep
c:\WinAVR\bin\avr-objcopy.exe: there are no sections to be copied!
c:\WinAVR\bin\avr-objcopy.exe: --change-section-lma .eeprom=0x00000000 never used
make.exe: [sumo_v2.eep] Error 1 (ignored)
avrdude -p atmega168 -P lpt1 -c bascom    -U flash:w:sumo_v2.hex

avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

make.exe: *** [program] Error 1


Any help on this issue would be uber cool :),

Thanks guys! have a nice day
« Last Edit: August 04, 2007, 02:16:32 AM by SomeSaba »

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: AVR device not responding
« Reply #2 on: August 04, 2007, 04:42:19 AM »
if the 2nd Makefile changed the fuse bits then it is possible it changes them to a configuration that will not work with your programmer or clock type.

can you post the Makefile?
also does your AVR use the internal resonator or an external crystal?

dunk.

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Re: AVR device not responding
« Reply #3 on: August 04, 2007, 09:46:43 AM »
Thanks for the reply <3,

I use internal resonator, this is the 2nd makefile:
(Come to think of it, i think you are right on the fuse bits thing, it says in the comment that its set for 8Mhz, and isnt it 1Mhz for internal? This makefile was orginally for an ATmega16 i changed the stuff to 168 :O)

PRG            = sumo_v2
SRC            = sumo_v2.c utils.c
MCU_TARGET     = atmega168

OBJ            = $(SRC:.c=.o)
OPTIMIZE       = -Os
DEFS           =
LIBS           =

# compile of .c auto with $(CC) -c $(CPPFLAGS) $(CFLAGS)
# compile of .cpp auto with (CXX) -c $(CPPFLAGS) $(CXXFLAGS)
CC             = avr-gcc
CXX            = avr-g++

# Override is only needed by avr-lib build system.
override CFLAGS        = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
override CPPFLAGS      = -g -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) $(DEFS)
override LDFLAGS       = -Wl
#override LDFLAGS       = -Wl,-Map,$(PRG).map

OBJCOPY        = avr-objcopy
OBJDUMP        = avr-objdump
AVRDUDE        = avrdude     # for downloading

# AVRDUDE definitions; m16 is the ATmega16;
# for "bascom" programmer, use lpt1/etc; for "avrisp" programmer, use com1/etc
AVRDUDE_PART       = m168
ifndef AVRDUDE_PROGRAMMER
AVRDUDE_PROGRAMMER = bascom
endif
ifndef AVRDUDE_PORT
AVRDUDE_PORT       = lpt1
endif
AVRDUDE_FLAGS      = -p $(AVRDUDE_PART) -c $(AVRDUDE_PROGRAMMER) -P $(AVRDUDE_PORT)

# (this is the default rule since it's first)
all: $(PRG).elf bin
#all: $(PRG).elf lst bin

clean:
   rm -rf *.o $(PRG).elf *.bin
#   rm -rf *.o $(PRG).elf *.lst *.map *.bin

program: $(PRG).bin
   avrdude $(AVRDUDE_FLAGS) -e -U flash:w:$(PRG).bin:r
   avrdude $(AVRDUDE_FLAGS) -u -U lfuse:w:0xA4:m
   avrdude $(AVRDUDE_FLAGS) -u -U hfuse:w:0xD1:m

# make sure fuse bits are set for 8MHz, brown-out detect, no JTAG, no EEPROM clear
setfuse:
   avrdude $(AVRDUDE_FLAGS) -u -U lfuse:w:0xA4:m
   avrdude $(AVRDUDE_FLAGS) -u -U hfuse:w:0xD1:m

# rebuild the obj files if any .h changes
$(OBJ):      utils.h

# binary file (to download to robot)
bin:  $(PRG).bin

$(PRG).elf: $(OBJ)
   $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)

%.bin: %.elf
   $(OBJCOPY) -j .text -j .data -O binary $< $@

# code/asm listing
lst:  $(PRG).lst

%.lst: %.elf
   $(OBJDUMP) -h -S $< > $@


Im going out of town today for a few days, so if i dont reply for a while, thats why :)
« Last Edit: August 04, 2007, 09:58:26 AM by SomeSaba »

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Re: AVR device not responding
« Reply #4 on: August 08, 2007, 06:35:47 PM »
I am back from my trip.

I was wondering if i changed the fuse bits is it possible to change them back?

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: AVR device not responding
« Reply #5 on: August 09, 2007, 02:14:51 AM »
yup. that Makefile changes your fuse bits.
you'll need to do a bit of research and find what
a low byte of 0xA4 and
a high bite of 0xD1
does on the ATmega168.

the things that can stop you from being able to re programme are
disabling reset on the reset pin,
disabling serial programming
and (most likely what you have done) changing the clock settings.

if you have changed the clock settings to an external clock type you will need to attach a clock source before you can reprogram.
if you have disabled the reset pin or disabling serial programming you will need a parallel programmer to re program.

dunk.

Offline SomeSabaTopic starter

  • Full Member
  • ***
  • Posts: 75
  • Helpful? 0
Re: AVR device not responding
« Reply #6 on: August 09, 2007, 04:02:11 PM »
Thank you so much for your reply <3

I've confirmed the clock setting change, does the external clock source have to be 8MHz?

Offline dunk

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 1,086
  • Helpful? 21
    • dunk's robot
Re: AVR device not responding
« Reply #7 on: August 10, 2007, 07:53:12 AM »
Quote
I've confirmed the clock setting change, does the external clock source have to be 8MHz?
i can't remember if you set different fuse bits for different clock speeds.
the datasheet will tell you.

dunk.

 


Get Your Ad Here