Go Down

Topic: [SOLVED] Set Low Fuse Bit, Now Can't Program over ISP (Read 6 times) previous topic - next topic

dc42

It's making more sense to me now:

- with 128kHz applied to XTAL2 you are getting 16KHz on CLKOUT
- so you need to program it with SCLK not exceeding 4KHz
- so -B 250 is barely enough cycle time, if avrdude does use the -B parameter to set the SCLK rate of the AVRISPmkII

So try with 128KHz applied to XTAL2 again, but this time:

- try avrdude with a -B parameter greater than 250
- try using AVR Studio, with the SCLK frequency in the user interface set to 4KHz or even lower.

If that fails, try with 32768Hz or so applied to XTAL1 or XTAL2 (whatever gives you a clean CLKOUT signal) and use SCLK <= 1kHz in AVR Studio. The docs say you can't program the flash below 2KHz, but you can do a chip erase.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Coding Badly

EDIT: When D9 is connected to XTAL2, I ran this command "avrdude -c avrispmkII -p m328p -P usb -B250" and also -B500 and it still failed to initialize.


This was the result?

Quote
avrdude: stk500v2_command(): command failed
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1


I believe that error has nothing to do with how the target is clocked but is the programmer refusing the -B command (you may need a space between the -B and the value).

To get an extra slow SCK you may need to use something else for programming.  Do you have an Arduino board?

pico


To get an extra slow SCK you may need to use something else for programming.


I find the slow clock setting on a USBasp often does the trick whenever things get a bit stubborn. For $5 or so on ebay, I think one of these is a reasonable investment for anyone who does more than the most infrequent ICSP programming.
WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

Aakash

#58
Nov 19, 2012, 05:43 am Last Edit: Nov 19, 2012, 07:42 am by Aakash Reason: 1

It's making more sense to me now:

- with 128kHz applied to XTAL2 you are getting 16KHz on CLKOUT
- so you need to program it with SCLK not exceeding 4KHz
- so -B 250 is barely enough cycle time, if avrdude does use the -B parameter to set the SCLK rate of the AVRISPmkII

So try with 128KHz applied to XTAL2 again, but this time:

- try avrdude with a -B parameter greater than 250
- try using AVR Studio, with the SCLK frequency in the user interface set to 4KHz or even lower.

If that fails, try with 32768Hz or so applied to XTAL1 or XTAL2 (whatever gives you a clean CLKOUT signal) and use SCLK <= 1kHz in AVR Studio. The docs say you can't program the flash below 2KHz, but you can do a chip erase.


Yep! That worked. I set the clock source (D9) from the Arduino  to 128KHz and connected it to XTAL2. After that, I went into AVR Studio and set the rate to 4.209KHz (or something very close) and the connection was very unstable. Though, I was able to set the fuses back to factory state after trying to write them a few times. Now it's working without the external clock source!

I'll try to write the low fuse to use the resonator tomorrow, or sometime soon, but correctly this time :-)

Thanks a lot dc42, and all!

Nick Gammon

Good work dc42 for sticking with it. At least the OP doesn't have to replace his chip. :)

Go Up