Atmega8 CKOPT = 0 ?

Go To Last Post
34 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Guys,

 

When I put CKOPT = 0 and CKSEL3...1 = 1.....I can't access my ATmega8 anymore ?

I put 12MHz crystal on pin 8 and 7 and 12pF capacitor on it ...

 

Any clues how to make it run again...? looks like it's not getting the clock properly ??

 

Thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Try applying an external clock signal to PB6 (XTAL1) and use an ISP to change the fuses. The ISP frequency setting must be less than 1/4 the applied clock frequency.

I've even used an audio oscillator for that purpose.

 

Last Edited: Thu. Aug 13, 2015 - 03:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

crystal pins is : XTAL1 = 9 , XTAL2 = 10 in ATmega8 DIP.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You already tried this here:

https://www.avrfreaks.net/forum/ckopthow-make-it-1-again

 

And you were already told:

david.prentice wrote:
You chose to use -F
Anything might happen. Most likely, fuses will get set inappropriately.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It doesn't work with 1MHz clock and slow SPI....it's a new chip....I have tried 2 chip with the same case, is it possible that my crystal is broken ?

I used 12MHz and 12pF...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it's atmega8 QFP......and I tried to use external crystal.....CSEL0....3 = 1 and CKOPT =0.....the first time with internal clock....it was working....but when I set to CSEL0....3 = 1 and CKOPT=0....it's not responding....I tried changing with new crystal, it's still not responding.......I don't understand why ??

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I didn't use Avrdude for this one...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Can I inject 16MHz to XTal1.......with another mega? _delay_us(0.0625); ?

Last Edited: Fri. Aug 14, 2015 - 01:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can throw it away and start with a new chip. They are cheap.
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bianchi77 wrote:

Can I inject 16MHz to XTal1.......with another mega? _delay_us(0.0625); ?

That might work if you have a 100MHz AVR, sadly, they don't exist.

You have a logic analyser, you can check to see if the oscillator is working or not.

You can use clkout if you have a suitable AVR - mega328?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yea u r right....but i ve done twice and some case.....i need to use external crystal clock to run....:) abit strange for me..this atmega8.....

i used external crystal easily with mega128.....16Mhz smooth n easy fuse...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Which oscilator u are talking about?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I need 1MHz <= xtal1 according to datasheet....so I ll give 2MHz on it......_delay_us(0.5); might work mate? My fuse csel0...3 = 1 copt=0 , I m not changing other fuses....

Kartman wrote:

bianchi77 wrote:

Can I inject 16MHz to XTal1.......with another mega? _delay_us(0.0625); ?

That might work if you have a 100MHz AVR, sadly, they don't exist.

You have a logic analyser, you can check to see if the oscillator is working or not.

You can use clkout if you have a suitable AVR - mega328?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What oscillator? The mega8 oscillator that is supposedly not working.

 

You might need an external clock- be it crystal or otherwise is irrelevant. Really, all of this has been discussed to death - just about everyone has zapped their fuses at some stage, so what makes you think your problem is any different? Again, you can generate a high frequency clock from a working AVR with the CLKOUT feature. Again, this has been discussed many times before, so I given you something to search on.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cool i ll give a try for external clock at 2MHz..
N see wht happen...thanks kartman...doesn t work...rubbish bin..easy...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I ll generate clock from mega128 gpio....and delay 500ns...that s what I ll do...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Will I see some signals on Xtal2 as it s an output if my fuse is csel0...3=1 and ckopt = 0?.
...i ll have a look on my scope...before i unsolder it n chuck to the bin

Last Edited: Fri. Aug 14, 2015 - 04:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

X1 and X2....there's a clock but very low frequency...

X1 pin

X1 pin

x2 pin

X2 pin

 

Any clues ? thanks

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

2MHz from another mega

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use a new chip, here's the fuse bit :

The circuit:

 

I can read fusebit now...but if I change ckopt to 0.....and csel = 1111......I can not communicate with the chip anymore....why is that ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Message #1 talks about 12pF.

Your schematic shows 22pF.

 

Are you sure that you actually have 22pF and not 22nF ?

A good crystal will run ok without CKOPT fuse.   It will run better with the fuse.

 

A bad crystal or inappropriate capacitors will probably never oscillate at all.

 

