1
\$\begingroup\$

For my systemprogramming class I have to program an ATmega48a μController.

At university we're using an avrmkII to program the chips, but as i don't have such a device at home so I figured I could use my Arduino as an ISP programmer.

Now when I run the avrdude command (see Makefile below) to flash a simple blink program onto the controller I get the following error:

avrdude -pm48 -P /dev/ttyACM0 -B19200 -cavrisp -Uflash:w:blink.hex:a -v
avrdude: Version 6.3-20171130
 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
 Copyright (c) 2007-2014 Joerg Wunsch
 System wide configuration file is "/etc/avrdude.conf"
 User configuration file is "/home/user/.avrduderc"
 User configuration file does not exist or is not a regular file, skipping
 Using Port : /dev/ttyACM0
 Using Programmer : avrisp
 Setting bit clk period : 19200.0
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x00
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x00
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0xe0
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0xe0
avrdude done. Thank you.
make: *** [Makefile:40: program] Fehler 1

But I can't figure out why they are not in sync. All tutorials / questions & answers I found focused on programming the chip using the Arduino IDE which I was specifically told not to use, because the IDE does all the heavy lifting for you.

I know that the ATmega is working because I already programmed it using the avrmkII, and the blink sketch (a different one) that I uploaded then is still able to run.

Electronics:

  • ATmega48a
  • Arduino Mega 2560

Wiring:

software:

  • OS: Parrot OS 5.1 (Electro Ara)
  • avrdude version 6.3-20171130
  • Arduino IDE to upload ISP sketch onto Arduino: 2.2.1

Makefile:

TARGET=blink
MCU=atmega48a
SOURCES=blink.c
MCU_dude=m48
PROGRAMMER=avrisp
PORT=-P /dev/ttyACM0
BAUD=-B19200
OBJECTS=$(SOURCES:.c=.o)
CFLAGS=-c -Og 
LDFLAGS=
all: hex eeprom
hex: $(TARGET).hex
eeprom: $(TARGET)_eeprom.hex
$(TARGET).hex: $(TARGET).elf
 avr-objcopy -O ihex -j .data -j .text $(TARGET).elf $(TARGET).hex
$(TARGET)_eeprom.hex: $(TARGET).elf
 avr-objcopy -O ihex -j .eeprom --change-section-lma .eeprom=1 $(TARGET).elf $(TARGET)_eeprom.hex
$(TARGET).elf: $(OBJECTS)
 avr-gcc $(LDFLAGS) -mmcu=$(MCU) $(OBJECTS) -o $(TARGET).elf
.c.o:
 avr-gcc $(CFLAGS) -mmcu=$(MCU) $< -o $@
size:
 avr-size --mcu=$(MCU) -C $(TARGET).elf
program:
 avrdude -p$(MCU_dude) $(PORT) $(BAUD) -c$(PROGRAMMER) -Uflash:w:$(TARGET).hex:a -v
clean_tmp:
 rm -rf *.o
 rm -rf *.elf
clean:
 rm -rf *.o
 rm -rf *.elf
 rm -rf *.hex

I hope I provided all the necessary information needed. if not I'll update my question accordingly.

the busybee
4,26414 silver badges25 bronze badges
asked Oct 29, 2023 at 13:08
\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$
avrdude -pm48 -P /dev/ttyACM0 -B19200 -cavrisp -Uflash:w:blink.hex:a -v

That line contains a crucial error, you need to change -B to -b instead.

answered Oct 29, 2023 at 14:37
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.