This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C1294NCPDT: timer1 input capture,cannot run into the interrupt

Part Number: TM4C1294NCPDT

this is my code:

void Timer1_Capture_Config(void){
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1); //使能TIMER0 32位(TIMER0A16位+TIMER0B16位)
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlDelay(200);
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_3);
GPIOPinConfigure(GPIO_PA3_T1CCP1); //#define GPIO_PC4_WT0CCP0 0x00021007
GPIOPinTypeTimer(GPIO_PORTA_BASE, GPIO_PIN_3);
TimerConfigure(TIMER1_BASE,TIMER_CFG_B_CAP_TIME_UP|TIMER_CFG_SPLIT_PAIR);
TimerControlEvent(TIMER1_BASE,TIMER_B,TIMER_EVENT_POS_EDGE);
TimerEnable(TIMER1_BASE, TIMER_B);
TimerPrescaleSet(TIMER0_BASE, TIMER_B, 24);
ROM_TimerLoadSet(TIMER0_BASE, TIMER_B, 624);

IntEnable(INT_TIMER1B);
TimerIntEnable(TIMER1_BASE, TIMER_CAPB_EVENT);
IntMasterEnable();
//master interrupt enable API for all interrupts

}

i cannot enter my interrupt

  • Hi,
    Which timer do you want to use?

    In your code you have the below two lines that setup the TIMER0 instead of TIMER1. Please change to TIMER1_BASE if you want to use TIMER1.
    TimerPrescaleSet(TIMER0_BASE, TIMER_B, 24);
    ROM_TimerLoadSet(TIMER0_BASE, TIMER_B, 624);

    Also the line GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_3) should be removed.
  • Vendor's Charles excellently identified your code 'irregularities.'

    However - as you've noted, 'Failure to enter the (assumed) Timer1 Interrupt' - should you 'NOT' have provided (some/slight) mention (ideally a code listing) of that 'Yet to be entered' Timer1 Interrupt?

    In addition - that Timer1 Interrupt must appear properly w/in the 'Start-Up file' (while 'name matching' (w/in Start-Up and your other code)  - or be 'Registered' - to insure that it is recognized.    (Recognition precedes Entry!)

  • thanks for your advice
    i fell sorry that i paste the wrong code here.
    according to your advice , i rectify my code, as follow:
    void Timer1_Capture_Config(void){
    SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);

    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlDelay(200);
    GPIOPinConfigure(GPIO_PA3_T1CCP1);
    GPIOPinTypeTimer(GPIO_PORTA_BASE, GPIO_PIN_3);
    TimerConfigure(TIMER1_BASE,TIMER_CFG_B_CAP_TIME_UP|TIMER_CFG_SPLIT_PAIR);
    TimerControlEvent(TIMER1_BASE,TIMER_B,TIMER_EVENT_POS_EDGE);
    ROM_TimerLoadSet(TIMER1_BASE, TIMER_B, 32768);
    IntEnable(INT_TIMER1B);
    TimerIntEnable(TIMER1_BASE, TIMER_CAPB_EVENT);
    IntMasterEnable();
    TimerEnable(TIMER1_BASE, TIMER_B);

    }


    and Timer1 Interrupt appear properly write the 'Start-Up file' , but i still cant run into my interrupt.
    is any other problem in my Config?
  • thanks for your advice!
    the 1kHz square wave are provided for the PA3, and for testing the TIMER1 , i just configure the timer1 in the main function. and my 'Start-Up file' is right. i suppose that mt config is wrong.
  • thanks for your advice
    the problem is that the signal VPP is too small, so the tm4c1294 cant capture it.