Tool/software: TI C/C++ Compiler
Good Day To All,
Just need your input/s regarding my issue here.
I initialize Timer 1 channel 3 (P0_7) in input capture mode like below:
PERCFG |= BV(6); //timer 1 alternative 2 config
P2DIR = (P2DIR & ~0xC0) | 0x80); // give priority to timer 1
P0SEL |= BV(7);//set port 0 pin 7 as peripheral
P0DIR |= BV(6);//set P0_6 as output and synch with P0_7 input interrupt...
T1CCTL3 |= BV(6); //enable interrupt at timer 1 channel 3
T1CCTL3 |= BV(1) | BV(0); //capture on all edges..
P0IEN |= BV(7); //enable interrupt at P0_7.. i am not sure if this is redundant declaration..
T1IE = 1; //enable interrupt at timer 1
Then at "hal_key.c", I editted the ISR function for PORT 0 as below:
HAL_ISR_FUNCTION(halKeyPort0Isr, T1_VECTOR)
{
HAL_ENTER_ISR();
if (P0IFG |= BV(7))
{
if(P0_6 == 1){P0_6 = 0;}else{P0_6 = 1;} //test code...toggle pin output, should synch with P0_7 external signal...
}
P0IFG = 0; //reset flag
HAL_KEY_CPU_PORT_0_IF = 0; //reset P0IF
CLEAR_SLEEP_MODE();
HAL_EXIT_ISR();
return;
}
I use oscilloscope to check the PWM produced in the external input for P0_7 then compare with P0_6 output pulses.
I assumed that the P0_6 should be in synch with P0_7 but there are unwanted steady HIGH/LOW signals in between.
This can't be good for my application since i am going to get the period and duty cycle (at T1CC3L:T1CC3H) of the external input by the use of interrupt.....or no need? just read the registers directly in a periodic approach?
Kindly provide some insights with my situation here.
I used "simpleBLEperipheral" sample as base project.
Thanks.