LPC2138 Kalman IMU Memory problem

Hi guys !

I’ve run into a bit of trouble with one of my applications and I really hope that someone around here can help.

I’m trying to develop a Kalman filter IMU using the IMU 6DOF v4 controller board and Keil uVision3 as IDE. Unfortunatelly I don’t have a JTAG interface so I can’t debug the app.

Well… everything seems to work fine, the filtered attitudes are correct, centripetal compensation, altitude, heading etc. The only problem is that it only works for 1 to 10 minutes. After that I get strange values like +INF, -INF, NaN etc. and it never recovers… If I let it run, in the end I get something like HANDLER EXCEPTION and then it resets. However, if I set some variables at an absolute memory address I can get it to work longer, like 5 hours before throwing out strange numbers.

This makes me think that it’s more a memory problem than a KF problem.

I have taken extreme care in variable declarations, all that are supposed to be volatile, are volatile, static are static etc.

If anyone can think of a reason for this behaviour, please let me know.

Thanks,

James

Buffer overrun?

stack ?

Nobody can debug your code without actually seeing it.

Well… increasing the buffer sizes partially solved the problem. I don’t get any NaN or ±INF errors but, after a couple of hours an undefined handler exception is thrown…

Any ideas ?

Regards,

James

EMI? Are the power supplies enough filtered ? Do you have sensors connected with long lines ?

How is the reset line driven ? Try setting the unused pins as I/O lines in outputs mode.

Angelo

Everything is filtered and I don’t have any long lines.

Is there any way to recover from this kind of exception and continue execution? Or, is there a way to see at what address the program stopped ? Or, what instruction doesn’t recognize ?

I think an unknown interrupt gets triggered because I have the program set to show this error in case of a bad interrupt.

James

SOLVED !

It was the spurious interrupt issue on the LPC21xx. I have the RDA enabled for UART0.

Just added this handler instead of the Undefined_Handler:

void Spur_Handler(void) __irq

{

spurious_count++;

VICVectAddr = 0xff;

return;

}

and set the VICDefVectAddr = (long)Spur_Handler;

Now I can see that it counts around 10 spurious interrupts every 12 hours.

Thanks for all your help guys !

Regards,

James