Skip to content

espressif/rmt: replace rmtchar with arch-specific lirc adapter#18654

Open
PiyushPatle26 wants to merge 2 commits intoapache:masterfrom
PiyushPatle26:espressif-rmt-lirc-refactor
Open

espressif/rmt: replace rmtchar with arch-specific lirc adapter#18654
PiyushPatle26 wants to merge 2 commits intoapache:masterfrom
PiyushPatle26:espressif-rmt-lirc-refactor

Conversation

@PiyushPatle26
Copy link
Copy Markdown
Contributor

@PiyushPatle26 PiyushPatle26 commented Mar 30, 2026

Note: Please adhere to Contributing Guidelines.

Summary

Replace the ESP-specific rmtchar upper-half with arch-local esp_lirc adapters for Xtensa and RISC-V.

This moves the RMT upper-half out of drivers/rmt, registers LIRC
devices from the ESP board bring-up paths, and removes the old common
rmtchar driver and headers.

Also update the ESP Kconfig and build wiring to build esp_lirc when
ESP_RMT and DRIVERS_RC are enabled.

Impact

  • Moves ESP-specific RMT support from common drivers/rmt into arch-local esp_lirc, aligning with NuttX layering.
  • Replaces the legacy rmtchar interface with the standard LIRC framework and removes obsolete code.
  • Registers LIRC devices from board bring-up, fixing RX/TX device conflicts and improving stability.
  • Limited to ESP targets; out-of-tree users must migrate to /dev/lircX

Testing

Tested on: ESP32-DEVKITC (Chip v1.0)
booted with CONFIG_ESP32_IGNORE_CHIP_REVISION_CHECK=y for local validation only

  • flashed and booted successfully to NSH
  • confirmed device registration:
    • /dev/lirc0
    • /dev/lirc1
    • /dev/leds0
  • confirmed the previous TX registration collision was fixed
    • before fix: board_rmt_txinitialize() failed: -17
    • after fix: both /dev/lirc0 and /dev/lirc1 register
  • confirmed the RX worker thread crash was fixed
    • before fix: opening the RX side triggered a kernel panic in esp_lirc_rx_thread
    • after fix: devices open successfully

Fixes discovered during hardware validation:

  • register TX as /dev/lirc1 so RX and TX do not collide
  • parse the RX worker thread argument from the correct argv slot
  • keep RX devices from advertising TX capability

Test logs:
image

Irtest seems struck so need guidance on what must be changed to validate completely

@github-actions github-actions bot added Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: xtensa Issues related to the Xtensa architecture Area: Drivers Drivers issues Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. Board: risc-v Board: xtensa labels Mar 31, 2026
@acassis
Copy link
Copy Markdown
Contributor

acassis commented Mar 31, 2026

@PiyushPatle26 I liked the idea, however ESP32 RMT is use not only for RC, it is used as signal "generator" to control WS8212 RGB LEDs for example. Similar how people use I2S to emulate other protocols.

@fdcavalcanti @tmedicci @eren-terzioglu please take a look

@acassis
Copy link
Copy Markdown
Contributor

acassis commented Mar 31, 2026

@xiaoxiang781216 who from Xiaomi could help him: "Irtest seems struck so need guidance on what must be changed to validate completely" ?

Copy link
Copy Markdown
Contributor

@acassis acassis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PiyushPatle26 nice work! Kudos!!!
You didn't submit a Documentation about this driver, so searching further I noticed we even don't have basic documentation about RC: https://nuttx.apache.org/docs/latest/components/drivers/character/rc.html#remote-control-devices

Could you please help us to improve it?

@raiden00pl
Copy link
Copy Markdown
Member

related issue: #15431

@tmedicci
Copy link
Copy Markdown
Contributor

@PiyushPatle26 I liked the idea, however ESP32 RMT is use not only for RC, it is used as signal "generator" to control WS8212 RGB LEDs for example. Similar how people use I2S to emulate other protocols.

@fdcavalcanti @tmedicci @eren-terzioglu please take a look

Thanks for submitting it, @PiyushPatle26 . We are testing on our internal CI. Please don't merge it yet.

As Alan pointed, @PiyushPatle26 , the RMT driver is used to drive the WS2812 (on-board LED for some of the Espressif's boards). Did you test it?

@PiyushPatle26
Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216 have removed the files you asked for
@acassis Added the documentation as asked
@tmedicci not yet, my ESP32-devkitc doesn't have a WS2812 on board LED , can use a external ws2812 with jumper wires for proper testing

@xiaoxiang781216
Copy link
Copy Markdown
Contributor

@xiaoxiang781216 have removed the files you asked for @acassis Added the documentation as asked @tmedicci not yet, my ESP32-devkitc doesn't have a WS2812 on board LED , can use a external ws2812 with jumper wires for proper testing

need fix:

    1: .codespellrc
Warning: /home/runner/work/nuttx/nuttx/nuttx/arch/risc-v/src/common/espressif/esp_lirc.h:26:1: warning: #include outside of 'Included Files' section
Warning: /home/runner/work/nuttx/nuttx/nuttx/arch/risc-v/src/common/espressif/esp_lirc.h:28:1: warning: #include outside of 'Included Files' section
Some checks failed. For contributing guidelines, see:

@PiyushPatle26 PiyushPatle26 force-pushed the espressif-rmt-lirc-refactor branch from a214d60 to e94f877 Compare March 31, 2026 16:08
@PiyushPatle26
Copy link
Copy Markdown
Contributor Author

@xiaoxiang781216, I have made the changes you asked.

Copy link
Copy Markdown
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read the contributing guide and update the PR description to match the requirements :)

