Ok thanks. One more thing. We are still having trouble with just a delay timer outputting a pin and then disabling and triggering the next timer. For example, I have the code below which does in fact trigger the timers in order but the delay times are not correct and I think that is related to the "kFLEXIO_TimerDisableOnTimerCompareTriggerLow" and the "kFLEXIO_TimerEnableOnTriggerBothEdge" settings but without these then the next timer in the chain is not triggered. I can see and measure this on a oscilloscope.
The simplest thing to have a timer output on a pin for a period of time and then disable and trigger the next timer is something that seems should be simple but I cannot get to work correctly. Some guidance on just this simple requirement would be very useful. None of the samples have anything like this. Unfortunately the device that we are trying to communicate with is a one-wire device and the timings required are not regular (ie. output high for 100 usec, and repeat "output low for 1 usec, output high for 1 usec, change to input and wait 5 usec, read 1 bit" for 28 bits total and then repeat the whole thing.
static void flexio_timer0_config(void) {
flexio_timer_config_t fxioTimerConfig;
fxioTimerConfig.triggerSelect = FLEXIO_TIMER_TRIGGER_SEL_TIMn(DEMO_FLEXIO_TIMER2_CH);
fxioTimerConfig.triggerSource = kFLEXIO_TimerTriggerSourceInternal;
fxioTimerConfig.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow;
fxioTimerConfig.pinConfig = kFLEXIO_PinConfigOutput;
fxioTimerConfig.pinPolarity = kFLEXIO_PinActiveHigh;
fxioTimerConfig.pinSelect = DEMO_FLEXIO_OUTPUTPIN1;
fxioTimerConfig.timerMode = kFLEXIO_TimerModeDisabled;
fxioTimerConfig.timerOutput = kFLEXIO_TimerOutputOneNotAffectedByReset;
fxioTimerConfig.timerDecrement = kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput;
fxioTimerConfig.timerDisable = kFLEXIO_TimerDisableOnTimerCompareTriggerLow ;
fxioTimerConfig.timerEnable = kFLEXIO_TimerEnabledAlways;
fxioTimerConfig.timerReset = kFLEXIO_TimerResetNever;
fxioTimerConfig.timerStart = kFLEXIO_TimerStartBitDisabled;
fxioTimerConfig.timerStop = kFLEXIO_TimerStopBitDisabled;
fxioTimerConfig.timerCompare = 15000;
FLEXIO_SetTimerConfig(DEMO_FLEXIO_BASEADDR, DEMO_FLEXIO_TIMER0_CH, &fxioTimerConfig);
}
static void flexio_timer1_config(void) {
flexio_timer_config_t fxioTimerConfig;
fxioTimerConfig.triggerSelect = FLEXIO_TIMER_TRIGGER_SEL_TIMn(DEMO_FLEXIO_TIMER0_CH);
fxioTimerConfig.triggerSource = kFLEXIO_TimerTriggerSourceInternal;
fxioTimerConfig.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow;
fxioTimerConfig.pinConfig = kFLEXIO_PinConfigOutput;
fxioTimerConfig.pinPolarity = kFLEXIO_PinActiveHigh;
fxioTimerConfig.pinSelect = DEMO_FLEXIO_OUTPUTPIN2;
fxioTimerConfig.timerMode = kFLEXIO_TimerModeDisabled;
fxioTimerConfig.timerOutput = kFLEXIO_TimerOutputOneNotAffectedByReset;
fxioTimerConfig.timerDecrement = kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput;
fxioTimerConfig.timerDisable = kFLEXIO_TimerDisableOnTimerCompareTriggerLow ;
fxioTimerConfig.timerEnable = kFLEXIO_TimerEnableOnTriggerBothEdge;
fxioTimerConfig.timerReset = kFLEXIO_TimerResetNever;
fxioTimerConfig.timerStart = kFLEXIO_TimerStartBitDisabled;
fxioTimerConfig.timerStop = kFLEXIO_TimerStopBitDisabled;
fxioTimerConfig.timerCompare = 750;
FLEXIO_SetTimerConfig(DEMO_FLEXIO_BASEADDR, DEMO_FLEXIO_TIMER1_CH, &fxioTimerConfig);
}
static void flexio_timer2_config(void) {
flexio_timer_config_t fxioTimerConfig;
fxioTimerConfig.triggerSelect = FLEXIO_TIMER_TRIGGER_SEL_TIMn(DEMO_FLEXIO_TIMER1_CH);
fxioTimerConfig.triggerSource = kFLEXIO_TimerTriggerSourceInternal;
fxioTimerConfig.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow;
fxioTimerConfig.pinConfig = kFLEXIO_PinConfigOutput;
fxioTimerConfig.pinPolarity = kFLEXIO_PinActiveHigh;
fxioTimerConfig.pinSelect = DEMO_FLEXIO_OUTPUTPIN3;
fxioTimerConfig.timerMode = kFLEXIO_TimerModeDisabled;
fxioTimerConfig.timerOutput = kFLEXIO_TimerOutputOneNotAffectedByReset;
fxioTimerConfig.timerDecrement = kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput;
fxioTimerConfig.timerDisable = kFLEXIO_TimerDisableOnTimerCompareTriggerLow;
fxioTimerConfig.timerEnable = kFLEXIO_TimerEnableOnTriggerBothEdge;
fxioTimerConfig.timerReset = kFLEXIO_TimerResetNever;
fxioTimerConfig.timerStart = kFLEXIO_TimerStartBitDisabled;
fxioTimerConfig.timerStop = kFLEXIO_TimerStopBitDisabled;
fxioTimerConfig.timerCompare = 960;
FLEXIO_SetTimerConfig(DEMO_FLEXIO_BASEADDR, DEMO_FLEXIO_TIMER2_CH, &fxioTimerConfig);
}
static void flexio_timer0_start(void)
{
/* Set Timer mode to kFLEXIO_TimerModeDual8BitPWM to start timer */
DEMO_FLEXIO_BASEADDR->TIMCTL[DEMO_FLEXIO_TIMER0_CH] |= FLEXIO_TIMCTL_TIMOD(kFLEXIO_TimerModeSingle16Bit);
}
static void flexio_timer1_start(void)
{
/* Set Timer mode to kFLEXIO_TimerModeDual8BitPWM to start timer */
DEMO_FLEXIO_BASEADDR->TIMCTL[DEMO_FLEXIO_TIMER1_CH] |= FLEXIO_TIMCTL_TIMOD(kFLEXIO_TimerModeSingle16Bit);
}
static void flexio_timer2_start(void)
{
/* Set Timer mode to kFLEXIO_TimerModeDual8BitPWM to start timer */
DEMO_FLEXIO_BASEADDR->TIMCTL[DEMO_FLEXIO_TIMER2_CH] |= FLEXIO_TIMCTL_TIMOD(kFLEXIO_TimerModeSingle16Bit);
}
...
flexio_timer0_config();
flexio_timer1_config();
flexio_timer2_config();
flexio_timer2_start();
flexio_timer1_start();
flexio_timer0_start();
while (1)
{
__NOP();
}