Reply by carnac100 January 24, 20092009-01-24
Try getting rid of the Idisable(); and IEnable(); in your ISRs. The
machine will disable interrupts by setting CPSR.7 and will not accept
another interrupt until the current one completes. You could be
having a race condition when IEnable(); command re-enables the
interrupts before the ISR returns and enables interrupts by restoring
the CPSR.

Frank

--- In l..., "emiel.guide" wrote:
>
> Thanks for your input,
>
> I did increase it from 128 to 512 bytes before. And did increase it
> again to 1024 bytes a few minutes ago without better result.
>
> I read something yesterday about settings the VPBDIV to 0 at the
> beginning of every interrupt and at the end of the interrupt put it
> back to 1. This did not work either.
>
> I did clean the flash with Flash magic. That didn't have any better
> results either.
> --- In l..., "tcirobot" wrote:
> >
> > --- In l..., "emiel.guide" wrote:
> > >
> > > When I turn off the timer interrupt, all interrupts work fine.
But I
> > > need the timer unfortunatly :( .
> > >
> > >
> > >
> > >
> > > --- In l..., "emiel.guide" wrote:
> > > >
> > > > I hope you can see it ...
> > > >
> > > > ===============================> > > > Main loop
> > > > -------------------------------
> > > > do{
> > > >
> > > > if(!Forward & !ibPlayPause) //playmode
> > > > {
> > > > libarm_disable_irq();
> > > >
> > > > if(!Forward){ //Put 512 bytes from SD in a buffer;}
> > > >
> > > > if(e == 0) //if it was the last sector or error
> > > > {
> > > > Forward = 1; //stop loop
> > > > }
> > > > else //
> > > > {
> > > > //Send the read sector to a DSP on the SPI bus.
> > > > }
> > > >
> > > > libarm_enable_irq();
> > > >
> > > > }
> > > > else //Player Paused or ended
> > > > {
> > > > while(ibPlayPause); //wait until interrupt resets the integer
> > > > }
> > > >
> > > > while(!Forward) //last sector is read out.
> > > >
> > > >
> > > > ===============================> > > > Interrupt Initialisation Code
> > > > -------------------------------
> > > >
> > > > VICProtection = 1;//no protection - user mode
> > > > VICIntEnClr = 0xFFFFFFFF; //clear all interrupts
> > > >
> > > > //Set EINT2 interrupt-------------------------------
> > > > PINSEL0 = VOL_MIN_SET | PAUSE_SET;
> > > > PINSEL1 = VOL_PLUS_SET;
> > > >
> > > > EXTMODE = 0xF; //edge sensitive.
> > > >
> > > > VICIntSelect = 0x00000000; //ALL IRQ based, not FIQ
> > > > //VICIntSelect = VOL_MIN_BIT | VOL_PLUS_BIT | PAUSE_BIT; //FIQ
> > > >
> > > > //button 1 interrupt
> > > > VICVectAddr4 = (unsigned int) &Button1_IRQ;
> > > > VICVectCntl4 = (1<<5) | MIN_BIT;
> > > > VICIntEnable |= MIN;
> > > >
> > > > //button 2 interrupt
> > > > VICVectAddr3 = (unsigned int) &Button2_IRQ;
> > > > VICVectCntl3 = (1<<5) | PLUS_BIT;
> > > > VICIntEnable |= PLUS;
> > > >
> > > > //button 3 interrupt
> > > > VICVectAddr2 = (unsigned int) &Button3_IRQ;
> > > > VICVectCntl2 = (1<<5) | PAUSE_BIT;
> > > > VICIntEnable |= PAUSE;
> > > >
> > > >
> > > > //UART
> > > > U0IER = 0x1; //Interrupt if available data ready.
> > > > VICVectAddr1 = (unsigned int) &UART0_IRQ;
> > > > VICVectCntl1 = (1<<5) | UART0_BIT;
> > > > VICIntEnable |= UART0;
> > > >
> > > > VICDefVectAddr = (unsigned int) NoVect_IRQ; //Run when a
> > > > unrecognized interrupt occurs
> > > >
> > > >
> > > > ===============================> > > > Timer initialisation
> > > > ---------------------
> > > > //Before adjustments
> > > > T0TCR = 0x02; // TIMER0 Disable; reset T0TC & T0PC //
> > > > T0PR = 0x00000000; // Reset T0PR //
> > > >
> > > > //choosing the periphial clock.
> > > > T0CTCR = 0x0; // increment TIMER0 on CAP0.0 falling edge //
> > > >
> > > > //choose the timer.
> > > > T0MR0 = 3000000; // Match register //every 250ms
> > > > T0MCR = 0x0003; // On MR0 Stop T0TC & T0PC and give interrupt
> > > >
> > > > //Enable the clock
> > > > T0TCR = 0x01; // TIMER0 Enable //
> > > >
> > > > //Enable interrupt.
> > > > VICVectAddr0 = (unsigned int) &TIME_IRQ;
> > > > VICVectCntl0 = (1<<5) | TIM0_BIT;
> > > > VICIntEnable |= TIM0;
> > > >
> > > > ===============================> > > > Timer IRQ routine
> > > > ---------------------
> > > > Idisable();
> > > >
> > > > T0IR = 0x01; //clear timerinterrupt.
> > > >
> > > > //here are a few rules of code that do nothing with the
registers.
> > > >
> > > > VICVectAddr = 0; // reset VIC
> > > >
> > > > IEnable();
> > > >
> > > > ===============================> > > > Button IRQ routine
> > > > ---------------------
> > > > Idisable();
> > > >
> > > > //here are a few rules of code that do nothing with the
registers.
> > > >
> > > > VICVectAddr = 0; // reset VIC
> > > > EXTINT = 0xFF; //I did clear them all since all interrupts are
> > > > disabled at this time.
> > > >
> > > > IEnable();
> > > >
> > > > ===============================> > > > Button UART routine
> > > > ---------------------
> > > > Idisable();
> > > >
> > > > cBuffer = U0RBR;
> > > >
> > > > //here is some code that verify if data in cBuffer is oke.
> > > >
> > > > do
> > > > {
> > > > BugSolution = U0RBR; //To avoid a NXP LPC bug.
> > > > }
> > > > while(U0LSR & 0x1 == 1); //read out the inputbuffer until
flag is
> > > > cleared.
> > > >
> > > >
> > > > VICVectAddr = 0;
> > > >
> > > > IEnable();
> > > >
> > > >
> > > > ===============================> > > > iDisable en iEnable functions
> > > > ---------------------
> > > > //because libarm_disable_irq() is not working and this does.
> > > > //Missing a interrupt is not a problem.
> > > >
> > > > void IEnable(void)
> > > > {
> > > > T0IR = 0x01;
> > > > VICIntEnable |= VOL_MIN | VOL_PLUS | PAUSE | UART0 | TIM0 ;
> > > > VICIntEnClr = 0x0000;
> > > > }
> > > >
> > > >
> > > > void Idisable(void)
> > > > {
> > > > VICIntEnable = 0x0000;
> > > > VICIntEnClr = 0x0000;
> > > > }
> > > >
> > > >
> > > >
> > > > I don't think you will find the answer here. The program is
> > working
> > > > fine now bye the way. But it interrupt routine Button3_IRQ
occurs
> > the
> > > > LPC will not response to any interrupt anymore.
> > > >
> > > > The code (between) in the button (3) interrupt routine is
> > > >
> > > > ----
> > > > if(ibPlayPause != 0) //In pause
> > > > {
> > > > ibPlayPause = 0; //play now
> > > > }
> > > > else //Busy play
> > > > {
> > > > ibPlayPause = 1; //Pause now
> > > > }
> > > >
> > > > Not that special. Crossworks shows that the variable is set
> > correctly
> > > > to go in "pause-mode" and it return to the main loop but all
> > > > interrupts seems to be turned off after that. The Timer
interrupt
> > is
> > > > not working either.
> > > >
> > >
> >
> > I haven't taken the time to review your code or to read all the
> > replies to your post. However, in case it hasn't been mentioned
one of
> > the differences when using nested interrupts is the amount of
stack
> > space that can be consumed. Do the simple test of increasing your
> > stack space and re-run your code.
> >
> > TC
>

An Engineer's Guide to the LPC2100 Series

Reply by "emiel.guide" January 23, 20092009-01-23
Thanks for your input,

I did increase it from 128 to 512 bytes before. And did increase it
again to 1024 bytes a few minutes ago without better result.

I read something yesterday about settings the VPBDIV to 0 at the
beginning of every interrupt and at the end of the interrupt put it
back to 1. This did not work either.

I did clean the flash with Flash magic. That didn't have any better
results either.

--- In l..., "tcirobot" wrote:
>
> --- In l..., "emiel.guide" wrote:
> >
> > When I turn off the timer interrupt, all interrupts work fine. But I
> > need the timer unfortunatly :( .
> >
> >
> >
> >
> > --- In l..., "emiel.guide" wrote:
> > >
> > > I hope you can see it ...
> > >
> > > ===============================> > > Main loop
> > > -------------------------------
> > > do{
> > >
> > > if(!Forward & !ibPlayPause) //playmode
> > > {
> > > libarm_disable_irq();
> > >
> > > if(!Forward){ //Put 512 bytes from SD in a buffer;}
> > >
> > > if(e == 0) //if it was the last sector or error
> > > {
> > > Forward = 1; //stop loop
> > > }
> > > else //
> > > {
> > > //Send the read sector to a DSP on the SPI bus.
> > > }
> > >
> > > libarm_enable_irq();
> > >
> > > }
> > > else //Player Paused or ended
> > > {
> > > while(ibPlayPause); //wait until interrupt resets the integer
> > > }
> > >
> > > while(!Forward) //last sector is read out.
> > >
> > >
> > > ===============================> > > Interrupt Initialisation Code
> > > -------------------------------
> > >
> > > VICProtection = 1;//no protection - user mode
> > > VICIntEnClr = 0xFFFFFFFF; //clear all interrupts
> > >
> > > //Set EINT2 interrupt-------------------------------
> > > PINSEL0 = VOL_MIN_SET | PAUSE_SET;
> > > PINSEL1 = VOL_PLUS_SET;
> > >
> > > EXTMODE = 0xF; //edge sensitive.
> > >
> > > VICIntSelect = 0x00000000; //ALL IRQ based, not FIQ
> > > //VICIntSelect = VOL_MIN_BIT | VOL_PLUS_BIT | PAUSE_BIT; //FIQ
> > >
> > > //button 1 interrupt
> > > VICVectAddr4 = (unsigned int) &Button1_IRQ;
> > > VICVectCntl4 = (1<<5) | MIN_BIT;
> > > VICIntEnable |= MIN;
> > >
> > > //button 2 interrupt
> > > VICVectAddr3 = (unsigned int) &Button2_IRQ;
> > > VICVectCntl3 = (1<<5) | PLUS_BIT;
> > > VICIntEnable |= PLUS;
> > >
> > > //button 3 interrupt
> > > VICVectAddr2 = (unsigned int) &Button3_IRQ;
> > > VICVectCntl2 = (1<<5) | PAUSE_BIT;
> > > VICIntEnable |= PAUSE;
> > >
> > >
> > > //UART
> > > U0IER = 0x1; //Interrupt if available data ready.
> > > VICVectAddr1 = (unsigned int) &UART0_IRQ;
> > > VICVectCntl1 = (1<<5) | UART0_BIT;
> > > VICIntEnable |= UART0;
> > >
> > > VICDefVectAddr = (unsigned int) NoVect_IRQ; //Run when a
> > > unrecognized interrupt occurs
> > >
> > >
> > > ===============================> > > Timer initialisation
> > > ---------------------
> > > //Before adjustments
> > > T0TCR = 0x02; // TIMER0 Disable; reset T0TC & T0PC //
> > > T0PR = 0x00000000; // Reset T0PR //
> > >
> > > //choosing the periphial clock.
> > > T0CTCR = 0x0; // increment TIMER0 on CAP0.0 falling edge //
> > >
> > > //choose the timer.
> > > T0MR0 = 3000000; // Match register //every 250ms
> > > T0MCR = 0x0003; // On MR0 Stop T0TC & T0PC and give interrupt
> > >
> > > //Enable the clock
> > > T0TCR = 0x01; // TIMER0 Enable //
> > >
> > > //Enable interrupt.
> > > VICVectAddr0 = (unsigned int) &TIME_IRQ;
> > > VICVectCntl0 = (1<<5) | TIM0_BIT;
> > > VICIntEnable |= TIM0;
> > >
> > > ===============================> > > Timer IRQ routine
> > > ---------------------
> > > Idisable();
> > >
> > > T0IR = 0x01; //clear timerinterrupt.
> > >
> > > //here are a few rules of code that do nothing with the registers.
> > >
> > > VICVectAddr = 0; // reset VIC
> > >
> > > IEnable();
> > >
> > > ===============================> > > Button IRQ routine
> > > ---------------------
> > > Idisable();
> > >
> > > //here are a few rules of code that do nothing with the registers.
> > >
> > > VICVectAddr = 0; // reset VIC
> > > EXTINT = 0xFF; //I did clear them all since all interrupts are
> > > disabled at this time.
> > >
> > > IEnable();
> > >
> > > ===============================> > > Button UART routine
> > > ---------------------
> > > Idisable();
> > >
> > > cBuffer = U0RBR;
> > >
> > > //here is some code that verify if data in cBuffer is oke.
> > >
> > > do
> > > {
> > > BugSolution = U0RBR; //To avoid a NXP LPC bug.
> > > }
> > > while(U0LSR & 0x1 == 1); //read out the inputbuffer until flag is
> > > cleared.
> > >
> > >
> > > VICVectAddr = 0;
> > >
> > > IEnable();
> > >
> > >
> > > ===============================> > > iDisable en iEnable functions
> > > ---------------------
> > > //because libarm_disable_irq() is not working and this does.
> > > //Missing a interrupt is not a problem.
> > >
> > > void IEnable(void)
> > > {
> > > T0IR = 0x01;
> > > VICIntEnable |= VOL_MIN | VOL_PLUS | PAUSE | UART0 | TIM0 ;
> > > VICIntEnClr = 0x0000;
> > > }
> > >
> > >
> > > void Idisable(void)
> > > {
> > > VICIntEnable = 0x0000;
> > > VICIntEnClr = 0x0000;
> > > }
> > >
> > >
> > >
> > > I don't think you will find the answer here. The program is
> working
> > > fine now bye the way. But it interrupt routine Button3_IRQ occurs
> the
> > > LPC will not response to any interrupt anymore.
> > >
> > > The code (between) in the button (3) interrupt routine is
> > >
> > > ----
> > > if(ibPlayPause != 0) //In pause
> > > {
> > > ibPlayPause = 0; //play now
> > > }
> > > else //Busy play
> > > {
> > > ibPlayPause = 1; //Pause now
> > > }
> > >
> > > Not that special. Crossworks shows that the variable is set
> correctly
> > > to go in "pause-mode" and it return to the main loop but all
> > > interrupts seems to be turned off after that. The Timer interrupt
> is
> > > not working either.
> > >
> > I haven't taken the time to review your code or to read all the
> replies to your post. However, in case it hasn't been mentioned one of
> the differences when using nested interrupts is the amount of stack
> space that can be consumed. Do the simple test of increasing your
> stack space and re-run your code.
>
> TC
>

Reply by tcirobot January 22, 20092009-01-22
--- In l..., "emiel.guide" wrote:
>
> When I turn off the timer interrupt, all interrupts work fine. But I
> need the timer unfortunatly :( .
> --- In l..., "emiel.guide" wrote:
> >
> > I hope you can see it ...
> >
> > ===============================> > Main loop
> > -------------------------------
> > do{
> >
> > if(!Forward & !ibPlayPause) //playmode
> > {
> > libarm_disable_irq();
> >
> > if(!Forward){ //Put 512 bytes from SD in a buffer;}
> >
> > if(e == 0) //if it was the last sector or error
> > {
> > Forward = 1; //stop loop
> > }
> > else //
> > {
> > //Send the read sector to a DSP on the SPI bus.
> > }
> >
> > libarm_enable_irq();
> >
> > }
> > else //Player Paused or ended
> > {
> > while(ibPlayPause); //wait until interrupt resets the integer
> > }
> >
> > while(!Forward) //last sector is read out.
> >
> >
> > ===============================> > Interrupt Initialisation Code
> > -------------------------------
> >
> > VICProtection = 1;//no protection - user mode
> > VICIntEnClr = 0xFFFFFFFF; //clear all interrupts
> >
> > //Set EINT2 interrupt-------------------------------
> > PINSEL0 = VOL_MIN_SET | PAUSE_SET;
> > PINSEL1 = VOL_PLUS_SET;
> >
> > EXTMODE = 0xF; //edge sensitive.
> >
> > VICIntSelect = 0x00000000; //ALL IRQ based, not FIQ
> > //VICIntSelect = VOL_MIN_BIT | VOL_PLUS_BIT | PAUSE_BIT; //FIQ
> >
> > //button 1 interrupt
> > VICVectAddr4 = (unsigned int) &Button1_IRQ;
> > VICVectCntl4 = (1<<5) | MIN_BIT;
> > VICIntEnable |= MIN;
> >
> > //button 2 interrupt
> > VICVectAddr3 = (unsigned int) &Button2_IRQ;
> > VICVectCntl3 = (1<<5) | PLUS_BIT;
> > VICIntEnable |= PLUS;
> >
> > //button 3 interrupt
> > VICVectAddr2 = (unsigned int) &Button3_IRQ;
> > VICVectCntl2 = (1<<5) | PAUSE_BIT;
> > VICIntEnable |= PAUSE;
> >
> >
> > //UART
> > U0IER = 0x1; //Interrupt if available data ready.
> > VICVectAddr1 = (unsigned int) &UART0_IRQ;
> > VICVectCntl1 = (1<<5) | UART0_BIT;
> > VICIntEnable |= UART0;
> >
> > VICDefVectAddr = (unsigned int) NoVect_IRQ; //Run when a
> > unrecognized interrupt occurs
> >
> >
> > ===============================> > Timer initialisation
> > ---------------------
> > //Before adjustments
> > T0TCR = 0x02; // TIMER0 Disable; reset T0TC & T0PC //
> > T0PR = 0x00000000; // Reset T0PR //
> >
> > //choosing the periphial clock.
> > T0CTCR = 0x0; // increment TIMER0 on CAP0.0 falling edge //
> >
> > //choose the timer.
> > T0MR0 = 3000000; // Match register //every 250ms
> > T0MCR = 0x0003; // On MR0 Stop T0TC & T0PC and give interrupt
> >
> > //Enable the clock
> > T0TCR = 0x01; // TIMER0 Enable //
> >
> > //Enable interrupt.
> > VICVectAddr0 = (unsigned int) &TIME_IRQ;
> > VICVectCntl0 = (1<<5) | TIM0_BIT;
> > VICIntEnable |= TIM0;
> >
> > ===============================> > Timer IRQ routine
> > ---------------------
> > Idisable();
> >
> > T0IR = 0x01; //clear timerinterrupt.
> >
> > //here are a few rules of code that do nothing with the registers.
> >
> > VICVectAddr = 0; // reset VIC
> >
> > IEnable();
> >
> > ===============================> > Button IRQ routine
> > ---------------------
> > Idisable();
> >
> > //here are a few rules of code that do nothing with the registers.
> >
> > VICVectAddr = 0; // reset VIC
> > EXTINT = 0xFF; //I did clear them all since all interrupts are
> > disabled at this time.
> >
> > IEnable();
> >
> > ===============================> > Button UART routine
> > ---------------------
> > Idisable();
> >
> > cBuffer = U0RBR;
> >
> > //here is some code that verify if data in cBuffer is oke.
> >
> > do
> > {
> > BugSolution = U0RBR; //To avoid a NXP LPC bug.
> > }
> > while(U0LSR & 0x1 == 1); //read out the inputbuffer until flag is
> > cleared.
> >
> >
> > VICVectAddr = 0;
> >
> > IEnable();
> >
> >
> > ===============================> > iDisable en iEnable functions
> > ---------------------
> > //because libarm_disable_irq() is not working and this does.
> > //Missing a interrupt is not a problem.
> >
> > void IEnable(void)
> > {
> > T0IR = 0x01;
> > VICIntEnable |= VOL_MIN | VOL_PLUS | PAUSE | UART0 | TIM0 ;
> > VICIntEnClr = 0x0000;
> > }
> >
> >
> > void Idisable(void)
> > {
> > VICIntEnable = 0x0000;
> > VICIntEnClr = 0x0000;
> > }
> >
> >
> >
> > I don't think you will find the answer here. The program is
working
> > fine now bye the way. But it interrupt routine Button3_IRQ occurs
the
> > LPC will not response to any interrupt anymore.
> >
> > The code (between) in the button (3) interrupt routine is
> >
> > ----
> > if(ibPlayPause != 0) //In pause
> > {
> > ibPlayPause = 0; //play now
> > }
> > else //Busy play
> > {
> > ibPlayPause = 1; //Pause now
> > }
> >
> > Not that special. Crossworks shows that the variable is set
correctly
> > to go in "pause-mode" and it return to the main loop but all
> > interrupts seems to be turned off after that. The Timer interrupt
is
> > not working either.
>
I haven't taken the time to review your code or to read all the
replies to your post. However, in case it hasn't been mentioned one of
the differences when using nested interrupts is the amount of stack
space that can be consumed. Do the simple test of increasing your
stack space and re-run your code.

TC
Reply by "emiel.guide" January 22, 20092009-01-22
When I turn off the timer interrupt, all interrupts work fine. But I
need the timer unfortunatly :( .

--- In l..., "emiel.guide" wrote:
>
> I hope you can see it ...
>
> ===============================> Main loop
> -------------------------------
> do{
>
> if(!Forward & !ibPlayPause) //playmode
> {
> libarm_disable_irq();
>
> if(!Forward){ //Put 512 bytes from SD in a buffer;}
>
> if(e == 0) //if it was the last sector or error
> {
> Forward = 1; //stop loop
> }
> else //
> {
> //Send the read sector to a DSP on the SPI bus.
> }
>
> libarm_enable_irq();
>
> }
> else //Player Paused or ended
> {
> while(ibPlayPause); //wait until interrupt resets the integer
> }
>
> while(!Forward) //last sector is read out.
> ===============================> Interrupt Initialisation Code
> -------------------------------
>
> VICProtection = 1;//no protection - user mode
> VICIntEnClr = 0xFFFFFFFF; //clear all interrupts
>
> //Set EINT2 interrupt-------------------------------
> PINSEL0 = VOL_MIN_SET | PAUSE_SET;
> PINSEL1 = VOL_PLUS_SET;
>
> EXTMODE = 0xF; //edge sensitive.
>
> VICIntSelect = 0x00000000; //ALL IRQ based, not FIQ
> //VICIntSelect = VOL_MIN_BIT | VOL_PLUS_BIT | PAUSE_BIT; //FIQ
>
> //button 1 interrupt
> VICVectAddr4 = (unsigned int) &Button1_IRQ;
> VICVectCntl4 = (1<<5) | MIN_BIT;
> VICIntEnable |= MIN;
>
> //button 2 interrupt
> VICVectAddr3 = (unsigned int) &Button2_IRQ;
> VICVectCntl3 = (1<<5) | PLUS_BIT;
> VICIntEnable |= PLUS;
>
> //button 3 interrupt
> VICVectAddr2 = (unsigned int) &Button3_IRQ;
> VICVectCntl2 = (1<<5) | PAUSE_BIT;
> VICIntEnable |= PAUSE;
> //UART
> U0IER = 0x1; //Interrupt if available data ready.
> VICVectAddr1 = (unsigned int) &UART0_IRQ;
> VICVectCntl1 = (1<<5) | UART0_BIT;
> VICIntEnable |= UART0;
>
> VICDefVectAddr = (unsigned int) NoVect_IRQ; //Run when a
> unrecognized interrupt occurs
> ===============================> Timer initialisation
> ---------------------
> //Before adjustments
> T0TCR = 0x02; // TIMER0 Disable; reset T0TC & T0PC //
> T0PR = 0x00000000; // Reset T0PR //
>
> //choosing the periphial clock.
> T0CTCR = 0x0; // increment TIMER0 on CAP0.0 falling edge //
>
> //choose the timer.
> T0MR0 = 3000000; // Match register //every 250ms
> T0MCR = 0x0003; // On MR0 Stop T0TC & T0PC and give interrupt
>
> //Enable the clock
> T0TCR = 0x01; // TIMER0 Enable //
>
> //Enable interrupt.
> VICVectAddr0 = (unsigned int) &TIME_IRQ;
> VICVectCntl0 = (1<<5) | TIM0_BIT;
> VICIntEnable |= TIM0;
>
> ===============================> Timer IRQ routine
> ---------------------
> Idisable();
>
> T0IR = 0x01; //clear timerinterrupt.
>
> //here are a few rules of code that do nothing with the registers.
>
> VICVectAddr = 0; // reset VIC
>
> IEnable();
>
> ===============================> Button IRQ routine
> ---------------------
> Idisable();
>
> //here are a few rules of code that do nothing with the registers.
>
> VICVectAddr = 0; // reset VIC
> EXTINT = 0xFF; //I did clear them all since all interrupts are
> disabled at this time.
>
> IEnable();
>
> ===============================> Button UART routine
> ---------------------
> Idisable();
>
> cBuffer = U0RBR;
>
> //here is some code that verify if data in cBuffer is oke.
>
> do
> {
> BugSolution = U0RBR; //To avoid a NXP LPC bug.
> }
> while(U0LSR & 0x1 == 1); //read out the inputbuffer until flag is
> cleared.
> VICVectAddr = 0;
>
> IEnable();
> ===============================> iDisable en iEnable functions
> ---------------------
> //because libarm_disable_irq() is not working and this does.
> //Missing a interrupt is not a problem.
>
> void IEnable(void)
> {
> T0IR = 0x01;
> VICIntEnable |= VOL_MIN | VOL_PLUS | PAUSE | UART0 | TIM0 ;
> VICIntEnClr = 0x0000;
> }
> void Idisable(void)
> {
> VICIntEnable = 0x0000;
> VICIntEnClr = 0x0000;
> }
>
> I don't think you will find the answer here. The program is working
> fine now bye the way. But it interrupt routine Button3_IRQ occurs the
> LPC will not response to any interrupt anymore.
>
> The code (between) in the button (3) interrupt routine is
>
> ----
> if(ibPlayPause != 0) //In pause
> {
> ibPlayPause = 0; //play now
> }
> else //Busy play
> {
> ibPlayPause = 1; //Pause now
> }
>
> Not that special. Crossworks shows that the variable is set correctly
> to go in "pause-mode" and it return to the main loop but all
> interrupts seems to be turned off after that. The Timer interrupt is
> not working either.
>

Reply by "emiel.guide" January 22, 20092009-01-22
I hope you can see it ...

===============================Main loop
-------------------------------
do{

if(!Forward & !ibPlayPause) //playmode
{
libarm_disable_irq();

if(!Forward){ //Put 512 bytes from SD in a buffer;}

if(e == 0) //if it was the last sector or error
{
Forward = 1; //stop loop
}
else //
{
//Send the read sector to a DSP on the SPI bus.
}

libarm_enable_irq();

}
else //Player Paused or ended
{
while(ibPlayPause); //wait until interrupt resets the integer
}

while(!Forward) //last sector is read out.
===============================Interrupt Initialisation Code
-------------------------------

VICProtection = 1;//no protection - user mode
VICIntEnClr = 0xFFFFFFFF; //clear all interrupts

//Set EINT2 interrupt-------------------------------
PINSEL0 = VOL_MIN_SET | PAUSE_SET;
PINSEL1 = VOL_PLUS_SET;

EXTMODE = 0xF; //edge sensitive.

VICIntSelect = 0x00000000; //ALL IRQ based, not FIQ
//VICIntSelect = VOL_MIN_BIT | VOL_PLUS_BIT | PAUSE_BIT; //FIQ

//button 1 interrupt
VICVectAddr4 = (unsigned int) &Button1_IRQ;
VICVectCntl4 = (1<<5) | MIN_BIT;
VICIntEnable |= MIN;

//button 2 interrupt
VICVectAddr3 = (unsigned int) &Button2_IRQ;
VICVectCntl3 = (1<<5) | PLUS_BIT;
VICIntEnable |= PLUS;

//button 3 interrupt
VICVectAddr2 = (unsigned int) &Button3_IRQ;
VICVectCntl2 = (1<<5) | PAUSE_BIT;
VICIntEnable |= PAUSE;
//UART
U0IER = 0x1; //Interrupt if available data ready.
VICVectAddr1 = (unsigned int) &UART0_IRQ;
VICVectCntl1 = (1<<5) | UART0_BIT;
VICIntEnable |= UART0;

VICDefVectAddr = (unsigned int) NoVect_IRQ; //Run when a
unrecognized interrupt occurs
===============================Timer initialisation
---------------------
//Before adjustments
T0TCR = 0x02; // TIMER0 Disable; reset T0TC & T0PC //
T0PR = 0x00000000; // Reset T0PR //

//choosing the periphial clock.
T0CTCR = 0x0; // increment TIMER0 on CAP0.0 falling edge //

//choose the timer.
T0MR0 = 3000000; // Match register //every 250ms
T0MCR = 0x0003; // On MR0 Stop T0TC & T0PC and give interrupt

//Enable the clock
T0TCR = 0x01; // TIMER0 Enable //

//Enable interrupt.
VICVectAddr0 = (unsigned int) &TIME_IRQ;
VICVectCntl0 = (1<<5) | TIM0_BIT;
VICIntEnable |= TIM0;

===============================Timer IRQ routine
---------------------
Idisable();

T0IR = 0x01; //clear timerinterrupt.

//here are a few rules of code that do nothing with the registers.

VICVectAddr = 0; // reset VIC

IEnable();

===============================Button IRQ routine
---------------------
Idisable();

//here are a few rules of code that do nothing with the registers.

VICVectAddr = 0; // reset VIC
EXTINT = 0xFF; //I did clear them all since all interrupts are
disabled at this time.

IEnable();

===============================Button UART routine
---------------------
Idisable();

cBuffer = U0RBR;

//here is some code that verify if data in cBuffer is oke.

do
{
BugSolution = U0RBR; //To avoid a NXP LPC bug.
}
while(U0LSR & 0x1 == 1); //read out the inputbuffer until flag is
cleared.
VICVectAddr = 0;

IEnable();
===============================iDisable en iEnable functions
---------------------
//because libarm_disable_irq() is not working and this does.
//Missing a interrupt is not a problem.

void IEnable(void)
{
T0IR = 0x01;
VICIntEnable |= VOL_MIN | VOL_PLUS | PAUSE | UART0 | TIM0 ;
VICIntEnClr = 0x0000;
}
void Idisable(void)
{
VICIntEnable = 0x0000;
VICIntEnClr = 0x0000;
}

I don't think you will find the answer here. The program is working
fine now bye the way. But it interrupt routine Button3_IRQ occurs the
LPC will not response to any interrupt anymore.

The code (between) in the button (3) interrupt routine is

----
if(ibPlayPause != 0) //In pause
{
ibPlayPause = 0; //play now
}
else //Busy play
{
ibPlayPause = 1; //Pause now
}

Not that special. Crossworks shows that the variable is set correctly
to go in "pause-mode" and it return to the main loop but all
interrupts seems to be turned off after that. The Timer interrupt is
not working either.
Reply by "emiel.guide" January 22, 20092009-01-22
I hope you can see it ...

===============================Main loop
-------------------------------
do{

if(!Forward & !ibPlayPause) //playmode
{
libarm_disable_irq();

if(!Forward){ //Put 512 bytes from SD in a buffer;}

if(e == 0) //if it was the last sector or error
{
Forward = 1; //stop loop
}
else //
{
//Send the read sector to a DSP on the SPI bus.
}

libarm_enable_irq();

}
else //Player Paused or ended
{
while(ibPlayPause); //wait until interrupt resets the integer
}

while(!Forward) //last sector is read out.
===============================Interrupt Initialisation Code
-------------------------------

VICProtection = 1;//no protection - user mode
VICIntEnClr = 0xFFFFFFFF; //clear all interrupts

//Set EINT2 interrupt-------------------------------
PINSEL0 = VOL_MIN_SET | PAUSE_SET;
PINSEL1 = VOL_PLUS_SET;

EXTMODE = 0xF; //edge sensitive.

VICIntSelect = 0x00000000; //ALL IRQ based, not FIQ
//VICIntSelect = VOL_MIN_BIT | VOL_PLUS_BIT | PAUSE_BIT; //FIQ

//button 1 interrupt
VICVectAddr4 = (unsigned int) &Button1_IRQ;
VICVectCntl4 = (1<<5) | MIN_BIT;
VICIntEnable |= MIN;

//button 2 interrupt
VICVectAddr3 = (unsigned int) &Button2_IRQ;
VICVectCntl3 = (1<<5) | PLUS_BIT;
VICIntEnable |= PLUS;

//button 3 interrupt
VICVectAddr2 = (unsigned int) &Button3_IRQ;
VICVectCntl2 = (1<<5) | PAUSE_BIT;
VICIntEnable |= PAUSE;
//UART
U0IER = 0x1; //Interrupt if available data ready.
VICVectAddr1 = (unsigned int) &UART0_IRQ;
VICVectCntl1 = (1<<5) | UART0_BIT;
VICIntEnable |= UART0;

VICDefVectAddr = (unsigned int) NoVect_IRQ; //Run when a
unrecognized interrupt occurs
===============================Timer initialisation
---------------------
//Before adjustments
T0TCR = 0x02; // TIMER0 Disable; reset T0TC & T0PC //
T0PR = 0x00000000; // Reset T0PR //

//choosing the periphial clock.
T0CTCR = 0x0; // increment TIMER0 on CAP0.0 falling edge //

//choose the timer.
T0MR0 = 3000000; // Match register //every 250ms
T0MCR = 0x0003; // On MR0 Stop T0TC & T0PC and give interrupt

//Enable the clock
T0TCR = 0x01; // TIMER0 Enable //

//Enable interrupt.
VICVectAddr0 = (unsigned int) &TIME_IRQ;
VICVectCntl0 = (1<<5) | TIM0_BIT;
VICIntEnable |= TIM0;

===============================Timer IRQ routine
---------------------
Idisable();

T0IR = 0x01; //clear timerinterrupt.

//here are a few rules of code that do nothing with the registers.

VICVectAddr = 0; // reset VIC

IEnable();

===============================Button IRQ routine
---------------------
Idisable();

//here are a few rules of code that do nothing with the registers.

VICVectAddr = 0; // reset VIC
EXTINT = 0xFF; //I did clear them all since all interrupts are
disabled at this time.

IEnable();

===============================Button UART routine
---------------------
Idisable();

cBuffer = U0RBR;

//here is some code that verify if data in cBuffer is oke.

do
{
BugSolution = U0RBR; //To avoid a NXP LPC bug.
}
while(U0LSR & 0x1 == 1); //read out the inputbuffer until flag is
cleared.

VICVectAddr = 0;

IEnable();
===============================iDisable en iEnable functions
---------------------
//because libarm_disable_irq() is not working and this does.
//Missing a interrupt is not a problem.

void IEnable(void)
{
T0IR = 0x01;
VICIntEnable |= VOL_MIN | VOL_PLUS | PAUSE | UART0 | TIM0 ;
VICIntEnClr = 0x0000;
}
void Idisable(void)
{
VICIntEnable = 0x0000;
VICIntEnClr = 0x0000;
}

I don't think you will find the answer here. The program is working
fine now bye the way.
--- In l..., "Alex Ribero" wrote:
>
> Hi:
>
> Could you post all your Interrupt Service Routine Code, so that we can
> see if there is something missing?
> And also your Timer Initialization code.
>
> I'm guessing that the 'Stop on Match' bit is set. This would
> effectively stop the interrupts after the first one.
>
> Regards,
>
> Alex R.
>
> --- In l..., "emiel.guide" wrote:
> >
> > yes,
> >
> > VICVectAddr = 0;
>
Reply by Alex Ribero January 22, 20092009-01-22
Hi:

Could you post all your Interrupt Service Routine Code, so that we can
see if there is something missing?
And also your Timer Initialization code.

I'm guessing that the 'Stop on Match' bit is set. This would
effectively stop the interrupts after the first one.

Regards,

Alex R.

--- In l..., "emiel.guide" wrote:
>
> yes,
>
> VICVectAddr = 0;
>

Reply by 42Bastian January 22, 20092009-01-22
Herbert Demmel schrieb:
> I was not referring to the current thread. Sometimes it's senseful to

So, why don't you start a new thread ?
--
42Bastian

Note: SPAM-only account, direct mail to bs42@...

Reply by Herbert Demmel January 22, 20092009-01-22
At 10:44 22.01.2009 +0000, you wrote:
>Why ? I prefer not to enable nested interrupt to keep the code simple.
>Or are you referring that it is only possible to avoid the 'bug' by
>enabling nested interrupts ?
>
>Thanks for your input :) .

I was not referring to the current thread. Sometimes it's senseful to
use nested interrupts. I was simply asking how to do that with Keil's
Realview compiler, because for my program it might be neccessary.

Herbert

>--- In l..., Herbert Demmel wrote:
> >
> > At 09:29 22.01.2009 +0000, you wrote:
> > >I did use libarm_(dis or en)able_irq(). I think that is the equal to
> > >the IEnable routine. I am not working in a keil environment but in
> > >Crossworks from Rowley.
> >
> > No. that's not the same. What we want is to enable nested interrupts.
> >
> > Herbert
> >
>
Reply by "emiel.guide" January 22, 20092009-01-22
Why ? I prefer not to enable nested interrupt to keep the code simple.
Or are you referring that it is only possible to avoid the 'bug' by
enabling nested interrupts ?

Thanks for your input :) .

--- In l..., Herbert Demmel wrote:
>
> At 09:29 22.01.2009 +0000, you wrote:
> >I did use libarm_(dis or en)able_irq(). I think that is the equal to
> >the IEnable routine. I am not working in a keil environment but in
> >Crossworks from Rowley.
>
> No. that's not the same. What we want is to enable nested interrupts.
>
> Herbert
>