EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

lpc2148 Crossworks interrupt problem

Started by "ernst.cozijnsen" February 19, 2009
Brothers in ARM(s),

I'm still having issues getting interrupts ctl api to work conrrectly
in crossworks.
The bottom code only works when i use:
void isr (void) __attribute__ ((interrupt("IRQ")));

As i understood this line should be avoided because the ctl library
takes care of this.
I read the manuals trough but i cannot get to a sollution for this.

Does anyone have ran into the same issue or knows a way to fix it?
#include "LPC214x.h"
#include
#define PLOCK 0x400
void init(void);
void delay_ms(int);

volatile int servo;

int main(void)
{
init();
init_isr();
PINSEL1 = 0x10000000; //p0.30 = AD0.3
IODIR0 = 0x00200000; //p0.21 = output
AD0CR = 0x00210e08; //start burst A/D on AD0.3
T0TCR = 0x02; //reset counter
T0IR = 0xff;
T0MCR = 0x0003; //interrupt and reset on MR0
T0MR0 = 0x00124f80; //compare-hit count
T0TCR = 0x01; //enable Timer0
ctl_global_interrupts_enable();

while(1){
}
}
void init_isr(void)
{
ctl_set_isr(4, 0, CTL_ISR_TRIGGER_FIXED, isr, 0);
ctl_unmask_isr( 4);
}

void isr(void)
{
// DO stuff
T0IR = 0x01; //clear interrupt
}

An Engineer's Guide to the LPC2100 Series

Have you set the preprocessor definition "VECTORED_IRQ_INTERRUPTS"?

Assuming you are using the default startup file that Crossworks sets
up for a project, look in the Philips_LPC210X_Startup.s file.

Jeff
--- In l..., "ernst.cozijnsen"
wrote:
>
> Brothers in ARM(s),
>
> I'm still having issues getting interrupts ctl api to work
conrrectly
> in crossworks.
> The bottom code only works when i use:
> void isr (void) __attribute__ ((interrupt("IRQ")));
>
> As i understood this line should be avoided because the ctl library
> takes care of this.
> I read the manuals trough but i cannot get to a sollution for this.
>
> Does anyone have ran into the same issue or knows a way to fix it?
> #include "LPC214x.h"
> #include
> #define PLOCK 0x400
> void init(void);
> void delay_ms(int);
>
> volatile int servo;
>
> int main(void)
> {
> init();
> init_isr();
> PINSEL1 = 0x10000000; //p0.30 = AD0.3
> IODIR0 = 0x00200000; //p0.21 = output
> AD0CR = 0x00210e08; //start burst A/D on AD0.3
> T0TCR = 0x02; //reset counter
> T0IR = 0xff;
> T0MCR = 0x0003; //interrupt and reset on MR0
> T0MR0 = 0x00124f80; //compare-hit count
> T0TCR = 0x01; //enable Timer0
> ctl_global_interrupts_enable();
>
> while(1){
> }
> }
> void init_isr(void)
> {
> ctl_set_isr(4, 0, CTL_ISR_TRIGGER_FIXED, isr, 0);
> ctl_unmask_isr( 4);
> }
>
> void isr(void)
> {
> // DO stuff
> T0IR = 0x01; //clear interrupt
> }
>

Yes this option is set in preprocessor definitions together with STARTUP_FROM_RESET

--- On Thu, 2/19/09, ksdoubleshooter wrote:

From: ksdoubleshooter
Subject: [lpc2000] Re: lpc2148 Crossworks interrupt problem
To: l...
Date: Thursday, February 19, 2009, 3:16 PM

Have you set the preprocessor definition "VECTORED_IRQ_ INTERRUPTS" ?

Assuming you are using the default startup file that Crossworks sets

up for a project, look in the Philips_LPC210X_ Startup.s file.

Jeff

--- In lpc2000@yahoogroups .com, "ernst.cozijnsen"

wrote:

>

> Brothers in ARM(s),

>

