cancel
Showing results for 
Search instead for 
Did you mean: 

External Interrupt & random behavior after LPWFI

tech9
Associate II
Posted on March 30, 2006 at 13:53

External Interrupt & random behavior after LPWFI

4 REPLIES 4
tech9
Associate II
Posted on October 18, 2005 at 13:01

Hello all,

I get a random behavior when exiting the Low Power Wait For Interrupt mode on my STR710. I use Embedded Workbench from IAR.

When entering LPWFI; I do:

XTI_Init(); //initialize the XTI

XTI_LineModeConfig(XTI_Line15, XTI_RisingEdge); //Configure the line 15 mode ,select Rising edge trig

XTI_LineConfig(XTI_Line15, ENABLE); //Enable line 15 WAKEUP pin or RTC Alarm

XTI_LineModeConfig(XTI_Line12, XTI_RisingEdge); //Configure the line 12

XTI_LineConfig(XTI_Line12, ENABLE); //Enable line UART0 as EXT_INT

XTI_ModeConfig(XTI_WakeUpInterrupt, ENABLE); //Enable Wake-Up mode in the XTI

And then:

//Configure interrupt controller

EIC_IRQChannelPriorityConfig(XTI_IRQChannel,1); // set the interrupt priority for external interrupt

EIC_IRQChannelConfig(XTI_IRQChannel,ENABLE); // Enable external interrupt.

EIC_IRQConfig(ENABLE); // Enable the IRQ

After that; I actually enter the WFI mode, using:

SLOW(RTC_CLK); // Enter Slow mode with 32 KHz as sys clock

FLASHR->CR0 |= 0x8000; // set bit PWD: flash power down

for(int i=0; i

LPWFI(RTC_CLK,DISABLE); // Enter in LPWFI ( LPWFI clock = 32KHz RTC Clock, MVR disabled)

All of the previous lines work perfectly well, as I have monitored the slowed down clock on the CLKOUT on my MB393B eval board.

I however need to get out of this deep sleep; so the interrupt routine goes like this:

void XTI_IRQHandler(void)

{

XTIsource=XTI_InterruptLineValue();

XTI_PendingBitClear(XTIsource );

}

Knowing I had set the XTI_Line12 (the one for the UART0) correctly (I looked at the XTI registers) and it is programmed as

WakeUp and Interrupt, I should branch to the routine of my UART upon interrupt at this particular line. Actually, the value of XTIsource is correct when I recover from the mode. But the MCU executes the code in the related ISR randomly, sometimes it does, other times it does not.

The same thing happens with the RTC Alarm(line 15) as an external interrupt to wake me up.

Sometimes it branches, some other times it doesn't! I burn the code into Flash, and press reset (so the same code executes each time) and get a different behavior (branch, doesn't branch)

Any thoughts/ideas/comments on this situation?

Thank you,

tech

tech9
Associate II
Posted on October 19, 2005 at 11:42

Due to confidentiality agreements with my employer, I cannot send more than what is posted. I hope you will understand; I am on thin ice when it comes to sharing code... :(

With best regards,

Tech

tech9
Associate II
Posted on October 24, 2005 at 11:50

Thanks for the reply Zouh,

This code actually works great the way it is, meaning the alarm wakes the mcu and resumes the program.

However, if I add the XTI_line 12 (for the UART0), I do not get the same behavior: the MCU resumes but there is never any character in the uart's buffer. Is this because of the slow clock?

What should I do to prevent this situation? I do not want to miss characters, but saving power is also an issue. I tried resuming the regular clock (48 Mhz from PLL1) in the XTI isr, but I still miss characters.

Thanks for any input!

Best regards,

Tech

anil23
Associate II
Posted on March 30, 2006 at 13:53

Hi Zouh,

Do you have an example to run the MCU in slow mode (in IAR)? I would be using the external CK_AF for this mode.

Also, I understand the main oscillator is disconnected from the MCU in the software. But, when I look at the schematics of the STR710 board, I don’t see any connections between the P0.10 or P1.0 to the main oscillator. Am I missing something here?

Regards,