Posted: Sun Apr 27, 2008 6:29 pm Post subject: Atmega 8 hangup
Hi forum,
I have been working with some projects but i dont know why the AVR hangs after some time. I made the system which works with phone calls and turn on./off switch with the DTMF tones Everything is working fine my codes but after make 5 or 6 calls the system restart or stop to receive anything on the USART. I have tried to change stack settings too but still not working.
Select Case Chrx
Case 0
Case 13
Case 10 : Kk = Str2$
Str2$ = ""
Flag_data_ready = 1
Case Else
If Len(str2$) < Max_buf_len Then 'Filter out LF and CR etc
Str2$ = Str2$ + Chr(chrx)
Else
End If
End Select
Return
--------
I am totally fade up why the system is not working and i need to always working the system. waiting for your quick reply.
Thank you very much for your reply with your advice to make the ISR shorter. I have been working on my project and reading code for last whole night and finally i got the error and problem why the AVR is going to Reset or Hang up. Ok i try to tell you the reason. As per my main loop below:
Do
If Flag_data_ready = 1 Then
If Len(kk) > 2 Then
Flag_data_ready = 0
End If
If Mid(kk , 1 , 4) = "RING" Then
Incall_flag = 0
Start Timer1
Gosub Glock
End If
Else
End If
Gosub Doorcheck
Set Portd.6
Waitms 500
Reset Portd.6
Waitms 500
Loop
End
When we detect "RING" from Modem then it call the SUB GLOCK so it take 2 bytes from the HWSTACK and the problem was i used the GOTO Statement instead of RETURN because. When we call a sub it take 2 bytes from HWSTACK and when we use RETURN then it give back the 2 bytes and the error was here when i called once the SUB GLOCK then it take 2 bytes then again 2 + + + and the result was ..
The HWSTACK grow down first to the SWSTACK then FREME and then DATA Area and which make the AVR hangup or Reset / Restart.
I hope that would be helpful for others who are facing problem with overflow and avoid that problem.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum