ICU and timer channel?
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: ICU and timer channel?
I must have missed that part, so no channels 3 and 4 it seems...
About the optimization you proposed, I am all for optimizations so give it a try, but look at code size, often you optimize something and the result is not what you expected.
Giovanni
About the optimization you proposed, I am all for optimizations so give it a try, but look at code size, often you optimize something and the result is not what you expected.
Giovanni
Re: ICU and timer channel?
I know what you mean! 
Here goes a patch attached with the proposed modifications. In retrospect I would say that it doesn't look that much better! If we had 4 channels and four nested if's than it would really look a lot better.
Anyway, I already tested this modifications and everything works but the patch is entirely optional so you can apply if it suits your tastes!
Regarding that comment from the reference manual cited before, it only exists on the RM0080 (STM32F1xx). The RM0090 (STM32F4xx) doesn't have it, although it clearly supports only TI1FP1 and TI2FP2 as triggers too.
Here goes a patch attached with the proposed modifications. In retrospect I would say that it doesn't look that much better! If we had 4 channels and four nested if's than it would really look a lot better.
Anyway, I already tested this modifications and everything works but the patch is entirely optional so you can apply if it suits your tastes!
Regarding that comment from the reference manual cited before, it only exists on the RM0080 (STM32F1xx). The RM0090 (STM32F4xx) doesn't have it, although it clearly supports only TI1FP1 and TI2FP2 as triggers too.
- Attachments
-
- icu_add_masks_to_driver.patch.gz
- (892 Bytes) Downloaded 475 times
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: ICU and timer channel?
The patch looks good but if it does not give a definite advantage better do not integrate it because it uses more RAM and RAM is more valuable than Flash usually.
Giovanni
Giovanni
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: ICU and timer channel?
It measures periods already, are you suggesting a different mode?
Giovanni
Giovanni
Re: ICU and timer channel?
My understanding is that its purpose is to support the PWM input mode, therefor the channels 3 and 4 cannot be supported due to hardware limitations on the stm32.
Basically I want to use it to measure frequencies on all 4 channels, I don't care about the pulse width.
Basically I want to use it to measure frequencies on all 4 channels, I don't care about the pulse width.
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: ICU and timer channel?
A frequency counter would only be possible using two timers, one counter and another to generate the time base unless I am missing something.
It would be possible to use the four comparators to make four period measurements using a single timer but it would a very different driver from the current ICU which is meant for PWM. It would have to be an entirely different driver, you may consider a custom driver, much of the code could be derived from the ICU one.
Giovanni
It would be possible to use the four comparators to make four period measurements using a single timer but it would a very different driver from the current ICU which is meant for PWM. It would have to be an entirely different driver, you may consider a custom driver, much of the code could be derived from the ICU one.
Giovanni
Re: ICU and timer channel?
Any chance on using the quadrature encoder function through the ICU driver?
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: ICU and timer channel?
Hi,
The ICU driver is meant for PWM input, other uses would require another driver model or custom code using a time at register level.
Giovanni
The ICU driver is meant for PWM input, other uses would require another driver model or custom code using a time at register level.
Giovanni