QTMR of RT1064 counting external signal

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

QTMR of RT1064 counting external signal

ソリューションへジャンプ
1,320件の閲覧回数
Bosbessenbasje
Contributor I

I want to count an external signal and have the following code, but the external signal is not counted. When I change the clock source to the default, the timer is running just fine. But using the external signal to clock the counter does not. I must be missing something trivial here...

CLOCK_EnableClock(kCLOCK_Iomuxc);
CLOCK_EnableClock(kCLOCK_Xbar1);

IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B0_14_XBAR1_IN24, 0U); // J15-37
IOMUXC_GPR->GPR6 = ((IOMUXC_GPR->GPR6 & (~(IOMUXC_GPR_GPR6_QTIMER4_TRM0_INPUT_SEL_MASK))) | IOMUXC_GPR_GPR6_QTIMER4_TRM0_INPUT_SEL(0x01U));
XBARA_SetSignalsConnection(XBARA1, kXBARA1_InputIomuxXbarIn24, kXBARA1_OutputQtimer4Tmr0Input);

qtmr_config_t qtmrConfig;
QTMR_GetDefaultConfig(&qtmrConfig);
qtmrConfig.primarySource = kQTMR_ClockCounter0InputPin;

QTMR_Init(TMR4, kQTMR_Channel_0, &qtmrConfig);

QTMR_StartTimer(TMR4, kQTMR_Channel_0, kQTMR_PriSrcRiseEdge);

static volatile uint16 value;
while (true)
{
value = QTMR_GetCurrentTimerCount(TMR4, kQTMR_Channel_0);
}

 

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 解決策
1,314件の閲覧回数
Bosbessenbasje
Contributor I

I got it to work, it seems to be a problem with my demoboard on that pin, the following code works just as expected:

CLOCK_EnableClock(kCLOCK_Iomuxc);

IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_02_QTIMER3_TIMER2, 0U); // J15-30
IOMUXC_GPR->GPR6 = ((IOMUXC_GPR->GPR6 & (~(IOMUXC_GPR_GPR6_QTIMER3_TRM2_INPUT_SEL_MASK))) | IOMUXC_GPR_GPR6_QTIMER3_TRM2_INPUT_SEL(0x00U));

qtmr_config_t qtmrConfig;
QTMR_GetDefaultConfig(&qtmrConfig);
qtmrConfig.primarySource = kQTMR_ClockCounter2InputPin;

QTMR_Init(TMR3, kQTMR_Channel_2, &qtmrConfig);

QTMR_StartTimer(TMR3, kQTMR_Channel_2, kQTMR_PriSrcRiseEdge);

static volatile uint16 value;
while (true)
{
value = QTMR_GetCurrentTimerCount(TMR3, kQTMR_Channel_2);
}

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,315件の閲覧回数
Bosbessenbasje
Contributor I

I got it to work, it seems to be a problem with my demoboard on that pin, the following code works just as expected:

CLOCK_EnableClock(kCLOCK_Iomuxc);

IOMUXC_SetPinMux(IOMUXC_GPIO_AD_B1_02_QTIMER3_TIMER2, 0U); // J15-30
IOMUXC_GPR->GPR6 = ((IOMUXC_GPR->GPR6 & (~(IOMUXC_GPR_GPR6_QTIMER3_TRM2_INPUT_SEL_MASK))) | IOMUXC_GPR_GPR6_QTIMER3_TRM2_INPUT_SEL(0x00U));

qtmr_config_t qtmrConfig;
QTMR_GetDefaultConfig(&qtmrConfig);
qtmrConfig.primarySource = kQTMR_ClockCounter2InputPin;

QTMR_Init(TMR3, kQTMR_Channel_2, &qtmrConfig);

QTMR_StartTimer(TMR3, kQTMR_Channel_2, kQTMR_PriSrcRiseEdge);

static volatile uint16 value;
while (true)
{
value = QTMR_GetCurrentTimerCount(TMR3, kQTMR_Channel_2);
}

0 件の賞賛
返信