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.

EK-TM4C123GXL: for counter

Part Number: EK-TM4C123GXL

i set up code for generating count in neg edge trig this is not working well can any help me?

// Set up counter time
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); // Enable the Tim qer0 peripheral
while(!SysCtlPeripheralReady(SYSCTL_PERIPH_TIMER0)) // Wait for the Timer0 module to be ready.
{ }
GPIOPinConfigure(GPIO_PB6_T0CCP0);
GPIOPinTypeTimer(GPIO_PORTB_BASE, GPIO_PIN_6);
TimerConfigure(TIMER0_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_CAP_COUNT_UP));
TimerLoadGet(TIMER0_BASE, TIMER_A);
TimerControlEvent(TIMER0_BASE, TIMER_A, TIMER_EVENT_NEG_EDGE);
TimerEnable(TIMER0_BASE, TIMER_A);
int counter;
counter= TimerValueGet(TIMER0_BASE,TIMER_A);

  • Hello Farhan,

    Because you are using PB6 for this, I have a suspicion here. Please see the following from our common TM4C issues thread:


    2) EK-TM4C123GXL Only: Issues with GPIO's PD0/PD1 or PB6/PB7

    Observed Issue: One or more of PD0, PD1, PB6, and/or PB7 are exhibited unexpected behavior.

    Solution: The EK-TM4C123GXL has a pair of zero ohm resistors populated which tie together: PD0 with PB6, and PD1 with PB7. These resistors are used only to support the Airmouse example that works in conjunction with the BOOSTXL-SENSHUB BoosterPack. They can be removed to allow the GPIO to operate independently as long as that example is not being currently used.


    Can you remove those resistors and try your example again and see if that resolves the issue?

    Best Regards,

    Ralph