> I'm still having issues getting interrupts ctl api to work

conrrectly

> in crossworks.

> The bottom code only works when i use:

> void isr (void) __attribute_ _ ((interrupt( "IRQ")));

>

> As i understood this line should be avoided because the ctl library

> takes care of this.

> I read the manuals trough but i cannot get to a sollution for this.

>

> Does anyone have ran into the same issue or knows a way to fix it?

>

>

> #include "LPC214x.h"

> #include

> #define PLOCK 0x400

> void init(void);

> void delay_ms(int) ;

>

> volatile int servo;

>

> int main(void)

> {

> init();

> init_isr();

> PINSEL1 = 0x10000000; //p0.30 = AD0.3

> IODIR0 = 0x00200000; //p0.21 = output

> AD0CR = 0x00210e08; //start burst A/D on AD0.3

> T0TCR = 0x02; //reset counter

> T0IR = 0xff;

> T0MCR = 0x0003; //interrupt and reset on MR0

> T0MR0 = 0x00124f80; //compare-hit count

> T0TCR = 0x01; //enable Timer0

> ctl_global_interrup ts_enable( );

>

> while(1){

> }

> }

>

>

> void init_isr(void)

> {

> ctl_set_isr( 4, 0, CTL_ISR_TRIGGER_ FIXED, isr, 0);

> ctl_unmask_isr( 4);

> }

>

> void isr(void)

> {

> // DO stuff

> T0IR = 0x01; //clear interrupt

> }

>



Hi Ernst,

if you upload youre code to the files section. i'm willing to have a look at
it. not that i'm an expert but i use rowley and also do some ISR code using
2148 and 2468 both with CTL. so just upload if you will and give me a mail.

Gr Martijn Broens

2009/2/19 ernst.cozijnsen

> Brothers in ARM(s),
>
> I'm still having issues getting interrupts ctl api to work conrrectly
> in crossworks.
> The bottom code only works when i use:
> void isr (void) __attribute__ ((interrupt("IRQ")));
>
> As i understood this line should be avoided because the ctl library
> takes care of this.
> I read the manuals trough but i cannot get to a sollution for this.
>
> Does anyone have ran into the same issue or knows a way to fix it?
>
> #include "LPC214x.h"
> #include
> #define PLOCK 0x400
> void init(void);
> void delay_ms(int);
>
> volatile int servo;
>
> int main(void)
> {
> init();
> init_isr();
> PINSEL1 = 0x10000000; //p0.30 = AD0.3
> IODIR0 = 0x00200000; //p0.21 = output
> AD0CR = 0x00210e08; //start burst A/D on AD0.3
> T0TCR = 0x02; //reset counter
> T0IR = 0xff;
> T0MCR = 0x0003; //interrupt and reset on MR0
> T0MR0 = 0x00124f80; //compare-hit count
> T0TCR = 0x01; //enable Timer0
> ctl_global_interrupts_enable();
>
> while(1){
> }
> }
>
> void init_isr(void)
> {
> ctl_set_isr(4, 0, CTL_ISR_TRIGGER_FIXED, isr, 0);
> ctl_unmask_isr( 4);
> }
>
> void isr(void)
> {
> // DO stuff
> T0IR = 0x01; //clear interrupt
> }
>

--
kind regards,
Martijn Broens

mBedit
Kloostertuin 4
NL-6584 GE Molenhoek
the Netherlands
+31 642 703 502
m...@mbedit.nl
kvk: 09143703 0000

------------------------
This transmission is confidential and intended solely for the person or
organisation to whom it is addressed. It may contain privileged and
confidential information. If you are not the intended recipient, you should
not copy, distribute, reproduce, publish or disclose the information, take
any action in reliance on it or use it for your own benefit. If you have
received this transmission in error, please notify us by returning this
email to the sender.


Hi Martijn,

I've uploaded the code in the files section and its called autopilot.rar.

Many thanks up front.

Ernst

