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

What happens inside the microcontroller?

Status
Not open for further replies.

maanas

Newbie level 6
Joined
Aug 14, 2009
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,378
micro controller problem

hi everyone
i want to know what actually happens inside the controller when micro controller hangs.

if micro controller jumps to unprogrammed area (by any problem) then will program counter revert back to the reset value after traversing to all the nop instructions.

please help
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,717
Helped
4,810
Reputation
9,638
Reaction score
4,591
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
125,363
Re: microcontroller problem

That depends on where the program pointer 'landed' after the crash.

It is quite possible that an opcode was executed saying 'jump back one instruction' so it stuck in a loop forever.

Brian.
 

hameeds01

Advanced Member level 2
Joined
Aug 23, 2005
Messages
599
Helped
75
Reputation
156
Reaction score
40
Trophy points
1,308
Location
Islamabad Pakistan
Activity points
4,542
Re: microcontroller problem

For that use Watch Dog Timer it will restart the microcontroller if it hangs
 

sheth_ka

Junior Member level 2
Joined
Aug 29, 2009
Messages
21
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,427
Re: microcontroller problem

maanas said:
hi everyone
i want to know what actually happens inside the controller when micro controller hangs.

if micro controller jumps to unprogrammed area (by any problem) then will program counter revert back to the reset value after traversing to all the nop instructions.

please help
possible,if the program jumps to unknown area of your program, the microcontroller executes nothing..thus, it appears like it hangs up..also, if you are calling procedures, you should put a return syntax, so that your program will return to where it is called..otherwise if you dont the program will executes the next line..
hope this answers your query..:D
 

GetDeviceInfo

Advanced Member level 4
Joined
Mar 30, 2009
Messages
109
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,298
Activity points
1,904
Re: microcontroller problem

if micro controller jumps to unprogrammed area (by any problem) then will program counter revert back to the reset value after traversing to all the nop instructions.
No, it will not. As mentioned, the watchdog timer will cause it to vector to the reset address.
 

maanas

Newbie level 6
Joined
Aug 14, 2009
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,378
Re: microcontroller problem

i am talking about the case when we are not using watch dog timer.

if controller hangs in an indefinite loop then we can't do nothing but what about unprogrammed area or NOP area.

so the controller design is such that even if it gets stuck in unprogrammed area the program counter will not revert back to 0000 after executing all nop instructions.
 

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
14,717
Helped
4,810
Reputation
9,638
Reaction score
4,591
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
125,363
Re: microcontroller problem

Good programming practice says fill the unused areas with code that will *TRY* to recover the situation. For example, fill with NOP instructions so at least no harm is done and the program counter eventually rolls over back to the reset vector. A better way is to fill the space with instructions to jump to the reset vector but again, if the instruction is multi-byte, you could crash into the middle of the instruction and do something completely different.

Of course, there's no guarantee you crash into unused memory anyway, you could be running loops in your existing code or polling some hardware that will never respond.

In short, apart from a hardware watchdog AND suitably written code to reset it, there is no way to be sure of recovery.

Brian.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top