EmbeddedRelated.com
Forums

LPC2129 Interrupt Problem

Started by meepmeep24 April 25, 2006
Hi,

I am using an LPC2129. My VPBDIV is set to '1'. I have been using
EINT2 without a problem. I am able to set EXTPOLAR and EXTMODE
without a problem. I am aware of the known errata about VPBDIV and
EXTPOLAR so I set EXTPOLAR like this:

SCB_VPBDIV = 0 // first you set VPBDIV to 0
SCB_EXTPOLAR = 0x4; // then set your EXTPOLAR bit
SCB_VPBDIV = 1; // now, set VPBDIV back to what it originally was

Life is good when I do this. The problem is when I want to use EINT0
and when I set EXTPOLAR for EINT0 to 1 my system appears to hang and
I get no more serial port output. I set EXTPOLAR for EINT0 like this:

SCB_VPBDIV = 0
SCB_EXTPOLAR = 0x1;
SCB_VPBDIV = 1;

.. but when I run my code I lock up. I can set EXTPOLAR to 0x2, 0x4,
or 0x8 but NOT 0x1. If I comment out these lines my code will
continue.

Can someone help me with this? Am I not doing this correctly? Please
help me set EXTPOLAR to 1 for EINT0 when I have a VPBDIV of 1.

Thanks,
Todd

An Engineer's Guide to the LPC2100 Series

Hi Todd,

> I am using an LPC2129. My VPBDIV is set to '1'. I have been using
> EINT2 without a problem. I am able to set EXTPOLAR and EXTMODE
> without a problem. I am aware of the known errata about VPBDIV and
> EXTPOLAR so I set EXTPOLAR like this:
>
> SCB_VPBDIV = 0 // first you set VPBDIV to 0
> SCB_EXTPOLAR = 0x4; // then set your EXTPOLAR bit
> SCB_VPBDIV = 1; // now, set VPBDIV back to what it originally was
>
> Life is good when I do this. The problem is when I want to use EINT0
> and when I set EXTPOLAR for EINT0 to 1 my system appears to hang and
> I get no more serial port output. I set EXTPOLAR for EINT0 like this:
>
> SCB_VPBDIV = 0
> SCB_EXTPOLAR = 0x1;
> SCB_VPBDIV = 1;
>
> .. but when I run my code I lock up. I can set EXTPOLAR to 0x2, 0x4,
> or 0x8 but NOT 0x1. If I comment out these lines my code will
> continue.
>
> Can someone help me with this? Am I not doing this correctly? Please
> help me set EXTPOLAR to 1 for EINT0 when I have a VPBDIV of 1.
>
> Thanks,
> Todd

I have played a little around with this and I have found that if you write
an extra 0 to _VPBDIV before you set the final _VPBDIV it will survive.

SCB_VPBDIV = 0x00;
SCB_EXTPOLAR = 0x01;
SCB_VPBDIV = 0x01;
SCB_VPBDIV = 0x00 (extra write)
SCB_VPBDIV = 0x01 (you final VPBDIV setting)

I think that the errate sheet assumes something like this in the code
sample.
But if you look at the code below (sorry folks, it's FORTH) that little br /> just before the ok indicates that something strange happened on the serial
interface. I have the feeling that an interupt on the wrong place would be
bad.

0 vpb_div c! 1 ext_polar c! 1 vpb_div c! 0 vpb_div c! 1 vpb_div c!ok

Regards
Kell