Last Updated on : 2024-05-11 08:07:07download
This topic describes the infrared (IR) and radio frequency (RF) service for developing universal IR remotes.
Configure the IR feature on the Developer Platform, or contact your account manager to enable the required service.
The MCU specifies the IR transmission (TX) pin and IR reception (RX) pin in the ir
field when responding to the product information query (0x01).
For example, 5.12
indicates the IR TX pin is I/O 5 and the IR RX pin is I/O 12.
If the module works in the self-processing mode, the IR I/Os must not be used for the reset button or the Wi-Fi status indicator. For cross-module I/O configuration, the pin number plus 32
makes the pin number we need. For example, the pin number to be set for PB20 is 52 (20 + 32
= 52). The IR TX pin requires PWM signals. The IR RX pin requires I/O interrupts. For more information about the pin configuration, see the datasheet of your modules.
To reuse the Wi-Fi indicator GPIO when the module works in the self-processing mode, you can set it using Sync new feature settings.
The commands used in the IR service.
Commands | Description |
---|---|
0x2e | Sync IR status |
0x2f | Trigger IR reception and transmission testing |
IR status | Description | Status value |
---|---|---|
Status 1 | IR code is being sent. | 0x00 |
Status 2 | IR code is sent. | 0x01 |
Status 3 | IR learning is in progress. | 0x02 |
Status 4 | IR learning is completed. | 0x03 |
The short retention of IR code availability determines that serial data is sent directly without a resending mechanism.
You can configure the IR status indication as needed.
IR transmission and reception will use two GPIO pins on the module. If the module works in the self-processing mode, ensure that the IR GPIO pins are not configured for other features. For more information about the module self-processing mode, see Query working mode (0x02).
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Commands | 1 | 0x2e |
Data length | 2 | 0x0001 |
Data | Data | Indicate the IR status.
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 2e 00 01 00 2e
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Commands | 1 | 0x2e |
Data length | 2 | 0x0000 |
Data | Data | None |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 03 2e 00 00 30
The MCU sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Commands | 1 | 0x2f |
Data length | 2 | 0x0000 |
Data | Data | None |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 03 2f 00 00 31
The module returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Commands | 1 | 0x2f |
Data length | 2 | 0x0001 |
Data | Data |
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 2f 00 01 00 2f
abv
field in Sync new feature settings (0x37 and 0x00).buf
field in Sync new feature settings (0x37 and 0x00) to send its serial buffer size to the module. According to the maximum data length of the key value, the MCU serial buffer must be larger than 256 bytes.The commands used in the RF service.
Commands | Description |
---|---|
0x33 (subcommand: 0x01) | Control RF learning |
0x33 (subcommand: 0x02) | Send RF data |
0x33 (subcommand: 0x03) | Report RF learning |
The module instructs the MCU to enter or exit RF learning mode.
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Commands | 1 | 0x33 |
Data length | 2 | 0x0002 |
Data | 1 | Subcommand: 0x01 : RF learning command |
1 | Control status:
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 33 00 02 01 01 36
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Commands | 1 | 0x33 |
Data length | 2 | 0x0003 |
Data | 1 | Subcommand: 0x01 |
1 | Control status: 0x01 : Enter RF learning mode. |
|
1 | Acknowledgment status:
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 03 33 00 03 01 01 00 3a
A piece of RF data can consist of multiple key values. If a piece of RF data exceeds the serial buffer capacity, key values can be transmitted in multiple packets.
RF data has a fixed encoding, with the transmission time per bit determined by the rate. When a bit is 1
, it is transmitted. When a bit is 0
, it is not sent and the high bit goes first.
The MCU only needs to parse the Data field, not the frequency and transmission rate fields.
The module sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Commands | 1 | 0x33 |
Data length | 2 | 0x07+n*(T+D+I+L+C) |
Data | 1 | Subcommand: 0x02 |
1 | Messaging type:
|
|
1 | The number of key values: n |
|
1 | Key value offset:
|
|
1 | Frequency: 0 : 315 MHz. 1 : 433.92 MHz. |
|
2 | Transmission rate: For example, 2,777 bps. | |
N | Data
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 33 00 xx 02 01 00 ff 00 0a d9 00 00 00 00 00 00 xx xx xx xx xx xx xx
The MCU returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Commands | 1 | 0x33 |
Data length | 2 | 0x0002 |
Data | 1 | Subcommand: 0x02 |
1 | Acknowledgment status:
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 33 00 02 02 00 36
The MCU sends the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x03 |
Commands | 1 | 0x33 |
Data length | 2 | 0x0002 + N |
Data | 1 | Subcommand: 0x03 |
1 | Status:
|
|
N | Data content: If learning fails, the MCU will not send this field. If learning succeeds, the MCU can send data in a custom format. | |
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 03 33 xx xx 03 00 xx xx xx xx xx xx
The module returns the following data.
Field | Bytes | Description |
---|---|---|
Header | 2 | 0x55aa |
Version | 1 | 0x00 |
Commands | 1 | 0x33 |
Data length | 2 | 0x0002 |
Data | 1 | Subcommand: 0x03 |
1 | Acknowledgment status:
|
|
Checksum | 1 | Start from the header, add up all the bytes, and then divide the sum by 256 to get the remainder. |
Example: 55 aa 00 33 00 02 03 00 37
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback