It is the driver invoking the callbacks internally. You don't have to call them, just put your code inside.
An useful article: http://en.wikipedia.org/wiki/Callback_% ... ramming%29
Giovanni
PWM Capture
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: PWM Capture
Thanks Giovanni. That was useful. Now I am able to capture PWM Input. Got little clarity about callback functions. Now I have following question
I have pins PA6, PA7, PB8, PB14, PC6 and PC7 are available for PWM Input capture.
PA6 TIM3_CH1 TIM13_CH1
PA7 TIM1_CH1N TIM3_CH2 TIM8_CH1N TIM14_CH1
PB8 TIM4_CH3 TIM10_CH1
PB14 TIM1_CH2N TIM8_CH2N TIM12_CH1
PC6 TIM3_CH1 TIM8_CH1
PC7 TIM3_CH2 TIM8_CH2
I am using PA10, PB0, PB1, PB5, PB11, PC8 for PWM outputs.
PA10 TIM1_CH3
PB0 TIM1_CH2N TIM3_CH3 TIM8_CH2N
PB1 TIM1_CH3N TIM3_CH4 TIM8_CH3N
PB5 TIM3_CH2
PB11 TIM2_CH4
PC8 TIM3_CH3 TIM8_CH3
Like PWM output where it is possible to generate different PWM on same timer having different channel, is it possible to do same for Input Capture?
How to do Input capture here? I want to capture only on time. Currenlty ICU captures two phenomena - pulse width and pulse frequency. I need only pulse width.
Sapan
I have pins PA6, PA7, PB8, PB14, PC6 and PC7 are available for PWM Input capture.
PA6 TIM3_CH1 TIM13_CH1
PA7 TIM1_CH1N TIM3_CH2 TIM8_CH1N TIM14_CH1
PB8 TIM4_CH3 TIM10_CH1
PB14 TIM1_CH2N TIM8_CH2N TIM12_CH1
PC6 TIM3_CH1 TIM8_CH1
PC7 TIM3_CH2 TIM8_CH2
I am using PA10, PB0, PB1, PB5, PB11, PC8 for PWM outputs.
PA10 TIM1_CH3
PB0 TIM1_CH2N TIM3_CH3 TIM8_CH2N
PB1 TIM1_CH3N TIM3_CH4 TIM8_CH3N
PB5 TIM3_CH2
PB11 TIM2_CH4
PC8 TIM3_CH3 TIM8_CH3
Like PWM output where it is possible to generate different PWM on same timer having different channel, is it possible to do same for Input Capture?
How to do Input capture here? I want to capture only on time. Currenlty ICU captures two phenomena - pulse width and pulse frequency. I need only pulse width.
Sapan
Re: PWM Capture
Sapan,
This forum is not a STM32 or C language helpdesk!
Your last questions have absolutely nothing to do with ChibiOS.
Pls go to STM32 general forum here:
https://my.st.com/public/STe2ecommuniti ... Items.aspx ,
ask such questions there, and don't waste precious Giovanni's time for such
not to the point questions...
This forum is not a STM32 or C language helpdesk!
Your last questions have absolutely nothing to do with ChibiOS.
Pls go to STM32 general forum here:
https://my.st.com/public/STe2ecommuniti ... Items.aspx ,
ask such questions there, and don't waste precious Giovanni's time for such
not to the point questions...
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: PWM Capture
Hi,
Capture is possible on input 1 or 2 of each timer, inputs can be mapped on various physical pins, the possible mappings are listed on the STM32 Data Sheet (not the Reference Manual).
Giovanni
Capture is possible on input 1 or 2 of each timer, inputs can be mapped on various physical pins, the possible mappings are listed on the STM32 Data Sheet (not the Reference Manual).
Giovanni
Re: PWM Capture
Thanks Giovanni. I am trying to STM32/icu_lld.c will let you know if I have any success. Thanks for help.
Re: PWM Capture
Hi,
Just one question. I am trying to modify ChibiOS driver for TIM12, 13 and 14. Would it be of too much effort or would I be able to do it through minor modifications?
Thanks
Sapan
Just one question. I am trying to modify ChibiOS driver for TIM12, 13 and 14. Would it be of too much effort or would I be able to do it through minor modifications?
Thanks
Sapan
- Giovanni
- Site Admin
- Posts: 14892
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: PWM Capture
Hi Giovanni,
I tweaked icu_lld.c to include TIM13 and 14 and like you said it was very easy. Got it working...although there are some issues in there but its generating interrupt. Need to do some more tweaks as well....working on that.....thanks a lot....
Sapan
I tweaked icu_lld.c to include TIM13 and 14 and like you said it was very easy. Got it working...although there are some issues in there but its generating interrupt. Need to do some more tweaks as well....working on that.....thanks a lot....
Sapan
Re: PWM Capture
Hi Giovanni,
Finally I was able to capture input on all 6 pins (PA6, PA7, PC6, PC7, PB14 and PB15). Also I am able to generate six pwm output as well (PA10, PB0, PB1, PB5, PB11 and PC8). I have modified icu_lld.c and icu_lld.h (os\hal\STM32) to include TIM12, 13 and 14. Also have changed configuration registers such that it generates interrupt both on rising edge and falling edge. I have tested the code and so far it seems to work fine. Need to do more testing. Attaching these two files. Like you said modification was eary...
.... Can you have a look and see if I have missed anything ?.
Thanks again..
Sapan
Finally I was able to capture input on all 6 pins (PA6, PA7, PC6, PC7, PB14 and PB15). Also I am able to generate six pwm output as well (PA10, PB0, PB1, PB5, PB11 and PC8). I have modified icu_lld.c and icu_lld.h (os\hal\STM32) to include TIM12, 13 and 14. Also have changed configuration registers such that it generates interrupt both on rising edge and falling edge. I have tested the code and so far it seems to work fine. Need to do more testing. Attaching these two files. Like you said modification was eary...
Thanks again..
Sapan
- Attachments
-
- icu.rar
- (5.3 KiB) Downloaded 542 times