What to do: undef Instr

Hi,

What to do when I get an ERROR Undef Instr and a register dump?

My application is running all fine for a while, can be for days but sometimes I just unexpectedly get this?
The dump appears on my COM port that I use for logging and live debugging…
This is way down below my code, what can I do to prevent/fix/debug this?
Luck is it that the unit boots and my code starts again so the system recovers but this is a bit disturbing

Almost forgot, running EMX board MF4.2 VS2012

Regards
Thomas

Here is the dump:
ERROR: Undef Instr
cpsr=0x00000010
pc =0x185a215f
lr =0xa0ea7e87
r0=0x000000b0
r1=0x00000000
r2=0xa0121c74
r3=0x00000005
r4=0x4000f648
r5=0xa00017dc
r6=0xa0021398
r7=0xa0020e70
r8=0x0c131146
r9=0x80d81136
r10=0x4000a545
r11=0x60e80769
r12=0xa0000fcd
sp =0x4000f284
ERROR: Undef Instr
cpsr=0x00000010
pc =0x185a215f
lr =0xa0ea7e87
r0=0x000000b0
r1=0x00000000
r2=0xa0121c74
r3=0x00000005
r4=0x4000f648
r5=0xa00017dc
r6=0xa0021398
r7=0xa0020e70
r8=0x0c131146
r9=0x80d81136
r10=0x4000a545
r11=0x60e80769
r12=0xa0000fcd
sp =0x4000f284
[0x4000f284] : 04 3a 9f a0 48 f6 00 40 08 ee 26 a0 00 00 00 00 .: Hö.@ .î& …
[0x4000f294] : a1 d2 e5 a0 00 00 00 00 08 ee 26 a0 00 00 00 00 ¡Òå …î& …
[0x4000f2a4] : a1 d2 e5 a0 34 10 00 a0 00 00 00 00 d8 10 00 a0 ¡Òå 4… …Ø…
[0x4000f2b4] : bf 59 01 00 00 00 00 00 57 e6 00 00 00 00 00 00 ¿Y…Wæ…
[0x4000f2c4] : 6f f9 e5 a0 34 00 00 00 1e f3 00 40 2b ba 05 00 oùå 4…ó.@ +º…
[0x4000f2d4] : 18 f3 00 40 2b ba 05 00 c1 55 00 00 18 f3 00 40 .ó.@ +º…ÁU…ó.@
[0x4000f2e4] : 73 00 00 00 9c f3 00 40 17 6e 00 00 18 f3 00 40 s…ó.@ .n…ó.@
[0x4000f2f4] : 79 5a 00 00 cf 74 17 80 40 f3 00 40 cf 74 17 80 yZ…Ït.@ ó.@ Ït.
[0x4000f304] : c1 55 00 00 40 f3 00 40 73 00 00 00 c4 f3 00 40 ÁU…@ ó.@ s…Äó.@
[0x4000f314] : 17 6e 00 00 40 f3 00 40 79 5a 00 00 cf 74 17 80 .n…@ ó.@ yZ…Ït.
[0x4000f324] : 40 f3 00 40 c8 f3 00 40 ee 01 00 00 cc 36 02 00 @ ó.@ Èó.@ î…Ì6…
[0x4000f334] : 01 00 00 00 ff ff 00 00 97 56 00 00 00 00 00 00 …ÿÿ…V…
[0x4000f344] : ab 56 00 00 80 f3 00 40 71 56 00 00 d0 f3 00 40 «V…ó.@ qV…Ðó.@
[0x4000f354] : ff ff ff ff 00 00 00 00 fb 66 00 00 f4 f3 00 40 ÿÿÿÿ…ûf…ôó.@
[0x4000f364] : d0 f3 00 40 01 00 00 00 a4 27 9f a0 a4 27 9f a0 Ðó.@ …¤’ ¤’
[0x4000f374] : 1b 72 02 00 38 33 9f a0 00 00 00 00 00 00 00 00 .r…83 …

This is a system crash report. We will need an example from you showing how this happened then we can fix rather quickly.