--- On Sat, 2/21/09, Martijn Broens wrote:

From: Martijn Broens
Subject: Re: [lpc2000] lpc2148 Crossworks interrupt problem
To: l...
Date: Saturday, February 21, 2009, 6:31 PM

Hi Ernst,

if you upload youre code to the files section. i'm willing to have a look at

it. not that i'm an expert but i use rowley and also do some ISR code using

2148 and 2468 both with CTL. so just upload if you will and give me a mail.

Gr Martijn Broens

2009/2/19 ernst.cozijnsen

> Brothers in ARM(s),

>

> I'm still having issues getting interrupts ctl api to work conrrectly

> in crossworks.

> The bottom code only works when i use:

> void isr (void) __attribute_ _ ((interrupt( "IRQ")));

>

> As i understood this line should be avoided because the ctl library

> takes care of this.

> I read the manuals trough but i cannot get to a sollution for this.

>

> Does anyone have ran into the same issue or knows a way to fix it?

>

> #include "LPC214x.h"

> #include

> #define PLOCK 0x400

> void init(void);

> void delay_ms(int) ;

>

> volatile int servo;

>

> int main(void)

> {

> init();

> init_isr();

> PINSEL1 = 0x10000000; //p0.30 = AD0.3

> IODIR0 = 0x00200000; //p0.21 = output

> AD0CR = 0x00210e08; //start burst A/D on AD0.3

> T0TCR = 0x02; //reset counter

> T0IR = 0xff;

> T0MCR = 0x0003; //interrupt and reset on MR0

> T0MR0 = 0x00124f80; //compare-hit count

> T0TCR = 0x01; //enable Timer0

> ctl_global_interrup ts_enable( );

>

> while(1){

> }

> }

>

> void init_isr(void)

> {

> ctl_set_isr( 4, 0, CTL_ISR_TRIGGER_ FIXED, isr, 0);

> ctl_unmask_isr( 4);

> }

>

> void isr(void)

> {

> // DO stuff

> T0IR = 0x01; //clear interrupt

> }

>

>

>

--

kind regards,

Martijn Broens

mBedit

Kloostertuin 4

NL-6584 GE Molenhoek

the Netherlands

+31 642 703 502

martijn@mbedit. nl

kvk: 09143703 0000

------------ --------- --------- --------- --------- --------- -

This transmission is confidential and intended solely for the person or

organisation to whom it is addressed. It may contain privileged and

confidential information. If you are not the intended recipient, you should

not copy, distribute, reproduce, publish or disclose the information, take

any action in reliance on it or use it for your own benefit. If you have

received this transmission in error, please notify us by returning this

email to the sender.





Hi,

Jeff has spotted your problem. With "VECTORED_IRQ_INTERRUPTS" defined
your interrupt handler will be called directly by the VIC so the
interrupt("IRQ") attribute is required. If you remove the define
"VECTORED_IRQ_INTERRUPTS" then all interrupts are handled by
irq_handler which calls the regular function held in the VIC register.

Regards
Michael

