Supported ICs

Overview

The Infrared Radiation (IR) module is a controller used for infrared transmission and reception. It supports half-duplex communication and features hardware modulation and automatic capture of infrared signals.

Operating Modes

Transmit Mode : Hardware-based modulation, sends infrared signals via the TX port.

Receive Mode : Supports both learning mode and normal receive mode, corresponding to infrared photodiode and infrared receiver module as hardware front-ends.

Detailed Working Modes of the IR Module:

Mode

Core Function

Technical Features

Signal Chain Features

Transmit Mode

Infrared signal generation and modulation

Programmable control of carrier parameters

Digital signal → Carrier modulation → Infrared transmission

Receive Mode

Infrared signal capture and demodulation

Compatible with two types of front-end architectures

Infrared signal → Baseband recovery → Digital decoding

Working Principle

Signal Model

To simplify understanding of infrared signals, they can be categorized into the following symbol types:

  • Carrier Symbol :

    • Description: A signal containing a number of carrier clock cycles over a certain period.

    • Characteristics: The modulated signal that actually propagates through the physical medium.

  • Space Symbol :

    • Description: A signal maintaining a continuous high or low level over a certain period.

    • Characteristics: Represents the digital signal before modulation or after demodulation.

../../../_images/ir_signal_model.svg

IR Signal Model

Transmission Mode

Principles of Signal Transmission

In transmission mode, accurate modulation and transmission of the signal are ensured through the following configurations:

  • Carrier Frequency Configuration:

    • Set the base frequency for signal modulation to provide stable transmission performance.

  • Space Symbol Configuration:

    • Define the space symbols of the signal by writing the duration of the high and low levels into the TX FIFO.

Together, these configurations determine the final signal output waveform, as illustrated below:

../../../_images/ir_tx_flow.svg

TX Workflow Diagram

Parsing TX FIFO Data

The TX FIFO data is 32 bits wide and contains the following information:

Field

Description

Parameter Meaning

BIT[31]

Carrier Transmission

1: Transmit carrier

0: Do not transmit carrier

BIT[30]

Data End Flag

1: Last packet

0: Normal packet

BIT[29:28]

Compensation Mode

0: Non-carrier phase, count periods using system clock

3: Non-carrier phase, count periods using specified compensation frequency

1, 2: Not recommended

BIT[27:0]

Period count of carrier/non-carrier

Counted by carrier frequency or compensation frequency

Where the field BIT[27:0] is calculated as follows:

BIT[27:0] = fcarrier * Tduration

Parameter Meaning:

fcarrier:

Carrier frequency (in Hertz)

Tduration:

Duration of carrier or non-carrier symbol (in seconds)

Note

  • Compensation Mechanism: Effective only for the non-carrier phase in TX counting.

  • Compensation Mode: Using mode1 or mode2 is not recommended.

Organizing TX FIFO Data

Introduction to NEC Encoding Protocol

The NEC encoding protocol format comprises 2 start symbols, 64 data symbols, and 1 stop symbol. Specifically:

  • Logical 1 : Consists of a 560µs high-level signal followed by a (2250-560)µs low-level signal.

  • Logical 0 : Consists of a 560µs high-level signal followed by a (1120-560)µs low-level signal.

../../../_images/ir_nec_protocol.svg

NEC Modulation

Below is an example configuration using the NEC encoding protocol with a 38KHz carrier frequency and a compensation mode set to 0, illustrating how to organize the data to be written into the TX FIFO.

  • Transmitting Logical 1 :

    Write the following two groups of data into TX FIFO:

Entry

BIT[31]

BIT[30]

BIT[29:28]

BIT[27:0]

First

1

0

0

38 * 560 / 1000 = 21

Second

0

0

0

38 * (1690 - 560) / 1000 = 63

  • Transmitting Logical 0 :

    Write the following two groups of data into TX FIFO:

Entry

BIT[31]

BIT[30]

BIT[29:28]

BIT[27:0]

First

1

0

0

38 * 560 / 1000 = 21

Second

0

0

0

38 * (1120 - 560) / 1000 = 21

  • Stopping Transmission :

    To stop data transmission, set BIT[30]=1 in the last packet of the TX FIFO; the current data packet will still be sent.

