Software > Software

AVR device not responding

(1/2) > >>

SomeSaba:
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?

SomeSaba:
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

dunk:
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.

SomeSaba:
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 :)

SomeSaba:
I am back from my trip.

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

Navigation

[0] Message Index

[#] Next page

Go to full version