How Do I Set The Bitclock in a Make File for AVR

avravrdudemicrocontroller

I'm following Chapter 2 of Elliot Williams' book Make: AVR Programming. I'm on an iMac.

I get a success message in Terminal when I input:

avrdude -p m328 -c usbasp -v -B 10

So, I know that my programmer and micro controller are working.

(If I don't set the Bitclock to 10 then it throws an error.)

My problem is working with the Make file. When I try "make flash" I get an error message.

avr-gcc -Os -g -std=gnu99 -Wall -funsigned-char -funsigned-bitfields
-fpack-struct -fshort-enums -ffunction-sections -fdata-sections -DF_CPU=1000000UL -DBAUD=9600UL -I. -I../../AVR-Programming-Library -mmcu=atmega328 -c -o blinkLED.o blinkLED.c avr-gcc -Wl,-Map,blinkLED.map -Wl,–gc-sections -mmcu=atmega328 blinkLED.o ../../AVR-Programming-Library/USART.o -o blinkLED.elf avr-objcopy -j
.text -j .data -O ihex blinkLED.elf blinkLED.hex avrdude -c usbasp -p
atmega328 -U flash:w:blinkLED.hex

avrdude: error: programm enable: target doesn't answer. 1 avrdude:
initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude done. Thank you.

make: *** [flash] Error 1

I think that the problem is that the Bitclock isn't set in the Make file, and I'm not sure how to do so. (If I have some other error, please let me know. I'm guessing.) The Make file can be found on gitHub at:
blinkLED Make File

I have set the MCU = atmega328 (which is the micro controller that I'm using.)

Best Answer

Modify the PROGRAMMER_ARGS assignment in the flash_usbasp rule to include the proper avrdude arguments.

flash_usbasp: PROGRAMMER_ARGS = ...