@PiyushPatle26 PiyushPatle26 force-pushed the espressif-rmt-lirc-refactor branch 2 times, most recently from 07a76b6 to f9787c9 Compare March 31, 2026 23:28
@PiyushPatle26
Copy link
Copy Markdown
Contributor Author

@linguini1 I have made all the changes according to contributing.md

xiaoxiang781216
xiaoxiang781216 previously approved these changes Apr 1, 2026
@linguini1
Copy link
Copy Markdown
Contributor

@linguini1 I have made all the changes according to contributing.md

Your PR description should follow the template with a clear summary, impact and test section. I think you have all these components but just need the headers

@PiyushPatle26
Copy link
Copy Markdown
Contributor Author

@linguini1 I have updated the description as you mentioned

jerpelea
jerpelea previously approved these changes Apr 1, 2026
Copy link
Copy Markdown
Contributor

@acassis acassis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PiyushPatle26 as @tmedicci you need to test it with existing usage case: i.e. to control WS8212 RGB LED matrix. Otherwise you will broke an existing feature

@acassis
Copy link
Copy Markdown
Contributor

acassis commented Apr 1, 2026

@xiaoxiang781216 is there some board where LIRC was tested?

alan@dev:~/nuttxspace/nuttx/boards$ git grep LIRC_
alan@dev:~/nuttxspace/nuttx/boards$

I found a low cost board that I think we can use to validate it:
https://aliexpress.com/item/1005010805058390.html

@eren-terzioglu
Copy link
Copy Markdown
Contributor

@PiyushPatle26 as @tmedicci you need to test it with existing usage case: i.e. to control WS8212 RGB LED matrix. Otherwise you will broke an existing feature

Hi,
Tested internal RGB led using rmt defconfig with ws2812 example. C6 and S3 is working fine

@eren-terzioglu
Copy link
Copy Markdown
Contributor

Please check CI errors

@acassis
Copy link
Copy Markdown
Contributor

acassis commented Apr 1, 2026

@PiyushPatle26 as @tmedicci you need to test it with existing usage case: i.e. to control WS8212 RGB LED matrix. Otherwise you will broke an existing feature

Hi, Tested internal RGB led using rmt defconfig with ws2812 example. C6 and S3 is working fine

So the snake and shift game still working? That is the most important thing to save! :-D

@eren-terzioglu
Copy link
Copy Markdown
Contributor

eren-terzioglu commented Apr 1, 2026

@PiyushPatle26 as @tmedicci you need to test it with existing usage case: i.e. to control WS8212 RGB LED matrix. Otherwise you will broke an existing feature

Hi, Tested internal RGB led using rmt defconfig with ws2812 example. C6 and S3 is working fine

So the snake and shift game still working? That is the most important thing to save! :-D

I have to find the demo board but even if it doesn't; it would be somehow different, no worries. :)

Replace the ESP-specific rmtchar upper-half with arch-local esp_lirc
adapters for Xtensa and RISC-V.

 This moves the RMT upper-half out of drivers/rmt, registers LIRC
 devices from the ESP board bring-up paths, and removes the old common
 rmtchar driver and headers.

 Also update the ESP Kconfig and build wiring to build esp_lirc when
 ESP_RMT and DRIVERS_RC are enabled.

 Fixes discovered during hardware validation:
  - register TX as /dev/lirc1 so RX and TX do not collide
  - parse the RX worker thread argument from the correct argv slot
  - keep RX devices from advertising TX capability

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
@PiyushPatle26 PiyushPatle26 force-pushed the espressif-rmt-lirc-refactor branch from 411e3b0 to 3acd6c5 Compare April 1, 2026 20:15
@PiyushPatle26
Copy link
Copy Markdown
Contributor Author

Please check CI errors

Hey @eren-terzioglu, i think CI errors should be fixed now
@acassis I was not able to test as I just have a ESP32-devkitC which doesn't have WS8212, But i think @eren-terzioglu have already tested, right?

@linguini1
Copy link
Copy Markdown
Contributor

Ideally you should have a way to test your changes in some capacity. Also, the CI is failing because of config files which aren't normalized. You can use tools/refresh.sh to normalize them :)

Add documentation for the RC/LIRC character driver subsystem covering
device registration, the LIRC interface, and usage from user space.

Remove placeholder empty files under drivers/rmt that were left over
from the rmtchar era and are no longer referenced.

Signed-off-by: Piyush Patle <piyushpatle228@gmail.com>
@PiyushPatle26
Copy link
Copy Markdown
Contributor Author

Ideally you should have a way to test your changes in some capacity. Also, the CI is failing because of config files which aren't normalized. You can use tools/refresh.sh to normalize them :)

Sorry for not being able to test properly, Thanks for helping for CI, now i have normalized the configs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Arch: xtensa Issues related to the Xtensa architecture Area: Drivers Drivers issues Board: risc-v Board: xtensa Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants