AnsweredAssumed Answered

TPM misbehaves in QD4

Question asked by Abhijit Jagtap on Mar 28, 2009
Latest reply on Apr 1, 2009 by bigmac



I am using QD4 for a Universal IR capture algorithm.


I am using TPM1CH1 (Pin 7,alternate function is PTAD1 as GPIO).This pin is used as an Interrupt driven


counter which will measure duration of incoming pulses between rising and falling edges (interrupts).


I am using a Timeout of 90msec after the first edge intr occurs.I also use some 70 bytes for this train


of pulses.So that after acquiring 70 bytes of info I fall out of that routine.


This works fine for a RC5/6 type of protocol which has a repeatabilty of ~100msec,but with some


others like SIRC,which has repeatable w/f in ~15msec,multiple packets of data are captured.


Here as an error correction mechanism,I will lookout for a TPMCNT>my threshold,after which I skip all 


the data ,so effectively only a single frame is put up for conditioning.


This is used in some Compare and Actions based on those Compares.


My Channel ISR is attached here



//TPM1 channel INTR Service Routine //-------------------------------------------------------------------------------------// //---------------------------------------------------------------------// TPM1channel 1 edge Interrupt//----------------------------------------------------------------------interrupt 6 void TPM1C1_ISR (void){       TPMC1SC;     TPMC1SC_CH1F=RESET;         if(i==70)       {                 TPMC1SC_CH1IE=RESET;          TPMCNT=0;          TPMSC=0x00;       }                  if(i>1)       {            TPM2SC=0x00;            //Stop Timer2 or Stop timeout timer            store[i].period[0]=TPMC1VH;            store[i].period[1]=TPMC1VL;             TPM2MOD=0x7000;         //Timeout of 86msec.            TPM2SC=0x4D;            //Restart Timer       }                                       TPMCNT=0;   i++;       }



interrupt 10 void Timer2_Overflow_INTR(void){               TPMC1SC_CH1IE=RESET;     TPMCNT=0;             if(common.LEARN==SET)     common.LEARN_DONE=SET;          else     common.ACTION_READY=SET;        common.TIME_OUT=SET;     TPM2SC;     TPM2SC_TOIE=RESET;       }



 My problem is that often it will recv the waveform correctly but some of times I cannot get the 


correct waveform..I am not sure if the algorithm I am using is correct.


Can someone help?..I can tell more..


Expecting help as usual..


Thanks and regards