Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Messed With ATMega8 SPIEN setting??

Status
Not open for further replies.

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
16
Reputation
32
Reaction score
18
Trophy points
1,298
Location
Philippines
Activity points
1,121
Hi,

Just program my ATMega8L on PonyProg with this setting:





Now after WRITE button I can't read it anymore //:cry:

I think I had DISABLE the SPIEN pin? but the SPIEN is greyed...
 

It is not possible to access and change the SPIEN fuse from a serial programmer, this can be only done with a parallel programmer.
The CKSEL flags are set for external crystal, have you connected a crystal?

Alex
 
When a setting is grayed out, it means that it can not be selected. So, you can not access and change the SPIEN fuse.

Go through this carefully:



So that it becomes clear, I attached the clock part of the datasheet. Go through the attachment carefully.

Hope this helps.
Tahmid.
 

Attachments

  • ATMEGA8 clock part.pdf
    352.3 KB · Views: 156
  • avr clock.pdf
    190.3 KB · Views: 148
Last edited:
Right now you have set the fuse bits at
External crystal oscillator, BOD enabled
Check datasheet,
And connect external crystal oscillator if you havent already(at XTAL1 and XTAL2),
And BOD(brown out detector is also not enabled)

@tahmid: unchecked means 1 means unprogrammed
he has the clock set at external crystal and not external clock
 
@tahmid: unchecked means 1 means unprogrammed

If that's the case, then, you need to make sure you have a crystal connected. In my programmer (non-brand Chinese one), it's the other way round.
I showed how the crystal must be connected.
 
If that's the case, then, you need to make sure you have a crystal connected. In my programmer (non-brand Chinese one), it's the other way round.

This is how ponyprog shows programmed/unprogrammed fuses, the meaning of checked/unchecked is explained in the grey text over the buttons in the OP picture.
The programmer brand is irrelevant, the checked/unchecked fuse meaning is software related, each software application can use a different way to represent the state of the fuse.

ponyprog_fuses.jpg

Alex
 
Yea, I see it. In my programmer, checked means 1 and unchecked means 0, that's what I meant to say. Anyways, since he's using ponyprog, let's focus on that.
 
It is not possible to access and change the SPIEN fuse from a serial programmer, this can be only done with a parallel programmer.
The CKSEL flags are set for external crystal, have you connected a crystal?

Alex

No not yet...this is my first time messing with AVR...so what is the correct way of programming using PonyProg? load the HEX then write then set the fuses? I'm planning to revive it using external xtal connected to xtal1 and xtal2.



When a setting is grayed out, it means that it can not be selected. So, you can not access and change the SPIEN fuse.

Go through this carefully:



So that it becomes clear, I attached the clock part of the datasheet. Go through the attachment carefully.

Hope this helps.
Tahmid.

Thanks for the attachment Tahmid, this will helps me a lot..:D


Right now you have set the fuse bits at
External crystal oscillator, BOD enabled
Check datasheet,
And connect external crystal oscillator if you havent already(at XTAL1 and XTAL2),
And BOD(brown out detector is also not enabled)

@tahmid: unchecked means 1 means unprogrammed
he has the clock set at external crystal and not external clock

I really got confused with the setting on PonyProg as compared to the setting of a chinese made programmer...

in PonyProg "0" is ENABLED while "1" is DISABLED....


If that's the case, then, you need to make sure you have a crystal connected. In my programmer (non-brand Chinese one), it's the other way round.
I showed how the crystal must be connected.

Thanks! Noted...


This is how ponyprog shows programmed/unprogrammed fuses, the meaning of checked/unchecked is explained in the grey text over the buttons in the OP picture.
The programmer brand is irrelevant, the checked/unchecked fuse meaning is software related, each software application can use a different way to represent the state of the fuse.


View attachment 58087

Alex

And I got messed up with this reversed setting...:evil:


Yea, I see it. In my programmer, checked means 1 and unchecked means 0, that's what I meant to say. Anyways, since he's using ponyprog, let's focus on that.

Right...

ok..here is the setting on a Chinese made software..


**broken link removed**


how can i set this setting on PonyProg?? BTW here is the setting of my brand new unused Mega8 before I locked it..


**broken link removed**



BR
 

For atmel a programmed fuse means that the fuse is 0 and an unprogrammed fuse has a value of 1.

Unfortunately different programs use checkboxes differently , others show unprogrammed=unchecked and programmed =checked and others show 1=checked , 0 = unchecked, this two ways are reversed(opposite).
The ponyprog is clearly explaining that it uses unprogrammed=unchecked(1) and programmed =checked(0).
In the Chinese software 1 and 0 show the fuse value so 1=unchecked(in ponyprog) and 0=checked(in ponyprog), you can understand that because SPIEN=0 (programmed so that it is enabled) and RSTDISBL=1 (unprogrammed so that PC6 pin works as reset).

So every value that is 1 in the Chinese should be unchecked in ponyprog and every value that is 0 in the Chinese should be checked in ponyprog.

You can upload the program/fuses with any order, it doesn't matter.
The default of mega8 clock source is internal RC, if you change the fuses to an external clock source then you have to connect a crystal or clock in order to access the avr again.

Alex
 
So I presumed that my setting is correct? (based on the Chinese setting)

77_1309430652.jpg



I'm programming this mega8 out of the circuit so no clock source is available..I think I have to load and write the main program first before setting the fuses if I'll done it out of the board..
 
Last edited:

