Hi, I have had some problems with my newest board based on the ATmega2560. Trying to fix a issue I've had for a week I turned my suspicions to the external crystal which seemed to worked fine locking through the oscilloscope but I had nothing else to try so I switched to use the internal 8MHz clock.
After this I lost the connection to the MCU, getting the classic error:
I've had this before when I disabled the ISP interface; but should switching to the internal clock really cause an issue? Shouldn't it just keep running with the internal clock instead?
Actually it looks like your programmer is responding, since avrdude is giving the warning to update your USBasp firmware. I get similar messages when the AVR is set to a lower clock speed like internal 1MHz or 128KHz and your USBasp programmer can't slow down for this.
Do you remember what fuse settings you used last?
What kind of USBasp programmer do you have?
There may be a jumper option to use a slow sck clock or you may be able to upgrade the firmware so you can use an avrdude option -B to slow it down.
I tried the -B parameter which needed a number after it, tried 0,1,2,3,4 with no success. The only fuse I set was the low one, which specifies the clock settings.
Would the external crystal give a signal if the internal one is used? Could I look at the crystal with a oscilloscope and if it is silent I know the internal one is used?
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
This output indicates your USBasp does not support the -B option. It may be possible to upgrade your programmer firmware to be able to support that option. If you tell us what kind of USBasp you have then I may be able to help you upgrade it.
If you had set the CKOUT fuse option, then the system clock can be measured at the output CLKO on pin 9.
If you tell us what kind of USBasp you have then I may be able to help you upgrade it.
I have one bought from eBay, hongkong style. It says "USBASP V2.0" and "Lcsoft Studio" on the programmer, hopefully you have an firmware update for it.
What low clock fuse setting did you use?
I remember that:
CKSEL0=0
CKSEL1=0
CKSEL2=0
CKSEL3=1
But when I use the AVR Fuse Calculator to get what it represents, it seems to be inverted, I have to "select" fuse CKSEL0,CKSEL1 and CKSEL2 to get 0x1000 (the above). Either way, when I mimic the settings above it says:
"Ext. Crystal Osc; Frequency 0.4-0.9MHZ; Startup....." which is totally wrong....does this mean I have to get a crystal within that range to recover it?
Can't even find the "Internal Osc 8MHz" in the Fuse calculator..
Fuse settings are confusing. The default is 0xFF or all 1-bits. However that is called "not programmed". To "set" a fuse you write it to zero. Thus they appear inverted.
Yes, the USBASP V2.0 LCsoft Studio usually supports sck auto-clock adjust for AVRs running down to 1MHz. That USBasp firmware can be upgraded to support lower speeds for AVRs running at 128KHz. In addition it does have the hardware jumper (J3) support for slow sck clock, but only if you update the firmware. I have one of those USBasp programmers and have tried this, so I know it works. But I think you have a bigger problem with your fuse selection.
Are you saying you programmed the low fuse byte with 0xF8? If so then yes, you will need to connect an external ceramic resonator (not a crystal according to the datasheet) in the range from 400KHz - 900KHz.
The low byte fuse setting for the internal 8MHz clock should have been something like 0xE2.
Problems solved, hooked up a 500KHz ceramic resonator and set the fuses back to 16Mhz ext. and everything is back to normal.
hiduino:
...USBasp firmware can be upgraded to support lower speeds for AVRs running at 128KHz. In addition it does have the hardware jumper (J3) support for slow sck clock, but only if you update the firmware. I have one of those USBasp programmers and have tried this, so I know it works. But I think you have a bigger problem with your fuse selection.
Would be great with the updated firmware, I've been running with the 2011-05-28 all the time but people keeps saying that there is an update to it. I would be very happy if you could give me the newer one!
I've also read that the J3 jumper is obsolete for the newer updates like 2011-05-28, but you mean that it is first in the later updates it is used?
About your USBasp programmer, do you still get this output from avrdude?
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
If so, then you are not running the USBasp 11-05-28 firmware. This means the USBasp programmer does not support the -B option. But it doesn't mean there is an actual problem and you don't need to update if it's working well for you. It could be that your USBasp firmware supports a built in auto-clock instead of the -B option. I have several of these types of programmers and they run fine. You can just ignore that warning.
The J3 hardware jumper is not totally obsolete. In some cases where you can't use the avrdude -B option, like from the IDE or some other software, then having a hardware jumper can be very helpful. The caveat is that not all USBasp firmwares support the J3 option. I do know that the 11-05=28 (and 2009-02-28) firmwares do support the J3 option, in addition to supporting the -B option. Older firmwares (2006 and older) only support the J3 option.
bigal83:
I've also read that the J3 jumper is obsolete for the newer updates like 2011-05-28, but you mean that it is first in the later updates it is used?
In the official USBasp releases, the jumper always overrides the ISP clock rate.
If the newer code is used you can set the rate through the commands over the USB
interface. But even if you do set it with a command, the jumper still overrides that setting.
So while you don't necessarily have to use the jumper to get a slower clock, it still
works with the newer firmware.