>
> Have you set the preprocessor definition "VECTORED_IRQ_INTERRUPTS"?
>
> Assuming you are using the default startup file that Crossworks sets
> up for a project, look in the Philips_LPC210X_Startup.s file.
>
> Jeff
> --- In l..., "ernst.cozijnsen"
> wrote:
> >
> > Brothers in ARM(s),
> >
> > I'm still having issues getting interrupts ctl api to work
> conrrectly
> > in crossworks.
> > The bottom code only works when i use:
> > void isr (void) __attribute__ ((interrupt("IRQ")));
> >
> > As i understood this line should be avoided because the ctl library
> > takes care of this.
> > I read the manuals trough but i cannot get to a sollution for this.
> >
> > Does anyone have ran into the same issue or knows a way to fix it?
> >
> >
> > #include "LPC214x.h"
> > #include
> > #define PLOCK 0x400
> > void init(void);
> > void delay_ms(int);
> >
> > volatile int servo;
> >
> > int main(void)
> > {
> > init();
> > init_isr();
> > PINSEL1 = 0x10000000; //p0.30 = AD0.3
> > IODIR0 = 0x00200000; //p0.21 = output
> > AD0CR = 0x00210e08; //start burst A/D on AD0.3
> > T0TCR = 0x02; //reset counter
> > T0IR = 0xff;
> > T0MCR = 0x0003; //interrupt and reset on MR0
> > T0MR0 = 0x00124f80; //compare-hit count
> > T0TCR = 0x01; //enable Timer0
> > ctl_global_interrupts_enable();
> >
> > while(1){
> > }
> > }
> >
> >
> > void init_isr(void)
> > {
> > ctl_set_isr(4, 0, CTL_ISR_TRIGGER_FIXED, isr, 0);
> > ctl_unmask_isr( 4);
> > }
> >
> > void isr(void)
> > {
> > // DO stuff
> > T0IR = 0x01; //clear interrupt
> > }
>

So if i see this correct:

I need to remove the "VECTORED_IRQ_ INTERRUPTS from teh startup file so i can use the crosworks style ctl libs right?

Remenber i'm a newb at this so dont start slapping me right away

Ernst

--- On Mon, 2/23/09, nutleycottage wrote:

From: nutleycottage
Subject: [lpc2000] Re: lpc2148 Crossworks interrupt problem
To: l...
Date: Monday, February 23, 2009, 7:33 AM

Hi,

Jeff has spotted your problem. With "VECTORED_IRQ_ INTERRUPTS" defined

your interrupt handler will be called directly by the VIC so the

interrupt("IRQ" ) attribute is required. If you remove the define

"VECTORED_IRQ_ INTERRUPTS" then all interrupts are handled by

irq_handler which calls the regular function held in the VIC register.

Regards

Michael

>

> Have you set the preprocessor definition "VECTORED_IRQ_ INTERRUPTS" ?

>

> Assuming you are using the default startup file that Crossworks sets

> up for a project, look in the Philips_LPC210X_ Startup.s file.

>

> Jeff

>

>

> --- In lpc2000@yahoogroups .com, "ernst.cozijnsen"

> wrote:

> >

> > Brothers in ARM(s),

> >

> > I'm still having issues getting interrupts ctl api to work

> conrrectly

> > in crossworks.

> > The bottom code only works when i use:

> > void isr (void) __attribute_ _ ((interrupt( "IRQ")));

> >

> > As i understood this line should be avoided because the ctl library

> > takes care of this.

> > I read the manuals trough but i cannot get to a sollution for this.

> >

> > Does anyone have ran into the same issue or knows a way to fix it?

> >

> >

> > #include "LPC214x.h"

> > #include

> > #define PLOCK 0x400

> > void init(void);

> > void delay_ms(int) ;

> >

> > volatile int servo;

> >

> > int main(void)

> > {

> > init();

> > init_isr();

> > PINSEL1 = 0x10000000; //p0.30 = AD0.3

> > IODIR0 = 0x00200000; //p0.21 = output

> > AD0CR = 0x00210e08; //start burst A/D on AD0.3

> > T0TCR = 0x02; //reset counter

> > T0IR = 0xff;

> > T0MCR = 0x0003; //interrupt and reset on MR0

> > T0MR0 = 0x00124f80; //compare-hit count

> > T0TCR = 0x01; //enable Timer0

> > ctl_global_interrup ts_enable( );

> >

> > while(1){

> > }

> > }

> >

> >

> > void init_isr(void)

> > {

> > ctl_set_isr( 4, 0, CTL_ISR_TRIGGER_ FIXED, isr, 0);

> > ctl_unmask_isr( 4);

> > }

> >

> > void isr(void)

> > {

> > // DO stuff

> > T0IR = 0x01; //clear interrupt

> > }

> >

>



