AnsweredAssumed Answered

LLWU external wake up

Question asked by xavi vilajosana on Jun 11, 2012
Latest reply on Jun 19, 2012 by xavi vilajosana

Hello,

 

I am facing a strange behaviour that maybe someone can comment.

I am using MK20DX256VLL7 in the 72Mhz tower board and CW 10.2 with the service pack in linux.

 

I am running the MCU using the RTC and the FLL at 72Mhz.

 

My app is a simple loop that stays all the time in LLS mode and  has 3 wake up sources:

 

The LPTMR to wake up the k20 mcu from LLS at most every 10ms, (this means that can be less for example 1ms then after 3ms etc..) but for sure that once every 10ms it wakes up. It is configured as a wake up module in the LLWU using LLWU_ME_WUME0_MASK.

 

Then the UART rx pin which maps to the LLWU_PE1_WUPE0.

 

and finally PTC5 configured as an external interrupt on rising edge

 

//ptc5 .. ptc5 is pin 62, irq Aenable_irq(RADIO_EXTERNAL_PORT_IRQ_NUM);//enable the irq.   PORTC_PCR5 = PORT_PCR_MUX(1);// -- PTC5 used as gpioGPIOC_PDDR &= ~1<<RADIO_ISR_PIN; //set as input ==0PORTC_PCR5 |= PORT_PCR_IRQC(0x09); //9 interrupt on raising edge. PORTC_PCR5 |= PORT_PCR_ISF_MASK; //clear any pending interrupt.

 

I configure LLWU as follow:

 /*0x0200|0x0001 == LLWU_PE3_WUPE9 is external isr and LLWU_PE1_WUPE0 is UART RX */    llwu_configure( 0x0200|0x0001, LLWU_PIN_RISING, LLWU_ME_WUME0_MASK);

 

the PTC5 isr is mapped in the interrupt vector at position 89, (105 -16) and interrupts are enabled in the NVIC

 

void external_port_c_isr(void) { debugpins_isr_set();  //reconfigure..  if ((PORTC_ISFR) & (EXTPORTC_ISR_MASK)) {    PORTC_PCR5 |= PORT_PCR_ISF_MASK;    //clear flag  PORTC_ISFR |= EXTPORTC_ISR_MASK; //clear isr flag  //some simple calculation }else{  while(1); }      debugpins_isr_clr();}

 

in the LLWU isr I have:

 LLWU_F1 = 0xFF;            // clear wakeup flags
LLWU_F2 = 0xFF;            // clear wakeup flags LLWU_F3 = 0xFF;            // clear wakeup flags

 to clear the flags.

 

finally my applicaton is a simple loop that goes all the time to LLS:

 

while(1){    clk_monitor_0(OFF);//turn off clock monitors so the freq can be changed without causing a reset    PORTA_PCR2 |= PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;//JTAG_TDO     enter_lls();   //enter_wait();    clk_monitor_0(ON);//enable it again.}

 

If instead of going to LLS i go to WAIT, when the external pin is set, it executes normally the external_port_c_isr function and all works perfectly. (as expected)

 

However, when I go to LLS, the LLWU_ISR is executed whenever the external_isr_pin is toggled (as expected) but then never jumps to external_port_c_isr function (WHY??).

 

In contrast, the LPTMR after LLWU_isr, jumps to LPTMR_isr as described by the manual. Why I face this two different behaviours in the same thing?

 

for sure I miss something...

 

thanks!

 

 

 

Outcomes