So I presumed that my setting is correct? (based on the Chinese setting)

I'm programming this mega8 out of the circuit so no clock source is available..I think I have to load and write the main program first before setting the fuses if I'll done it out of the board..
yes your settings are correct, after setting these flags you need to connect a crystal to the mcu.

One note is about the CKOPT fuse , it is left to unprogrammed (1).
What is the frequency of the crystal you are going to use?

This is what the datasheet says:

XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier which can be con-
figured for use as an On-chip Oscillator, as shown in Figure 11. Either a quartz crystal or a
ceramic resonator may be used. The CKOPT Fuse selects between two different Oscillator
amplifier modes. When CKOPT is programmed, the Oscillator output will oscillate a full rail-to-
rail swing on the output. This mode is suitable when operating in a very noisy environment or
when the output from XTAL2 drives a second clock buffer. This mode has a wide frequency
range. When CKOPT is unprogrammed, the Oscillator has a smaller output swing. This reduces
power consumption considerably. This mode has a limited frequency range and it cannot be
used to drive other clock buffers.

For resonators, the maximum frequency is 8MHz with CKOPT unprogrammed and 16MHz with
CKOPT programmed. C1 and C2 should always be equal for both crystals and resonators. The
optimal value of the capacitors depends on the crystal or resonator in use, the amount of stray
capacitance, and the electromagnetic noise of the environment. Some initial guidelines for
choosing capacitors for use with crystals are given in Table 4. For ceramic resonators, the
capacitor values given by the manufacturer should be used.


this range is up to 8MHz so if you intend to use a crystal with a higher frequency program (0) this flag

Alex
 
yes your settings are correct, after setting these flags you need to connect a crystal to the mcu.

One note is about the CKOPT fuse , it is left to unprogrammed (1).
What is the frequency of the crystal you are going to use?

This is what the datasheet says:

XTAL1 and XTAL2 are input and output, respectively, of an inverting amplifier which can be con-
figured for use as an On-chip Oscillator, as shown in Figure 11. Either a quartz crystal or a
ceramic resonator may be used. The CKOPT Fuse selects between two different Oscillator
amplifier modes. When CKOPT is programmed, the Oscillator output will oscillate a full rail-to-
rail swing on the output. This mode is suitable when operating in a very noisy environment or
when the output from XTAL2 drives a second clock buffer. This mode has a wide frequency
range. When CKOPT is unprogrammed, the Oscillator has a smaller output swing. This reduces
power consumption considerably. This mode has a limited frequency range and it cannot be
used to drive other clock buffers.

For resonators, the maximum frequency is 8MHz with CKOPT unprogrammed and 16MHz with
CKOPT programmed. C1 and C2 should always be equal for both crystals and resonators. The
optimal value of the capacitors depends on the crystal or resonator in use, the amount of stray
capacitance, and the electromagnetic noise of the environment. Some initial guidelines for
choosing capacitors for use with crystals are given in Table 4. For ceramic resonators, the
capacitor values given by the manufacturer should be used.


this range is up to 8MHz so if you intend to use a crystal with a higher frequency program (0) this flag

Alex


Hi,

I managed to FIX my mega8 and now programmed it with the setting shown on my image above..:) Lesson learned? PonyProg will NEVER program the SPIEN and for quick and dirty programming...better add an XTAL..:D

I just like to inform verybody that yes a single crystal connected to XTAL1 & XTAL2 WILL WORK! No need for any special oscillatore or clock sources as what I have read somewhere else in this forum...:grin:


BTW I'll be using 12/16Mhz XTAL for my circuit...so I need to check this CKOPT stuff?


BR
 
Last edited:

Yes you need to check it, it may also work unchecked but the datasheet clearly states to program the fuse(0) for crystals above 8MHz.
CKOPT=0 also gives a stronger clock signal (full rail-to-rail swing)

Alex
 
Thanks Alex! and for others who give their suggestions and share their knowledge as well...
 

Hi Alex,

I'm back and LOCKED again...

here is the setting I write:

**broken link removed**


how can I recover it?


BTW here is the setting I'm trying to use...

The first fuse configuration in Table 1 (with USB SPI FLASH driver's).Jpg

The first fuse configuration in Table 2 (driven by USBSPIFLASH's).Jpg

The second main chip fuse configuration table (use SPI25 driver's).png

How can I set it in PonyProg??

Thanks again...
 

Attachments

  • The second main chip fuse configuration table (use SPI25 driver's).Bmp
    4.7 MB · Views: 70
Last edited:

You have set to use an external crystal, so just use an external crystal with two capacitors, any value above 1MHz will work fine

Sorry that was wrong, you have set it to external clock so you need to apply external clock pulses, any pulse generator will do even if it has a low frequency you should be able to unlock the mcu.
Try with your second mcu to set a pin toggling (PORTA ^=1 will do it) and feed it to the second mcu

Alex
 
Yes I did...I assembled a programming jig which allow me to used or remove the XTAL via socket...


EDIT:

Awz..so this time a need a REAL CLOCK source?? :(
 

The settings work as I have explained in the previous post, when a fuse is 1 in the Chinese version you have to uncheck it in ponyprog.

Alex
 
The settings work as I have explained in the previous post, when a fuse is 1 in the Chinese version you have to uncheck it in ponyprog.

Alex


But I can't find those exact setting in PonyProg...
 

Set the ones that are available in ponyprog, which ones are you missing?
And don't change any boolock values because then you will be in trouble

Alex
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top