Hi,
    i'm fresher to work with the lpc2106...  can anyone help me hw to start the asm program in the KEIL-uV3!! more over i didnt run any instructions for lpc in KEIL.. can anybody help me with proper guidance and asm sample programs for lpc2106!!!
Thanks and Regards,
PHR.

________________________________
From: nutleycottage
To: l...
Sent: Monday, 23 February, 2009 1:03:00 PM
Subject: [lpc2000] Re: lpc2148 Crossworks interrupt problem
Hi,

Jeff has spotted your problem. With "VECTORED_IRQ_ INTERRUPTS" defined
your interrupt handler will be called directly by the VIC so the
interrupt("IRQ" ) attribute is required. If you remove the define
"VECTORED_IRQ_ INTERRUPTS" then all interrupts are handled by
irq_handler which calls the regular function held in the VIC register.

Regards
Michael

>
> Have you set the preprocessor definition "VECTORED_IRQ_ INTERRUPTS" ?
>
> Assuming you are using the default startup file that Crossworks sets
> up for a project, look in the Philips_LPC210X_ Startup.s file.
>
> Jeff
>
>
> --- In lpc2000@yahoogroups .com, "ernst.cozijnsen"
> wrote:
> >
> > Brothers in ARM(s),
> >
> > I'm still having issues getting interrupts ctl api to work
> conrrectly
> > in crossworks.
> > The bottom code only works when i use:
> > void isr (void) __attribute_ _ ((interrupt( "IRQ")));
> >
> > As i understood this line should be avoided because the ctl library
> > takes care of this.
> > I read the manuals trough but i cannot get to a sollution for this.
> >
> > Does anyone have ran into the same issue or knows a way to fix it?
> >
> >
> > #include "LPC214x.h"
> > #include
> > #define PLOCK 0x400
> > void init(void);
> > void delay_ms(int) ;
> >
> > volatile int servo;
> >
> > int main(void)
> > {
> > init();
> > init_isr();
> > PINSEL1 = 0x10000000; //p0.30 = AD0.3
> > IODIR0 = 0x00200000; //p0.21 = output
> > AD0CR = 0x00210e08; //start burst A/D on AD0.3
> > T0TCR = 0x02; //reset counter
> > T0IR = 0xff;
> > T0MCR = 0x0003; //interrupt and reset on MR0
> > T0MR0 = 0x00124f80; //compare-hit count
> > T0TCR = 0x01; //enable Timer0
> > ctl_global_interrup ts_enable( );
> >
> > while(1){
> > }
> > }
> >
> >
> > void init_isr(void)
> > {
> > ctl_set_isr( 4, 0, CTL_ISR_TRIGGER_ FIXED, isr, 0);
> > ctl_unmask_isr( 4);
> > }
> >
> > void isr(void)
> > {
> > // DO stuff
> > T0IR = 0x01; //clear interrupt
> > }
>

Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/



Hemanandha Ramesh schrieb:
> Hi,
> i'm fresher to work with the lpc2106... can anyone help me hw to start the asm program in the KEIL-uV3!! more over i didnt run any instructions for lpc in KEIL.. can anybody help me with proper guidance and asm sample programs for lpc2106!!!

Look in the examples folder of the compiler and read the documentation.

Heck, did the new semester start ???

--
42Bastian

Note: SPAM-only account, direct mail to bs42@...
On Monday 23 February 2009 19:30, 42Bastian wrote:
> Hemanandha Ramesh schrieb:
> > Hi,
> > i'm fresher to work with the lpc2106... can anyone help me
> > hw to start the asm program in the KEIL-uV3!! more over i didnt
> > run any instructions for lpc in KEIL.. can anybody help me with
> > proper guidance and asm sample programs for lpc2106!!!
>
> Look in the examples folder of the compiler and read the
> documentation.
>
> Heck, did the new semester start ???

No. the old one is ending. Journal submission is just around the
corner here in India. And NXP or some smart sales guy must be dishing
out arm devices and development kits to the college labs.

--
Rgds
JTD

The 2024 Embedded Online Conference