Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Corssworks CTL examples

Corssworks CTL examples

2005-10-17 by rseku

I am testing simplest ever Crossworks CTL examples for builtin  multi 
tasking.
When I went through test 2 for Olimex(LPC2138), I found that button ISR
once energized never stops.I think, that button press event should be 
generated only once, when button is pressed ( I am not certain if LPC is 
working based on Edge or Level interrupt signal)

Example code as follows:
void
buttonPressedISR(void)
{
   count++;
   SetLeds(1);
   ctl_events_set_clear(&e1, 1, 0);
}

Below is a task which is wating for above event:

void
other(void *p)
{
   unsigned leds = 0;
   while (1)
     {
       ctl_events_wait(CTL_EVENT_WAIT_ALL_EVENTS, &e1, 1, 1, 
ctl_get_current_time()+1000);
       ctl_events_set_clear(&e1, 0, 1);
       leds ^= 0xFFFFFFFF;
       SetLeds(leds);
     }
}

Re: [lpc2000] Corssworks CTL examples

2005-10-17 by Tom Walsh

rseku wrote:

>I am testing simplest ever Crossworks CTL examples for builtin  multi 
>tasking.
>When I went through test 2 for Olimex(LPC2138), I found that button ISR
>once energized never stops.I think, that button press event should be 
>generated only once, when button is pressed ( I am not certain if LPC is 
>working based on Edge or Level interrupt signal)
>
>  
>
If you are experiencing continual execution of your ISR code, then it 
would probably be that the interrupt is in "level" rather than "edge" 
mode.  See section 3.5 (System Control Block: External Interrupt Inputs) 
of the Philips manual for the 2138.

TomW

-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Re: [lpc2000] Corssworks CTL examples

2005-10-18 by rseku

Thank You very much indeed!
Meantime I figured out, that external interrupt trigerring by level 
keeps triggering as long as the reason is kept.This makes continous 
interrupt processing the way, that other processes are completly blocked.
I hardly ever can imagine reason for such implementation?!
So as I mentioned I implemented edge trigerring.
But now, after first int. execution the system stops reacting to any 
interrupt. I have read, that EXTINT=4 (EINT2)during interrupt execution 
must be written, to enable further interrupts processing. So I do.
Then I have read VicIntAddr=0 must be written; so I do.
HAS ANYONE FOUND ANYTHING ELSE?
code below:
EXT INT init:
void
SetButtonPressedISR(CTL_ISR_FN_t isr)
{
   userButtonISR = isr;
   // P0.16 to alternate function 2 (EINT2)
   PINSEL0 |= 0x80000000;
   //PINSEL1 |= 1;
   EXTMODE = 4;
   ctl_set_isr(EINT_INT, 1,CTL_ISR_TRIGGER_POSITIVE_EDGE, buttonISR, 0);
   ctl_unmask_isr(EINT_INT);
}
INT code:
static void
buttonISR(void)
{
   userButtonISR();
   EXTINT = 4;
}








Tom Walsh wrote:
Show quoted textHide quoted text
> rseku wrote:
> 
> 
>>I am testing simplest ever Crossworks CTL examples for builtin  multi 
>>tasking.
>>When I went through test 2 for Olimex(LPC2138), I found that button ISR
>>once energized never stops.I think, that button press event should be 
>>generated only once, when button is pressed ( I am not certain if LPC is 
>>working based on Edge or Level interrupt signal)
>>
>> 
>>
> 
> If you are experiencing continual execution of your ISR code, then it 
> would probably be that the interrupt is in "level" rather than "edge" 
> mode.  See section 3.5 (System Control Block: External Interrupt Inputs) 
> of the Philips manual for the 2138.
> 
> TomW
>

Re: [lpc2000] Corssworks CTL examples

2005-10-18 by Tom Walsh

rseku wrote:

>Thank You very much indeed!
>Meantime I figured out, that external interrupt trigerring by level 
>keeps triggering as long as the reason is kept.This makes continous 
>interrupt processing the way, that other processes are completly blocked.
>I hardly ever can imagine reason for such implementation?!
>  
>

Yes, some external interrupt controllers / sources exert a continuous 
active level until all interrupt sources within them have been cleared.  
A device commonly found on early PC motherboards comes to mind, the 
InTel 8259 interrupt controller, a very popular chip.

There are advantages to the level activated interrupts, unfortunately, 
they did not implement the other advantage which is Edge triggering.

Look at the LPC2138 part, the External Interrupts are handled 
differently, at least you have the option of chosing Edge vs Level 
triggering.

Lucky for me that my customer fscked the original controller spec so 
badly that I had to put the MMC on the LPC2138 instead of the LPC2106.  
Now I have the Card Detect line on one of the edge triggerable External 
Interrupts.  It is now possible to detect when the card is removed / 
inserted.

TomW

-- 
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net, http://cyberiansoftware.com
"Windows? No thanks, I have work to do..."
----------------------------------------------------

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.