Eric Chu

A method to realize IR remote receiver with Kinetis

Discussion created by Eric Chu Employee on Jul 9, 2013

IR receiver can be implemented with GPIO and timer. The GPIO should be configured to trigger interrupt on rising and falling edge and the timer is used for measuring interval between edges. Here is an example of GPIO configuration:

         PORTC_PCR0 = (uint32_t)((PORTC_PCR0 & (uint32_t)~(uint32_t)(

                        PORT_PCR_ISF_MASK |

                        PORT_PCR_MUX(0x06)

                        )) | (uint32_t)(

                        PORT_PCR_MUX(0x01)

                        ));

            PORTC_PCR0 = (uint32_t)((PORTC_PCR0 & (uint32_t)~(uint32_t)(

                        PORT_PCR_IRQC(0x04)

                        )) | (uint32_t)(

                        PORT_PCR_ISF_MASK |

                        PORT_PCR_IRQC(0x0B)

                        ));

When IR data arrives, GPIO interrupt is triggered and timer starts to run. On every voltage transition, the timer value is read out, then IR data which organized in given protocol can be recognized. For example, NEC protocol data consists of 9ms head, 4.5ms transition and 32 bit data, data ‘0’ consists of 0.56ms high level and 0.56ms low level while data ‘1’ consists of 0.56ms high level and 1.68ms low level. The whole NEC data is about 68ms and usually repeats every 110ms, the period of the timer can be set to 80ms and stop receiving when timer overflow. For unknown protocol, the whole waveform can be recorded with this method, which used for self-learning.

Outcomes