View previous topic :: View next topic |
Author |
Message |
dc
Joined: 25 May 2007 Posts: 34
|
Posted: Fri Jul 23, 2010 6:44 pm Post subject: ATMEGA88 sometimes reset |
|
|
Processor = ATMEGA88
Oscillator = 22.1184 Mhz
Bascom version = 1.11.9.8
Attached program is a bit adapted from the original but has te same problem.
Reading in switch on pd.0 or pd.1 or pd.2 works and the lcd is starting a second count and giving the temperature from a lm35.
Switches are connected with a resistor and capacitor.
Problem, portd.4 - portd.7 is set as output depending on the switch setting, but after somewhere between 120 and 130 seconds there is a pin reset. (found it due to a relais connected)
Removed the transistor / relais and measured it with an oscilloscoop.
Until now this is the only moment there is a reset.
Is it due to an overflow?
Found out that changing Const Timerwaarde that is occurs more when
the value is increased from 43936 to 65000.
Probably it has something to do with the timer??? |
|
Back to top |
|
|
hgrueneis
Joined: 04 Apr 2009 Posts: 902 Location: A-4786 Brunnenthal
|
Posted: Sat Jul 24, 2010 5:03 am Post subject: |
|
|
Fist of all ...the clock is much too high.
Second: You need to define a stack.
Read the HELP and DATASHEET!
Hubert |
|
Back to top |
|
|
dc
Joined: 25 May 2007 Posts: 34
|
Posted: Sat Jul 24, 2010 3:05 pm Post subject: |
|
|
I changed the oscillator to 20Mhz, later on I will take one to get the exact reading of 1 second.
Also implemented the swstack (put it at 128) but still it resets sometimes.
Thanks for the tips, any advice left? |
|
Back to top |
|
|
MAK399
Joined: 23 Jun 2009 Posts: 110 Location: Germany
|
Posted: Sat Jul 24, 2010 4:41 pm Post subject: |
|
|
Hi dc,
run the following and check if it works:
Code: | $regfile = "m88def.dat"
$crystal = 20000000
$hwstack = 32
$swstack = 32
$framesize = 40
Config Pind.2 = Output
Do
Toggle Portd.2
Wait 1
Loop
End 'end program
|
Post your FuseBit settings.
Set it here http://www.engbedded.com/fusecalc
and send a screen shot.
Is the Voltage for ATMEGA88 between 4.5 and 5.5 Volt ? _________________ Using BASCOM 1.12.0.0 |
|
Back to top |
|
|
dc
Joined: 25 May 2007 Posts: 34
|
Posted: Sun Jul 25, 2010 6:54 am Post subject: |
|
|
The program you posted works without any problems.
Attached the fusebit settings |
|
Back to top |
|
|
Evert :-)
Joined: 18 Feb 2005 Posts: 2156
|
Posted: Sun Jul 25, 2010 10:53 am Post subject: |
|
|
Hi,
Remove the : from the line On Timer1 Pulse: in your program.
To determine what causes the reset place this at begin of your program;
Code: |
print "CPU STARTUP - " ; MCUSR 'display how CPU started
'16 JTAG reset"
'8 Watchdog reset"
'4 Brownout reset
'2 External reset
'1 Power on reset
reset MCUSR 'Clear the register for the next run
|
_________________ www.evertdekker.com Bascom code vault |
|
Back to top |
|
|
MAK399
Joined: 23 Jun 2009 Posts: 110 Location: Germany
|
|
Back to top |
|
|
dc
Joined: 25 May 2007 Posts: 34
|
Posted: Mon Aug 09, 2010 6:53 pm Post subject: |
|
|
Dear Evert, I implemented the code you suggested,
the report is : 6
So that means 2 external reset and 4 brownout reset? |
|
Back to top |
|
|
MAK399
Joined: 23 Jun 2009 Posts: 110 Location: Germany
|
Posted: Mon Aug 09, 2010 7:41 pm Post subject: |
|
|
How stable is your power supply for that micro ?
Are there any fluorescent tubes/lamps around your micro circuit which have no EMI suppression capacitor (or any other similar EMC fields) ? _________________ Using BASCOM 1.12.0.0 |
|
Back to top |
|
|
Dave
Joined: 05 Feb 2005 Posts: 314 Location: OR
|
Posted: Tue Aug 10, 2010 12:53 am Post subject: |
|
|
I didn't look at your code because from reading the other post it sound like a hardware problem. So my question is about hardware. Do you have any coils still attached to the circuit? If so make sure to use snubber diodes as close to the coil as possible. For those that might not know about what a snubber diode does there is a good explanation here. http://en.wikipedia.org/wiki/Snubber A coil without one will often crash a microC. |
|
Back to top |
|
|
|