Separate WAKEUP_IRQHandler functions

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Separate WAKEUP_IRQHandler functions

388 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tbelo on Sun Mar 03 03:35:39 MST 2013
Hi there,
What I want is to combine selfwakeup using timer [U]with[/U] wakeup from externally triggered pin.
I realize that exists a single function for this: WAKEUP_IRQHandler

Can I have 2 different WAKEUP_IRQHandler functions for each IRQ ?

Thanks
0 Kudos
9 Replies

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue May 21 04:38:01 MST 2013
I prefer to keep ISR short and do the stuff in main. Therefore I would use a flag in ISR and check this flag in main loop to decide there...
0 Kudos

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tbelo on Tue May 21 04:29:26 MST 2013
So programm flow can be similar to that:

void WAKEUP_IRQHandler(void)
{
// Switch from WDT osc to normal main clock.
//Clear timer match register
//Clear sleep bit
//disable timer
//read Start logic status register (STARTSRP) and run the normal code
.
.
.
.
//re-enable deep-sleep
}


int main(void)
{
//enable deep-sleep
 
   while(1)
  {
   NVIC_ClearPendingIRQ(WAKEUPx_IRQn);
   NVIC_EnableIRQ(WAKEUPx_IRQn);
   __WFI();
  }
}
0 Kudos

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Tue May 21 03:48:37 MST 2013

Quote: tbelo
So the normal application code will be called from the WAKEUP_IRQHandler.
Is that OK ?



Yes, then you can detect the source of the start as described above.


Quote: tbelo
Also about monitoring deep-sleep mode do you think ordering an oscilloscope is mandatory?



I'm not sure what 'dfv' is and which distributors are available there, but even a simple 'cheap' DSO is very useful to find problems and understand what's happening.
0 Kudos

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tbelo on Tue May 21 03:37:25 MST 2013
Generally it is recomended that the IRQ handler function should be as small as possible and also that nested IRQ handlers must be avoided.

My application (and also many similar applications) require the device to be in deep-sleep mode for 24hours and wakeup doing some stuff that takes ~15 minutes. During normal operation application make use of other IRQ handlers.

So the normal application code will be called from the WAKEUP_IRQHandler.
Is that OK ?

Also about monitoring deep-sleep mode do you think ordering an oscilloscope is mandatory?

Thanks
Theodore
0 Kudos

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun Mar 03 14:22:15 MST 2013

Quote: tbelo
By the use of the  Start logic status register (STARTSRP) in the WakeUP_IRQ_Handler function  can I distinguish the source of the IRQ ?


Start logic status register 0 (STARTSRP0) is showing you which pin has started Start Logic :):)

UM10398:

Quote:

3.5.32 Start logic status register 0
This register reflects the status of the enabled start signal bits. The bit assignment is
identical to Table 36. Each bit (if enabled) reflects the state of the start logic, i.e. whether or not a[COLOR=Red] wake-up signal has been received for a given pin[/COLOR].

0 Kudos

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tbelo on Sun Mar 03 13:56:09 MST 2013
By the use of the  Start logic status register (STARTSRP) in the WakeUP_IRQ_Handler function  can I distinguish the source of the IRQ ?
0 Kudos

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun Mar 03 08:24:25 MST 2013

Quote: tbelo
Is there any solution on that ?


:confused:

Just use Start Logic as shown in sample ;)
0 Kudos

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tbelo on Sun Mar 03 08:13:22 MST 2013
Is there any solution on that ?
0 Kudos

344 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sun Mar 03 05:56:01 MST 2013
No, 'Start Logic' is using several interrupt sources to trigger one interrupt handler ;)

UM10398:

Quote:

3.10.2 Start logic
....
The port pins PIO0_0 to PIO0_11 and PIO1_0 are connected to the start logic and serve as wake-up pins. The user must program the start logic registers for each input to set the appropriate edge polarity for the corresponding wake-up event. Furthermore, the interrupts corresponding to each input must be enabled in the NVIC.

0 Kudos