2017-09-27 05:16 AM
Greetings community,
I am developing an IR learning hardware that can transmit its learned IR codes as well. For the transmitter part, I will be using the IR_OUT pin (PA13).
For the receiver part, from AN4834, I understand that a General Purpose Timer needs to be configured in PWM input to capture incoming demodulated IR data. The STM32L4 has 3 x GP Timers, namely TIM15, TIM16 and TIM2, As TIM 15 and TIM 16 are used for the modulation of the transmitted Infrared signal, that leaves me only with TIM2 to be used for my specific purpose.
That brings it to my question; which pin should I connect the demodulated infrared signal at STM32L4 so I can use TIM2 as PWM input to capture the data stream.
Best Regards,
Mete
#general-purpose-timers #tim2 #tim #ir #pwm #ir_out #tim16 #stm32l4 #infraredSolved! Go to Solution.
2017-09-27 03:05 PM
Hello Mete!
which pin should I connect the demodulated infrared signal at STM32L4 so I can use TIM2 as PWM input to capture the data stream.
You may use TIM2_CH1 or TIM2_CH2 as PWM inputs.
Inside of your device's DataSheet, you will find the exact pins which are connected internaly to theese TIM2 channels.
The next example is from RM0394
In same RM, TI1 is the TIM2_CH1 pin and TI2 is TIM2_CH2 pin.
this example uses TI1 as the PWM input .
There are also working examples how to use PWM input at L4
Regards
vf
2017-09-27 03:05 PM
Hello Mete!
which pin should I connect the demodulated infrared signal at STM32L4 so I can use TIM2 as PWM input to capture the data stream.
You may use TIM2_CH1 or TIM2_CH2 as PWM inputs.
Inside of your device's DataSheet, you will find the exact pins which are connected internaly to theese TIM2 channels.
The next example is from RM0394
In same RM, TI1 is the TIM2_CH1 pin and TI2 is TIM2_CH2 pin.
this example uses TI1 as the PWM input .
There are also working examples how to use PWM input at L4
Regards
vf
2017-09-28 12:36 AM
Dear Vangelis,
Thank you very much for your detailed response. I understand that the adjacent signal to the selected channel is also used for the PWM input because both edges need to be detected.
Does this mean that the pin the adjacent channel is connected cannot be used for other purposes?
Best Regards,
Mete
2017-09-28 08:20 AM
Hello again.
Does this mean that the pin the adjacent channel is connected cannot be used for other purposes?
It can used for other purposes yes. except TIM2_CHx because this functionality is connected internal to the other pin
x is the non used input.(1, or 2).
E.g. it can used as normal GPIO pin.
Regards
Vf
2017-10-04 08:02 AM
Dear
FORTOUNAS.EVANGELOS
,I am sorry for the necromancy but one more question if you may;
Am I missing anything with this config? I chose to use TIM2_CH2 for direct input capture mode. I am not sure if the Slave Mode, Trigger Source and Clock Source are set correctly or not. Is there a configuration example for PWMI anywhere I can base my design around?
I thought the signal path for PWMI would be as such when CH2 is selected. Do you think it is correct?
Best Regards,
Mete
2017-10-04 08:41 AM
Hello Mete.
The scheme is like this
to use the PWM Input mode from CUBEMx must selected from the combined channels droplist.
To start the PWM Input , in your main function, call HAL_TIM_IC_Start (or HAL_TIM_PWM_Start) (for both channels).
And don't forget to put inside TIM2 settings, the counter period(AR Register) to a higher value than PWM period you try to measure.
regards
vf
2017-10-04 08:50 AM
Dear Evanghelos,
to use the PWM Input mode from CUBEMx must select the combined channels droplist.
Thank you very much my dear friend. This helps a lot and I shouldn't have missed that.
Best Regards,
Mete