Keil Logo Arm Logo

bad instruction

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
Anh Phan
Posted
24-Feb-2005 16:31 GMT
Toolset
C51
New! bad instruction
Hi,

I am having a while(1){} loop and all interrupt disabled. It loops for a while and then gets out of the loop, jumping to a random address (not interrupt vectors) or break of out the loop and continues sequentially from there. Is there anyway to detect a bad instruction fetch? In other microcontroller, a bad instruction would branch to an interrupt vector.

Thanks,

Anh
Read-Only
Author
erik malund
Posted
24-Feb-2005 16:58 GMT
Toolset
C51
New! RE: bad instruction
Is there anyway to detect a bad instruction fetch? In other microcontroller, a bad instruction would branch to an interrupt vector.
I doubt this is a bad instruction fetch, I think it is an incorrect instruction fetch. There is only one opcode in the '51 that is "bad". If, instead of the jmp back the fetch is add, the program will, of course, go astray.

My guess is that you are using external code memory that is just a itty bitty tad too slow. That would work in some high percentage of the time. Another possibility is brownout detect.

Erik
Read-Only
Author
Stefan Duncanson
Posted
24-Feb-2005 16:59 GMT
Toolset
C51
New! RE: bad instruction
It sounds as though a function call return address is being corrupted on the stack for one reason or another.

Can you post some code?
Read-Only
Author
Anh Phan
Posted
24-Feb-2005 18:25 GMT
Toolset
C51
New! RE: bad instruction
Thanks all,

the code is just:
while(1){}. I think it's a code memory issue and just trying to recover from it.

Anh

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings