--- In l..., Nils Tijtgat wrote:
>
> Hi,
> this is my first post here, steadily learning ARM but I have a lot of problems
doing so :)
>
> I am trying to get external interrupt up and running on my Olimex LPC P2148
board (link). I am using ENT1 so I have a wire connected to P0.3 (SDA0 on the
board) which I want to trigger an interrupt with if I short it to +3.3V (rising
edge, eventually I want to trigger using a photodiode input but for now this
will simulate that).
>
> I am using Crossworks and CTL to configure the interrupts easily, below is the
code I use to initialize everything:
>
> PINSEL0 = 0x000000C0;
> ctl_set_isr(15, 1, CTL_ISR_TRIGGER_POSITIVE_EDGE, YSync_IRQ, 0);
> ctl_unmask_isr(15);
>
> The thing is: this code works and triggers an interrupt BUT it only works when
I short P0.3 to ground (!), so it's currently operating in LOW LEVEL mode,
not rising edge as I want! I can verify this because P0.3 is at 3.26V whereas
this should be 0V to get a correct rising edge reading I think?
>
> What exactly am I doing wrong or what do I have to do to get my piece of code
running? I've been looking at this for a long time now, can't seem to
get my head around it, all the help I can get is much appreciated!
>
> Nils
>
Try adding a pull-down resistor (say 1k) between the pin and ground. I imagine
the pin is just floating high.
The code is probably working in the mode you want because the method you use to
pull the pin to ground probably allows it to bounce high. You will want to be
careful you don't get a BUNCH of interrupts when you just scratch a
wire.
Richard