Forums

More changes, still no Interrupt.

Started by Richard January 4, 2007
Still trying to get a UART1 interrupt using eclipse/GNUARM. Current
pertinent code below.

Any other ideas to consider with regards to interrupts in GNUARM?

Thanks

void IRQ_Routine (void) __attribute__ ((interrupt("IRQ")));
void uart1ISR(void)__attribute__ ((interrupt("IRQ")));

void uart1Init(void)
{
// set port pins for UART1
PINSEL0 |= 0x00050000;

UART1_IER |= 0x00; // disable THRE and RX
interrupt

UART1_IIR; // clear interrupt ID
UART1_RBR; // clear receive register
UART1_LSR; // clear line status register

// set the baudrate
UART1_LCR = ULCR_DLAB_ENABLE; // select divisor latches
UART1_DLL = (uint8_t)(PCLK / (baud*16)); // set for baud low byte
UART1_DLM = (PCLK / (baud*16))>>8; // set for baud high byte

// set the number of characters and other
// user specified operating parameters
UART1_LCR = (mode & ~ULCR_DLAB_ENABLE);
UART1_FCR = fmode;
// initialize the interrupt vector
//VICIntSelect &= ~0x00000080; // UART1 selected as IRQ
VICVectCntl4 = VICVectCntl0_ENABLE | VIC_Channel_Uart1;
VICVectAddr4 = (uint32_t)uart1ISR; // address of the ISR
VICIntEnable = 1<<7; //(1< interrupt enabled

dummy = UART1_IIR; // Read IrqID - Required to Get
Interrupts Started
UART1_IER = 3; // Enable UART1 RX and THRE Interrupts
}
void uart1ISR(void)
{
static int j;
IODIR |= 0xFFFF0000;
while(1)
{
for(j=0;j<20000;j++); //blink a light forever
IOSET |= 0xFFFF0000;
for(j=0;j<20000;j++);
IOCLR |= 0xFFFF0000;
}
VICVectAddr = 0x00000000; // clear this interrupt from
the VIC
dummy = UART1_IIR; // Read IrqID - Required to Get
Interrupts Started
}

An Engineer's Guide to the LPC2100 Series

---- Original Message ----
From: "Richard"
To:
Sent: Thursday, January 04, 2007 10:01 PM
Subject: [lpc2000] More changes, still no Interrupt.

> Still trying to get a UART1 interrupt using eclipse/GNUARM. Current
> pertinent code below.
>
> Any other ideas to consider with regards to interrupts in GNUARM?
>
> Thanks
>
> void IRQ_Routine (void) __attribute__ ((interrupt("IRQ")));
> void uart1ISR(void)__attribute__ ((interrupt("IRQ")));
>
> void uart1Init(void)
> {
> // set port pins for UART1
> PINSEL0 |= 0x00050000;
>
> UART1_IER |= 0x00; // disable THRE and RX
> interrupt
>
> UART1_IIR; // clear interrupt ID
> UART1_RBR; // clear receive register
> UART1_LSR; // clear line status
> register
>
> // set the baudrate
> UART1_LCR = ULCR_DLAB_ENABLE; // select divisor latches
> UART1_DLL = (uint8_t)(PCLK / (baud*16)); // set for baud low byte
> UART1_DLM = (PCLK / (baud*16))>>8; // set for baud high byte
>
> // set the number of characters and other
> // user specified operating parameters
> UART1_LCR = (mode & ~ULCR_DLAB_ENABLE);
> UART1_FCR = fmode;
> // initialize the interrupt vector
> //VICIntSelect &= ~0x00000080; // UART1 selected as IRQ
> VICVectCntl4 = VICVectCntl0_ENABLE | VIC_Channel_Uart1;
> VICVectAddr4 = (uint32_t)uart1ISR; // address of the ISR
> VICIntEnable = 1<<7; //(1< > interrupt enabled
>
> dummy = UART1_IIR; // Read IrqID - Required to Get
> Interrupts Started
> UART1_IER = 3; // Enable UART1 RX and THRE
> Interrupts
> }
> void uart1ISR(void)
> {
> static int j;
> IODIR |= 0xFFFF0000;
> while(1)
> {
> for(j=0;j<20000;j++); //blink a light forever
> IOSET |= 0xFFFF0000;
> for(j=0;j<20000;j++);
> IOCLR |= 0xFFFF0000;
> }
> VICVectAddr = 0x00000000; // clear this interrupt from
> the VIC
> dummy = UART1_IIR; // Read IrqID - Required to Get
> Interrupts Started
> }
Do you have a "ldr pc, [pc, #-0x0FF0]" at address 0x18 in your startup.s?

Do you enable IRQ interrupts in your startup.s, something like
"msr cpsr_c, #0x1F" with bit 7=0?

Karl Olsen
At 10:50 PM 1/4/07 +0100, Karl Olsen wrote:
>---- Original Message ----
>From: "Richard"
> > Still trying to get a UART1 interrupt using eclipse/GNUARM. Current
> > pertinent code below.
> >
> > Any other ideas to consider with regards to interrupts in GNUARM?
>Do you have a "ldr pc, [pc, #-0x0FF0]" at address 0x18 in your startup.s?
>
>Do you enable IRQ interrupts in your startup.s, something like
>"msr cpsr_c, #0x1F" with bit 7=0?
Also are you in user or system mode?
http://www.aeolusdevelopment.com/

From the Divided by a Common Language File (Edited to protect the guilty)
ME - "I'd like to get Price and delivery for connector Part # XXXXX"
Dist./Rep - "$X.XX Lead time 37 days"
ME - "Anything we can do about lead time? 37 days seems a bit high."
Dist./Rep - "that is the lead time given because our stock is live.... we
currently have stock."
Hmmm,
I appear to be in user mode as in crt.s the last mode configured is
user with:

