MC9S08DZ60 TPMxCnSC unexpected interrupts

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

MC9S08DZ60 TPMxCnSC unexpected interrupts

1,073 Views
DaveH
Contributor I
I set the TPMxCnSC register to send an interrupt for both rising and falling edges for my hall sensor inputs.  Problem is that I am getting interrupts when the motor is not moving (i.e., hall sensors are not changing).  I initialize TPM1C0SC = 0x4C (CH0IE, ELS0B, ELS0A are set).  My interrupt routine looks like this (I have a second routine for the other hall sensor).
 

@interrupt void tpm1_ch1_intr( void ) /* hall2 */
{
TPM1C1SC;
TPM1C1SC
= 0x4C;

timeStampHS1
= TPM1C1V;
Icu_TimestampNotifyHallSensor_1();
}

Now here is some more important information.  I only get the unexpected interrupts when the hall sensor is high.  Also, during other processing in the temporal loop, the interrupts are disabled, some processing is done, then the interrupts are enabled again, with the following functions.

void disable_hall_effects( void )
{
INTERRUPTS_OFF();

TPM1C0SC;
TPM1C0SC
= 0; /* timer 1 chan 0 status/ctrl */ /*Input capture for Hall effects*/

TPM1C1SC;
TPM1C1SC
= 0; /* timer 1 chan 1 status/ctrl */ /*Input capture for Hall effects*/

INTERRUPTS_ON();
}

void

enable_hall_effects( void )
{
INTERRUPTS_OFF();

TPM1C0SC;
TPM1C0SC
=
0x4C; /* timer 1 chan 0 status/ctrl */ /*Input capture for Hall effects*/

TPM1C1SC;
TPM1C1SC
= 0x4C; /* timer 1 chan 1 status/ctrl */ /*Input capture for Hall effects*/

TPM1SC;
TPM1SC = (T1_PRESCALE | T1_BUS_CLOCK); /* timer 1 status/ctrl register Turn the timer on*/

INTERRUPTS_ON();

}

So I am wondering if the disable/enable actions are causing an interrupt to be sent.  Any other ideas?  Thanks!

Dave

 

Labels (1)
0 Kudos
1 Reply

200 Views
donw
Contributor IV
I cant help with the software, but perhaps the first step is check the hardware:
- isolate the input's hardware (tie the input high)
to check for glitches on the input signal. Most interrupt inputs will capture even very fast
glitches.
- Maybe more bypassing on the supply line also?

0 Kudos