Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

[SOLVED] Messed With ATMega8 SPIEN setting??

Status
Not open for further replies.

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
15
Reputation
30
Reaction score
14
Trophy points
1,298
Location
Philippines
Activity points
1,119
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...
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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
 

Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,791
Reputation
3,574
Reaction score
1,650
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,545
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

Last edited:

blunderboy

Newbie level 6
Joined
Jun 13, 2011
Messages
14
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,283
Activity points
1,373
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

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,791
Reputation
3,574
Reaction score
1,650
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,545
@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.
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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
 

Tahmid

Advanced Member level 5
Joined
Jun 17, 2008
Messages
4,758
Helped
1,791
Reputation
3,574
Reaction score
1,650
Trophy points
1,393
Location
Silicon Valley, California, USA (from Dhaka, Bangl
Activity points
30,545
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.
 

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
15
Reputation
30
Reaction score
14
Trophy points
1,298
Location
Philippines
Activity points
1,119
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..





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






BR
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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
 

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
15
Reputation
30
Reaction score
14
Trophy points
1,298
Location
Philippines
Activity points
1,119
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..
 
Last edited:

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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
 

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
15
Reputation
30
Reaction score
14
Trophy points
1,298
Location
Philippines
Activity points
1,119
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:

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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
 

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
15
Reputation
30
Reaction score
14
Trophy points
1,298
Location
Philippines
Activity points
1,119
Thanks Alex! and for others who give their suggestions and share their knowledge as well...
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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
 

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
15
Reputation
30
Reaction score
14
Trophy points
1,298
Location
Philippines
Activity points
1,119
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?? :(
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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
 

kasamiko

Full Member level 3
Joined
May 23, 2004
Messages
154
Helped
15
Reputation
30
Reaction score
14
Trophy points
1,298
Location
Philippines
Activity points
1,119
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...
 

alexan_e

Administrator
Joined
Mar 16, 2008
Messages
11,895
Helped
2,020
Reputation
4,156
Reaction score
2,031
Trophy points
1,393
Location
Greece
Activity points
64,377
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top