msr CPSR_c, #MODE_SYS|I_BIT|F_BIT /* User Mode */

This appears to also set the FIQ and IRQ bits, disabling them, correct?

Rich
--- In l..., Robert Adsett wrote:
>
> At 10:50 PM 1/4/07 +0100, Karl Olsen wrote:
> >---- Original Message ----
> >From: "Richard"
> > > Still trying to get a UART1 interrupt using eclipse/GNUARM. Current
> > > pertinent code below.
> > >
> > > Any other ideas to consider with regards to interrupts in GNUARM?
> >
> >
> >Do you have a "ldr pc, [pc, #-0x0FF0]" at address 0x18 in your
startup.s?
> >
> >Do you enable IRQ interrupts in your startup.s, something like
> >"msr cpsr_c, #0x1F" with bit 7=0?
> Also are you in user or system mode?
> http://www.aeolusdevelopment.com/
>
> From the Divided by a Common Language File (Edited to protect the
guilty)
> ME - "I'd like to get Price and delivery for connector Part # XXXXX"
> Dist./Rep - "$X.XX Lead time 37 days"
> ME - "Anything we can do about lead time? 37 days seems a bit high."
> Dist./Rep - "that is the lead time given because our stock is
live.... we
> currently have stock."
>
Well that was it, insert headslap. (Interrupts disabled in crt.s)
This is what happens when you are used to IAR, Keil, etc and you
endeavour into the land of Gnu. You actually have to understand how
it works.

Thank you Robert and Karl.

Rich

--- In l..., "Karl Olsen" wrote:
>
> ---- Original Message ----
> From: "Richard"
> To:
> Sent: Thursday, January 04, 2007 10:01 PM
> Subject: [lpc2000] More changes, still no Interrupt.
>
> > Still trying to get a UART1 interrupt using eclipse/GNUARM. Current
> > pertinent code below.
> >
> > Any other ideas to consider with regards to interrupts in GNUARM?
> >
> > Thanks
> >
> > void IRQ_Routine (void) __attribute__ ((interrupt("IRQ")));
> > void uart1ISR(void)__attribute__ ((interrupt("IRQ")));
> >
> >
> >
> > void uart1Init(void)
> > {
> > // set port pins for UART1
> > PINSEL0 |= 0x00050000;
> >
> > UART1_IER |= 0x00; // disable THRE and RX
> > interrupt
> >
> > UART1_IIR; // clear interrupt ID
> > UART1_RBR; // clear receive register
> > UART1_LSR; // clear line status
> > register
> >
> > // set the baudrate
> > UART1_LCR = ULCR_DLAB_ENABLE; // select divisor latches
> > UART1_DLL = (uint8_t)(PCLK / (baud*16)); // set for baud low byte
> > UART1_DLM = (PCLK / (baud*16))>>8; // set for baud high byte
> >
> > // set the number of characters and other
> > // user specified operating parameters
> > UART1_LCR = (mode & ~ULCR_DLAB_ENABLE);
> > UART1_FCR = fmode;
> >
> >
> > // initialize the interrupt vector
> > //VICIntSelect &= ~0x00000080; // UART1 selected as IRQ
> > VICVectCntl4 = VICVectCntl0_ENABLE | VIC_Channel_Uart1;
> > VICVectAddr4 = (uint32_t)uart1ISR; // address of the ISR
> > VICIntEnable = 1<<7; //(1< > > interrupt enabled
> >
> > dummy = UART1_IIR; // Read IrqID - Required to Get
> > Interrupts Started
> > UART1_IER = 3; // Enable UART1 RX and THRE
> > Interrupts
> >
> >
> > }
> >
> >
> > void uart1ISR(void)
> > {
> > static int j;
> > IODIR |= 0xFFFF0000;
> > while(1)
> > {
> > for(j=0;j<20000;j++); //blink a light forever
> > IOSET |= 0xFFFF0000;
> > for(j=0;j<20000;j++);
> > IOCLR |= 0xFFFF0000;
> > }
> > VICVectAddr = 0x00000000; // clear this interrupt from
> > the VIC
> > dummy = UART1_IIR; // Read IrqID - Required to Get
> > Interrupts Started
> > }
> Do you have a "ldr pc, [pc, #-0x0FF0]" at address 0x18 in your
startup.s?
>
> Do you enable IRQ interrupts in your startup.s, something like
> "msr cpsr_c, #0x1F" with bit 7=0?
>
> Karl Olsen
>
At 10:54 PM 1/4/07 +0000, Richard wrote:
>Well that was it, insert headslap. (Interrupts disabled in crt.s)
>This is what happens when you are used to IAR, Keil, etc and you
>endeavour into the land of Gnu. You actually have to understand how
>it works.

You're welcome. I would suggest you also change the startup so that you
are in system mode. In user mode you cannot enable/disable interrupts.

Robert

Another sign of the end of civilization, our technical magazines are
getting chatty
From an EETimes product descriptions 2006/08/09
".... systems that can sample gobs of inputs simultaneously"
Now just what is the technical definition for gobs again?
http://www.aeolusdevelopment.com/
Richard wrote:
>
> Well that was it, insert headslap. (Interrupts disabled in crt.s)
> This is what happens when you are used to IAR, Keil, etc and you
> endeavour into the land of Gnu. You actually have to understand how
> it works.
>

LOL, you are now your way to Knowledge. "Put the mouse down and slowly
back away from the computer..."

:)

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