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.
Tool/software:
I'm trying to use a timer as a pulse counter, code as follows:
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER4);
GPIOPinTypeTimer(GPIO_PORTD_BASE, 0x80);
GPIOPinConfigure(GPIO_PD7_T4CCP1);
TimerDisable(WTIMER4_BASE, TIMER_A); // Stop Counting
TimerConfigure(WTIMER4_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_COUNT_UP | TIMER_CFG_A_ACT_NONE);
TimerControlEvent(WTIMER4_BASE, TIMER_A, TIMER_EVENT_NEG_EDGE);
TimerLoadSet(WTIMER4_BASE, TIMER_A, 0);
TimerPrescaleSet(WTIMER4_BASE, TIMER_A, 0xFFFF);
TimerMatchSet(WTIMER4_BASE, TIMER_A, 0xFFFFFFF0);
TimerPrescaleMatchSet(WTIMER4_BASE, TIMER_A, 0xFFF0);
TIMER4_TAV_R = 0;
TimerEnable(WTIMER4_BASE, TIMER_A); // Start Counting
SysTickIntDisable();
TimerDisable(WTIMER4_BASE, TIMER_A); // Stop Counting
SysTickIntEnable();
When it gets to the second TimerDisable() it branches to FaultISR().
Help. Thanks
Hi Doug,
There are no WTIMER4 on TM4C129 MCU. As a matter of fact, there are no Wide Timers on TM4C129. Wide Timer is only available on TM4C123 MCU. You need to change from WTIMER4_BASE to TIMER4_BASE. Also note that if you want to use TIMER_A on TIMER4_BASE, the pin is on PM4, PB0 or PD6. PD7 is for T4CCP1 which is controlled by TIMER_B instead. Conversely, if you want to use PD7 for T4CCP1 then you need to change to TIMER_B in your code.
I think this solved the problem but now I'm getting a new fault so I can't tell for sure. Let's call this solved for now.
Thanks Charles.