Hi,
I had a code (in Atmel Studio) in which I took average of ADC readings and displayed them on 9 LED digits. To make the micro controller faster, I changed the fuse bits to internal 8mhz internal oscillator and it seems to be working because I can see the LEDs update much faster (the sampling and averaging took well over a second @ 1Mhz), but I can't seem to program the microcontroller anymore. I get the error
avrdude: warning: cannot set sck period. please check for usbasp firmware update. 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.
The external tool I'm using in Atmel Studio is
avrdude -c usbasp -p atmega32 -U flash:w:$(ProjectDir)Debug\$(TargetName).hex:i -U lfuse:w:0xe4:m -U hfuse:w:0xd9:m
The fuse bits I changed to are low - E4, high - D9 taken from https://www.engbedded.com/fuseca... (I have JTAG disabled because I need to use PORTC). I'm using USBASP for programming.
Things I've tried:
1) Using -B parameter from 1 to 10.
2) Reading the unbrick AVR tutorial (I'm pretty sure that tutorial was not for my case but I didn't have much to lose). I supplied a high frequency wave from Arduino to XTAL1. I don't know the frequency of that wave but I basically used my Arduino Uno to turn on and off a digital pin.
int unbrick_pin = 3; void setup() { // put your setup code here, to run once: pinMode(unbrick_pin, OUTPUT); } void loop() { // put your main code here, to run repeatedly: digitalWrite(unbrick_pin, HIGH); digitalWrite(unbrick_pin, LOW); }
and then connected it to XTAL1.
3) Using the -b baud rate parameter at various serial frequencies.
4) Using my Arduino Uno as ISP instead of usbasp.
It's really weird because the microcontroller is working perfectly but I just can't use avrdude to reprogram it.
Some more details :
1) Using windows 10, WinAVR
2) I get the following error when I use -v
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2009 Joerg Wunsch System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf" Using Port : lpt1 Using Programmer : usbasp AVR Part : ATMEGA32 Chip Erase delay : 9000 us PAGEL : PD7 BS2 : PA0 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 4 10 64 0 no 1024 4 0 9000 9000 0xff 0xff flash 33 6 64 0 yes 32768 128 256 4500 4500 0xff 0xff lfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00 hfuse 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00 lock 0 0 0 0 no 1 0 0 2000 2000 0x00 0x00 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00 calibration 0 0 0 0 no 4 0 0 0 0 0x00 0x00 Programmer Type : usbasp Description : USBasp, http://www.fischl.de/usbasp/ avrdude: auto set sck period (because given equals null) avrdude: warning: cannot set sck period. please check for usbasp firmware update. 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.
I just realized that I might be using outdated version of AVR as I paste this verbose output, since it says 2010. I'll try to update and see but I doubt that's the case.
I get the following error when I use -F
avrdude: warning: cannot set sck period. please check for usbasp firmware update. avrdude: error: programm enable: target doesn't answer. 1 avrdude: initialization failed, rc=-1 avrdude: AVR device initialized and ready to accept instructions avrdude: Device signature = 0x000000 avrdude: Yikes! Invalid device signature. avrdude: Expected signature for ATMEGA32 is 1E 95 02 avrdude done. Thank you.