Count edge with TIM14 channel 1 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 1:18 AM
I use counting on TIM15 and now need change to 14 , but seems here external pulses counting dont work. FYI STM32F030
Is any setup for 14 possible?
Solved! Go to Solution.
- Labels:
-
STM32F0 Series
-
TIM
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 1:57 AM
TIM14 does not have the "slave-mode controller" i.e. there's no external clock possible, it's a very much stripped down basic timer.
Can't you use something else? Which 'F030 (different packages are different chips)? Which pin?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 1:20 AM
Hey MM,
Can you give us some more information? Are you trying to increment a counter based on an external pulse? What chip are you using?
Kind regards,
moatjon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 1:35 AM
External pulses is high speed need hw counting., this works for me on TIM15
RCC_APB2PeriphClockCmd(RCC_APB2Periph_TIM15,ENABLE);
TIM_Initstruct.TIM_Channel = TIM_Channel_2;
TIM_Initstruct.TIM_ICPolarity = TIM_ICPolarity_BothEdge;
TIM_Initstruct.TIM_ICSelection = TIM_ICSelection_DirectTI;
TIM_Initstruct.TIM_ICPrescaler = TIM_ICPSC_DIV1;
TIM_Initstruct.TIM_ICFilter = 0x00;
TIM_ICInit(TIM15,&TIM_Initstruct);
TIM_TIxExternalClockConfig(TIM15,TIM_TIxExternalCLK1Source_TI2,TIM_ICPolarity_BothEdge,0);
TIM_Cmd(TIM15,ENABLE);
TIM_SetCounter(TIM15,1); //workaround
lastTIM15=TIM_GetCapture2(TIM15);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 1:44 AM
Are you using CubeIDE / CubeMX to generate your code? If so, can you share the .ioc file or show the TIM15 configuration? Is TIM14 channel 1 connected to the relevant pin?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 1:49 AM
??? no no yes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 1:57 AM
TIM14 does not have the "slave-mode controller" i.e. there's no external clock possible, it's a very much stripped down basic timer.
Can't you use something else? Which 'F030 (different packages are different chips)? Which pin?
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 1:57 AM
You have to give some more information. What setup have you tried for TIM14? Does it not work if you replace the TIM15 instances with TIM14? When you say "external pulses counting dont work" does that mean that the counter stays at 0?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 2:03 AM
Yes i see reference TIM14 is ... , and yes if dont exist way i rearange PCB , but first ask is any possible solution to count pulses on PA4 pin.
I try count in exti but pulses is lost sometimes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 2:38 AM
I don't see any possible trick for PA4, sorry.
Maybe there's some room for improvement for the EXTI (aggressive rewrite in asm, maybe using registers snatched from the compiler if using gcc).
The timer input capture interrupt may provide the same service as EXTI. If your usage case allows it, you could use the input capture prescaler to reduce the interrupt rate thus possibly eliminate interrupt loss, at the cost of count granularity.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2021-12-07 2:49 AM
Thanks Jan,
any interrupt seems here is slow because is delayed with other or systicks .
Maybe i can change source signal to wide coded, then TIM14 can measure width by CC hw, have you any example howto setup TIM14 input capture to measure one pulse width , optimaly one edge reset TIM and second store CC1
