22. Infrared interface (IRTIM)

An infrared interface (IRTIM) for remote control is available on the device. It can be used with an infrared LED to perform remote control functions.

It uses internal connections with USART1, USART4 (on STM32F03x and STM32F05x) or USART2 (STM32F07x), TIM16 and TIM17 as shown in Figure 211 .

To generate the infrared remote control signals, the IR interface must be enabled and TIM16 channel 1 (TIM16_OC1) and TIM17 channel 1 (TIM17_OC1) must be properly configured to generate correct waveforms.

The infrared receiver can be implemented easily through a basic input capture mode.

Figure 211. IRTIM internal hardware connections with TIM16 and TIM17

Figure 211: IRTIM internal hardware connections with TIM16 and TIM17. The diagram shows two timer output channels, TIM17_CH1 and TIM16_CH1, connected to an IRTIM block. TIM17_CH1 generates a high-frequency carrier signal, and TIM16_CH1 generates a modulation envelope. These signals are combined in the IRTIM block, which also receives input from USART1 (1) and USART4 (1). The output of the IRTIM block is IR_OUT, which is connected to an infrared LED. The IRTIM block is controlled by the SYSCFG_CFGR1[7:6] register. The diagram includes waveform examples for TIM17_CH1 (high frequency), TIM16_CH1 (modulation envelope), and IR_OUT (modulated signal).
Figure 211: IRTIM internal hardware connections with TIM16 and TIM17. The diagram shows two timer output channels, TIM17_CH1 and TIM16_CH1, connected to an IRTIM block. TIM17_CH1 generates a high-frequency carrier signal, and TIM16_CH1 generates a modulation envelope. These signals are combined in the IRTIM block, which also receives input from USART1 (1) and USART4 (1). The output of the IRTIM block is IR_OUT, which is connected to an infrared LED. The IRTIM block is controlled by the SYSCFG_CFGR1[7:6] register. The diagram includes waveform examples for TIM17_CH1 (high frequency), TIM16_CH1 (modulation envelope), and IR_OUT (modulated signal).

1. USART1 and USART4 can be linked to IRTIM on STM32F09x devices only.

All standard IR pulse modulation modes can be obtained by programming the two timer output compare channels.

TIM17 is used to generate the high frequency carrier signal, while TIM16 generates the modulation envelope.

On STM32F09x devices, the modulation envelope can also be created from USART1 or USART4 transmitter line, upon setting appropriately the IR_MOD[1:0] bits in SYSCFG_CFGR1 register.

The infrared function is output on the IR_OUT pin. The activation of this function is done through the GPIOx_AFRx register by enabling the related alternate function bit.

The high sink LED driver capability (only available on the PB9 pin) can be activated through the I2C_PB9_FMP bit in the SYSCFG_CFGR1 register and used to sink the high current needed to directly control an infrared LED.

For code example refer to the Appendix section A.10.1: TIM16 and TIM17 configuration code example .