AnsweredAssumed Answered

How to reset FlexIO Timer on Pin rising edge?

Question asked by Stefan Mitterhauser on Jan 21, 2020
Latest reply on Feb 13, 2020 by Felipe García


I have two FlexIO timer running on RT1020. FlexIO timer 0 toggles the output every 0.5 seconds and timer 1 is triggered by timer 0. This setup works fine. Now I have to reset timer 0 on a rising edge of an Chip IO. I am using FlexIO PIN 6 (GPIO_AD_B1_09 so it is available at the Arduino Header). I can see the correct level of FlexIO PIN 6 in the FLEXIO1->PIN register but the reset does not work.

My configuration is:

static void flexio_sysbus_timer_init(FLEXIO_Type* base, uint32_t freq_Hz)
    flexio_timer_config_t fxioTimer0Config, fxioTimer1Config;
    flexio_config_t fxioUserConfig;
    uint32_t timer0Mask;
    uint32_t timer1Mask;
    timer0Mask = 1 << 0;
    timer1Mask = 1 << 1;

    /* FlexIO clocks are set by the clocks tool in clock_config.c */
    /* Configure FlexIO module */
    FLEXIO_Init(base, &fxioUserConfig);
    /* Configure FlexIO timer 0 */
    fxioTimer0Config.triggerSelect   = FLEXIO_TIMER_TRIGGER_SEL_PININPUT(6);
    fxioTimer0Config.triggerSource   = kFLEXIO_TimerTriggerSourceInternal;
    fxioTimer0Config.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow;
    fxioTimer0Config.pinConfig       = kFLEXIO_PinConfigOutputDisabled;
    fxioTimer0Config.pinPolarity     = kFLEXIO_PinActiveLow;
    fxioTimer0Config.pinSelect       = 6;
    fxioTimer0Config.timerMode       = kFLEXIO_TimerModeSingle16Bit ;
    fxioTimer0Config.timerOutput     = kFLEXIO_TimerOutputZeroNotAffectedByReset;
    fxioTimer0Config.timerDecrement  = kFLEXIO_TimerDecSrcOnFlexIOClockShiftTimerOutput;
    fxioTimer0Config.timerDisable    = kFLEXIO_TimerDisableNever;
    fxioTimer0Config.timerEnable     = kFLEXIO_TimerEnabledAlways;
    fxioTimer0Config.timerReset      = kFLEXIO_TimerResetOnTimerPinRisingEdge;
    fxioTimer0Config.timerStart      = kFLEXIO_TimerStartBitDisabled;
    fxioTimer0Config.timerStop       = kFLEXIO_TimerStopBitDisabled;
    fxioTimer0Config.timerCompare    = freq_Hz/2; // 0.5 s
    /* Configure FlexIO timer 1 */
    fxioTimer1Config.triggerSelect   = FLEXIO_TIMER_TRIGGER_SEL_TIMn(0U);
    fxioTimer1Config.triggerSource   = kFLEXIO_TimerTriggerSourceInternal;
    fxioTimer1Config.triggerPolarity = kFLEXIO_TimerTriggerPolarityActiveLow;
    fxioTimer1Config.pinConfig       = kFLEXIO_PinConfigOutput;
    fxioTimer1Config.pinPolarity     = kFLEXIO_PinActiveHigh;
    fxioTimer1Config.pinSelect       = 5;
    fxioTimer1Config.timerMode       = kFLEXIO_TimerModeSingle16Bit;
    fxioTimer1Config.timerOutput     = kFLEXIO_TimerOutputOneNotAffectedByReset;
    fxioTimer1Config.timerDecrement  = kFLEXIO_TimerDecSrcOnTriggerInputShiftTimerOutput;
    fxioTimer1Config.timerDisable    = kFLEXIO_TimerDisableNever;
    fxioTimer1Config.timerEnable     = kFLEXIO_TimerEnabledAlways;
    fxioTimer1Config.timerReset      = kFLEXIO_TimerResetNever;
    fxioTimer1Config.timerStart      = kFLEXIO_TimerStartBitDisabled;
    fxioTimer1Config.timerStop       = kFLEXIO_TimerStopBitDisabled;
    fxioTimer1Config.timerCompare    = 3;

    // Set configurations
    FLEXIO_SetTimerConfig(base, 0, &fxioTimer0Config);
    FLEXIO_SetTimerConfig(base, 1, &fxioTimer1Config);
    // Enable FlexIO Timer 1 interrupt
    FLEXIO_ClearTimerStatusFlags(base, (timer0Mask | timer1Mask));
    FLEXIO_EnableTimerStatusInterrupts(base, timer1Mask);      

The pin_mux.c settings for the two timer pins are:

      IOMUXC_GPIO_AD_B1_09_FLEXIO1_FLEXIO06,  /* GPIO_AD_B1_09 is configured as FLEXIO1_FLEXIO06 */
      0U);                                    /* Software Input On Field: Input Path is determined by functionality */
      IOMUXC_GPIO_AD_B1_10_FLEXIO1_FLEXIO05,  /* GPIO_AD_B1_10 is configured as FLEXIO1_FLEXIO05 */
      0U);                                    /* Software Input On Field: Input Path is determined by functionality */

      IOMUXC_GPIO_AD_B1_09_FLEXIO1_FLEXIO06,  /* GPIO_AD_B1_09 PAD functional properties : */
      0x70B0U);                               /* Slew Rate Field: Slow Slew Rate
                                                 Drive Strength Field: R0/6
                                                 Speed Field: medium(100MHz)
                                                 Open Drain Enable Field: Open Drain Disabled
                                                 Pull / Keep Enable Field: Pull/Keeper Enabled
                                                 Pull / Keep Select Field: Pull
                                                 Pull Up / Down Config. Field: 47K Ohm Pull Up
                                                 Hyst. Enable Field: Hysteresis Disabled */

I also tried to change the settings to external trigger 0 with XBAR and the same Chip IO Pin but I get the same result. The timer is not reset when I pull FlexIO Pin 06 to GND and release it.


Any suggestions what I am configuring wrong? I attached the project to this post. I'm using the debug configuration.

Kind regards,