Hello all.
I have set up both timers on Timer0: Timer A triggering the ADC and Timer B as an output PWM signal of that conversion clock in order to get synchronized with other devices.
SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL); GPIOPinConfigure(GPIO_PL5_T0CCP1); GPIOPinTypeTimer(GPIO_PORTL_BASE, GPIO_PIN_5); TimerConfigure(TIMER0_BASE, TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PERIODIC_UP | TIMER_CFG_B_PWM); //For ADC TimerLoadSet(TIMER0_BASE, TIMER_A, (g_ui32SysClock / g_uiSamplingFreq) - 1); TimerLoadSet(TIMER0_BASE, TIMER_B, (g_ui32SysClock / g_uiSamplingFreq) - 1); TimerMatchSet(TIMER0_BASE, TIMER_B, g_ui32SysClock / (g_uiSamplingFreq * 2)); //50% duty cycle at init TimerControlTrigger(TIMER0_BASE, TIMER_A, true); //ADC trigger TimerEnable(TIMER0_BASE, TIMER_A | TIMER_B);
Everything works fine, but we have some interruptions pins, that we would like to synch with our sampling Timer counter (in specific the number of sample=Timer_pulse that interruption on GPIO occurs).
However when we try to read the Timer value with TimerValueGet(TIMER0_BASE,TIMER_B) we get a very different number from what we expect.
We have set a counter variable in the ADC_interrupt handler and we can count/time the interruption that way, but we think we should do it by reading the Timer directly and getting the number of pulse since the Timer was enabled last time.
Is there a way to do this?
Thank you