wakeup from tilt sensor filter

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

wakeup from tilt sensor filter

308 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tbelo on Mon Jul 14 04:24:39 MST 2014
Hi,

In my scenario I have 2 sources to wakeup from deep-sleep: a timer and a tilt sensor.
Everything works fine unless the noise from the tilt sensor that causes the system to wakeup too easy.
Can I add a timer and a counter to the WAKEUP_IRQHandler only for the tilt sensor pin to reduce noise ?

Following is my WAKEUP_IRQHandler code (wakeFromAlarmFlag is a volatile used for alarm purposes) :

void WAKEUP_IRQHandler(void){
/*CLEAR sleepdeep bit */
SCB->SCR&=~(1<<2);

/* Clear the match output register value */
LPC_TMR16B0->EMR  &= ~(1<<0);

/* Disable and Reset Timer */
LPC_TMR16B0->TCR = (1<<1);

uint32_t regVal;
regVal = LPC_SYSCON->STARTSRP0;
  if ((regVal & (1 << 8)) != 0){
  LPC_SYSCON->STARTRSRP0CLR|=(1<<(8)); //1 = Writing 1 resets the start signal. MISO TIMER16
  LPC_SYSCON->STARTRSRP0CLR|=(1<<(12)); //rst the tilt start signal in case it is buffered from previous alrms

  if (wakeFromAlarmFlag>0 && wakeFromAlarmFlag<ALARMNOTIFIRIER)
  wakeFromAlarmFlag++;
  else wakeFromAlarmFlag=0;

  }
  else {
  LPC_SYSCON->STARTRSRP0CLR|=(1<<(12)); //AD1 TILT
  wakeFromAlarmFlag++;
  }

  NVIC_DisableIRQ(WAKEUP8_IRQn);
  NVIC_DisableIRQ(WAKEUP12_IRQn);
  NVIC_ClearPendingIRQ(WAKEUP12_IRQn);
  NVIC_ClearPendingIRQ(WAKEUP8_IRQn);

return;
}
Labels (1)
0 Kudos
2 Replies

289 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by tbelo on Sat Jul 19 11:02:41 MST 2014
The case is exactly as you mention.
Both possibilities are explained with schematics at sensolute.com.

0 Kudos

289 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 1234567890 on Thu Jul 17 09:02:06 MST 2014
Well, first of all: Your ISR is called after waking up; the device has already left sleep mode at this time. The ISR is the result of the interrupt.

There are 2 possibilities:

1.) After waking up you can monitor your pin and decide with software, if it is real or fake. Keyword 'debounce routine'. That's not so good, especially if you have a battery powered application (current consumption, the time in sleep mode can be much shorter).

2.) Debounce your pin with external hardware (e.g. R and C) to filter the noise.
0 Kudos