You would be a lot better off with using avrdude.   At least we would have some idea what you are doing.    A Chinese GUI is all very well for Chinese users.    English speakers do not even get a manual !!!

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David,

 

Here's what I get from avrdude

 

C:\WinAVR-20100110\bin>avrdude -p m8 -c usbasp -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.con


         Using Port                    : lpt1
         Using Programmer              : usbasp
         AVR Part                      : ATMEGA8
         Chip Erase delay              : 10000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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  M
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- -
-- ---------
           eeprom         4    20   128    0 no        512    4      0  9000
00 0xff 0xff
           flash         33    10    64    0 yes      8192   64    128  4500
00 0xff 0x00
           lfuse          0     0     0    0 no          1    0      0  2000
00 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000
00 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000
00 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0
 0 0x00 0x00
           signature      0     0     0    0 no          3    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 upda
.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as D9

avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as D9
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


C:\WinAVR-20100110\bin>

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

yes it's 22pF and 12MHz.....brand new ...

Last Edited: Fri. Aug 14, 2015 - 11:42 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

what do you think of that value from avrdude ?
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well,  what did you expect with a virgin ATmega8 ?

Of course it has factory fuses.   Of course avrdude can talk to it.

 

You could program the fuses with: -U lfuse:w:0xff:m -U hfuse:w:0xc9:m

 

If your new and unused AVR does not oscillate with a crystal,   I would just tear my hair out.    (I am bald.   You could be too!)

 

As far as I know,  you can solder ok.   And should know about 22pF and 22nF.   You can test a through hole crystal on a breadboard.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'll give a try....and prepare throwing another mega8.....hehehehe

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

this is the command :

C:\WinAVR-20100110\bin>avrdude -p m8 -c usbasp -v -U lfuse:w:0xff:m -U hfuse:w:0xc9:m

am I right ? before I press enter button ?

 

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm a bit bald in front as well....:)

It's atmega8A, will it do the same with atmega8....? only matter of packaging ....

Last Edited: Fri. Aug 14, 2015 - 12:01 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
C:\WinAVR-20100110\bin>avrdude -p m8 -c usbasp -v -U lfuse:w:0xff:m -U hfuse:w:0xc9:m

 

Is it the same for 12MHz clock ? thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David, it works....thanks a lot ;)

C:\WinAVR-20100110\bin>avrdude -p m8 -c usbasp -v -U lfuse:w:0xff:m -U hfuse:w:0xc9:m

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                      : ATMEGA8
         Chip Erase delay              : 10000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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                       Pol
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadB
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ------
           eeprom         4    20   128    0 no        512    4      0  9000  9000 0xff 0
           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0
           lock           0     0     0    0 no          1    0      0  2000  2000 0x00 0
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0

         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: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9307
avrdude: safemode: lfuse reads as E1
avrdude: safemode: hfuse reads as D9
avrdude: reading input file "0xff"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xff:
avrdude: load data lfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xc9"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xc9:
avrdude: load data hfuse data from input file 0xc9:
avrdude: input file 0xc9 contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified

avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as C9
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


C:\WinAVR-20100110\bin>

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Of course it works.   It was a virgin AVR.

 

Now you have to remember NOT to brick any other ones.

If your "old AVR" still does not respond even with an external clock,   just bin it.    It costs less than a beer.

 

Put it down to experience.  i.e. do NOT use -F switch in future.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have encountered similar problem very confusing.

Recently I have had a few ATMEGA8A-AU ,Replace some old ATMEGA8L-8PU.

 

once CKOPT=0, The chip does not work.  crystal is 11.0592MHZ,49S.   20pF*2

 

Exactly the same circuit board, I used to deliberately programmed this fuse bit CKOPT,  In this new chip, this fuse bit cause it to stop oscillation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have encountered similar problem very confusing.

Recently I have had a few ATMEGA8A-AU ,Replace some old ATMEGA8L-8PU.

 

once CKOPT=0, The chip does not work.  crystal is 11.0592MHZ,49S.   20pF*2

 

Exactly the same circuit board, I used to deliberately programmed this fuse bit CKOPT,  In this new chip, this fuse bit cause it to stop oscillation.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please do NOT cross post. I just answered this identical post in another thread.

 

Moderator.

Last Edited: Fri. Oct 30, 2015 - 09:40 AM