Thats the problem it is not constant, just some times. Have not found any patern to it…

@ Gus
I think I found the problem, I had an earlier post about socket.connect hanging when server was away. I tried to fix it by:

            ExecutionConstraint.Install(10000, 0);
            tryConnect = true;
            socket.Connect(ep);
            ExecutionConstraint.Install(-1, 0);

But If the server is away I get a system crash every 30min approx., the above code is running in its own thread and forever until I get a connection.

@ T_Langholen - The code you posted will throw a ConstraintException if the time period expires. You need to catch the exception and recover from the connect timeout.

@ Mike - Even without the try catch it shouldn’t cause an undef instr.

@ Mike

I know, I did not post the whole function. The issue is not the exception but the system crash, I suspect it is because there is a bug in socet.Connect that it does not return when the listener is away on the other end. I tried to work around that issue using ExecutionConstraint but that gives me a system crash every 30min…

Have set up 3 test systems, 2 that has a server to connect to, they have run without any problem for about 24 hour and one that has no server to connect to (trying to connects to ip where the computer is off) and that test system get a system crash every 30min

here is my systeminfo:
#### Exception Microsoft.SPOT.ConstraintException - 0x00000000 (7) ####
DeviceInfo:
#### Message:
#### Microsoft.SPOT.Net.SocketNative::poll [IP: 0000] ####
HAL build info: 4.2.0.0, Microsoft Copyright (C) Microsoft Corporation. All rig
#### System.Net.Sockets.Socket::Poll [IP: 0011] ####
#### System.Net.Sockets.Socket::Connect [IP: 0029] ####
OEM Product codes (vendor, model, SKU): 255, 0, 65535
#### EMX_Application1.BTHost::ConnectSocket [IP: 0025] ####
Serial Numbers (module, system):
#### EMX_Application1.BTHost::ProcessRequest [IP: 0021] ####
#### Exception Microsoft.SPOT.ConstraintException - 0x00000000 (7) ####
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
#### Message:
#### Microsoft.SPOT.Net.SocketNative::poll [IP: 0000] ####
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
#### System.Net.Sockets.Socket::Poll [IP: 0011] ####
#### System.Net.Sockets.Socket::Connect [IP: 0029] ####
Solution Build Info: 4.2.10.1, Copyright (C) GHI Electronics, LLC
#### EMX_Application1.BTHost::ConnectSocket [IP: 0025] ####
AppDomains:
#### EMX_Application1.BTHost::ProcessRequest [IP: 0021] ####
#### Exception Microsoft.SPOT.ConstraintException - 0x00000000 (7) ####
default, id=1
#### Message:
Assemblies:
#### Microsoft.SPOT.Net.SocketNative::poll [IP: 0000] ####
#### System.Net.Sockets.Socket::Poll [IP: 0011] ####
mscorlib,4.2.0.0
#### System.Net.Sockets.Socket::Connect [IP: 0029] ####
#### EMX_Application1.BTHost::ConnectSocket [IP: 0025] ####
Microsoft.SPOT.Native,4.2.0.0
#### EMX_Application1.BTHost::ProcessRequest [IP: 0021] ####
Microsoft.SPOT.Security.PKCS11,4.2.0.0
System.Security,4.2.0.0
Microsoft.SPOT.IO,4.2.0.0
Microsoft.SPOT.Hardware.SerialPort,4.2.0.0
GHI.Premium.IO,4.2.10.0
Microsoft.SPOT.Graphics,4.2.0.0
Microsoft.SPOT.Hardware,4.2.0.0
DI Dual Reader,1.0.0.0
GHI.Premium.System,4.2.10.0
System,4.2.0.0
GHI.Premium.Net,4.2.10.0
System.IO,4.2.0.0
Microsoft.SPOT.Net,4.2.0.0
GHI.Premium.Hardware,4.2.10.0
GHI.Hardware.EMX,4.2.10.0
GHI.Premium.SystemUpdate,4.2.10.0

Can a system crash crash like this overwrite system flash or in another way corrupt my system so that it does not recover?