2024-02-16 09:19 PM
Hello,
I am having some problems with Timer3 Channel3 Initialization
The target device will be an STM32L496RET6
I'm trying to Initialization TIM3_CH3, STM32L496xx LQFP64 package Port-PB0 Pin26 of controller as a Counter
The timers I am using is
- TIM3_CH3 can't access CLOCKSOURCE for this channel3 (This is the problem)
After giving external frequency phyiscally connected to Port-PB0, I am able to get the frequency output on Port-PB0 Pin26 (seen on Oscilloscope)
The problem is when I try to use TIM3_CH3 as counter. In this case can't access to TI3(ie.TIM_CLOCKSOURCE_TI3) and TI3FP3.
All of the ST examples use CH1 & CH2 of their respective timer, but do not make any mention of trying to do on CH3
When I use the ST Example code and switch it to CH3, firstly I cannot use this TI2FP2 or TI1FP1 for Channel3.
Using Software debug when I try to measure Frequency I am not getting any data. Can anyone see what I'm doing wrong here, or have any good links or information to using CH3 of timer3?
This is my TIM3_CH3 initialization
void Fn_Cnt3_Init(void)
{
Counter3.Instance = TIM3; // TIMx;
Counter3.Init.Period = 0xFFFF;
Counter3.Init.Prescaler = 0; //80;
Counter3.Init.ClockDivision = 0;
Counter3.Init.CounterMode = TIM_COUNTERMODE_UP;
Counter3.Init.RepetitionCounter = 0;
HAL_TIM_IC_Init(&Counter3); // if(HAL_TIM_IC_Init(&Counter2) != HAL_OK)
{
/* Initialization Error */
// Error_Handler();
}
C3ClockConfig.ClockFilter = 0;
C3ClockConfig.ClockPolarity = TIM_CLOCKPOLARITY_RISING;
C3ClockConfig.ClockPrescaler = TIM_CLOCKPRESCALER_DIV1;
C3ClockConfig.ClockSource = TIM_CLOCKSOURCE_TI1;
HAL_TIM_ConfigClockSource(&Counter3, &C3ClockConfig);
TIM3->CR1 |= TIM_CR1_ARPE;
TIM3->CR1 = 1;
HAL_TIM_Base_Start_IT(&Counter3);
// TIM2->CR1 |= TIM_CR1_CEN;
}
2024-02-17 01:30 AM
> In this case can't access to TI3(ie.TIM_CLOCKSOURCE_TI3) and TI3FP3.
CH3 (and CH4) can't be used as input to the Slave-mode controller, thus be clock source for external-clock mode.
Not all timer channels have all the features.
You have to use a different timer channel, and so a different pin (note, that TIMx_CHxN which are on PB0 are not usable as inputs).
JW