Hi all,
for my project with STM32F105 chip I needed input capture to measure CPPM stream from radio on channel 3 of one of the general purpose timers.
ICU driver is meant to measure duty cycle and period of PWM signal, and according to the datasheet only first two channels can be used for this (look for Filtered Timer Input 1/2). However, I wanted to reuse the ICU code and just allow it to have the third channel.
Here is the code. Just channel 3 for now, channel 4 would be very similar.
I think it is a question mainly for Giovanni - is it ok to have the driver with different functionality for different channels? I.e. PWM measure (CH1 and CH2) vs input capture only (CH3 and CH4)?
STM32 Time capture with channel 3
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: STM32 Time capture with channel 3
Hi,
The driver model supports PWM-input only, the use of the other comparators could be eventually added as an STM32-specific extension into the low level driver.
In the general architecture such extensions have to be marker using the plarform name, for example you may add a function icuSTM32SetComparator().
Giovanni
The driver model supports PWM-input only, the use of the other comparators could be eventually added as an STM32-specific extension into the low level driver.
In the general architecture such extensions have to be marker using the plarform name, for example you may add a function icuSTM32SetComparator().
Giovanni
Re: STM32 Time capture with channel 3
I ran into the same limitation, but had a more complicated set of requirements. I've implemented a TIMCAP driver that can handle captures for all 4 channels (or 2 channels for timers that only support 2 channels), and call respective callbacks when each of the respective channels does a capture. You can find the driver code and respective demonstration at the link below. I've tested this on an STM32F407.
https://github.com/dsigma/ChibiOS/tree/ ... CAP/timcap
Hope someone finds this helpful...
Best Regards,
-d
https://github.com/dsigma/ChibiOS/tree/ ... CAP/timcap
Hope someone finds this helpful...
Best Regards,
-d
Who is online
Users browsing this forum: No registered users and 2 guests