MC9S08DZ60 TPMxCnSC unexpected interrupts

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MC9S08DZ60 TPMxCnSC unexpected interrupts

1,474件の閲覧回数
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

 

ラベル(1)
0 件の賞賛
返信
1 返信

601件の閲覧回数
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 件の賞賛
返信