Entry

BIT[31]

BIT[30]

BIT[29:28]

BIT[27:0]

First

1

1

0

38 * 560 / 1000 = 21

Reception Mode

Signal Reception Principle

The reception module monitors the duration (in sampling cycles) of the input high/low level signals and stores this information in the RX FIFO for software use.

The RX FIFO contents and their interpretation change depending on the selected reception mode:

  • Learning Mode :

    • The input signal contains the carrier wave.

    • The IR core captures carrier symbols.

    • The software needs to demodulate and decode to extract information such as carrier frequency and duty cycle.

  • Normal Reception Mode :

    • The front-end filters out the carrier wave.

    • The IR core captures space symbols .

    • No software demodulation is needed , simplifying subsequent parsing and processing.

../../../_images/ir_rx_modules.svg

RX workflow diagram—comparison between Learning Mode and Normal Reception Mode

Parsing RX FIFO Data

The RX FIFO data is 32 bits wide and contains the following two pieces of information:

Field

Description

Parameter Meaning

BIT[31]

Signal level state received

  • 1: High level

  • 0: Low level

BIT[30:0]

Number of sampling clock cycles in the current signal level state

Related to sampling frequency

For example, under a sampling rate of 10 MHz (clock period of 100 ns):

Data

RX FIFO Value

Meaning

Data 1

0X10001000

Indicates approximately 409.6 μs of high-level signal

Data 2

0X00A1644

Indicates approximately 66.106 ms of low-level signal

Start Conditions for Reception

  • Manual Reception : Allows manual control of the reception process.

  • Automatic Reception :

    • Trigger Condition Configuration:

      • Rising edge, falling edge, or any signal change.

    • Functionality:

      • The hardware will automatically start the reception process when a configured trigger is detected on the RX input signal.

Stop Conditions for Reception

Once preset conditions are met, the RX module will trigger a specific interrupt event.

Depending on system design, the interrupt handler can directly turn off the IR or release a semaphore to notify a corresponding thread to complete the IR shutdown.

Related settings include:

  • Signal Level State for Termination :

    Explicitly define which level states will trigger the reception stop.

  • Duration Requirement for Signal Level State :

    Define the minimum time the level state needs to be maintained to trigger the interrupt.

  • Enable RX Counter Threshold Interrupt :

    Ensure that the RX module can trigger an IR_BIT_RX_CNT_THR_INT_STATUS interrupt once the specified level and duration are detected.

For example, the following configuration will cause the RX module to generate this interrupt event when it detects an input signal of low-level state with a duration of not less than approximately 66.1 ms:

/* Sampling rate of 10MHz */
IR_InitStruct.IR_Freq = 10000000;

/* Condition 1: Level signal state */
IR_InitStruct.IR_RxCntThrType = IR_RX_COUNT_LOW_LEVEL;

/* Condition 2: Threshold of level signal duration, set to around 66.1ms */
IR_InitStruct.IR_RxCntThr = 0xa1644;

/* Condition 3: Enable RX Counter threshold interrupt */
IR_INTConfig(IR_DEV, IR_BIT_RX_CNT_THR_INT_EN, ENABLE);

Development Process

Transmission

  1. Set Pins

  2. Configure Carrier Frequency and Duty Cycle

    • Configure appropriately according to the communication protocol’s requirements.

  3. Configure TX FIFO

    • Used to control the duration of space symbols for hardware modulation.

Reception

  1. Set Pins

  2. Configure Sampling Frequency

    • Ensure that the reception module can accurately capture and record the input signal into the RX FIFO.

  3. Configure Method to Trigger Reception

  4. Configure Conditions to Stop Reception

  5. Select RX FIFO Processing Strategy

  6. Turn Off IR

    • Turn off the IR receiver when the termination conditions defined in step4 are met.

Example Applications

The SDK provides the following examples to help developers understand and use IR functions:

Note

To check the IC supported by the examples, please refer to the README.md file under each example’s path.

API Reference

For detailed information and usage of related APIs, please refer to {SDK}\component\soc\amebaxxxx\fwlib\include\ameba_ir.h .