Skip to content

zephyr: add rmt support#510

Open
joelguittet wants to merge 1 commit intozephyrproject-rtos:mainfrom
joelguittet:feature/espressif-rmt-driver
Open

zephyr: add rmt support#510
joelguittet wants to merge 1 commit intozephyrproject-rtos:mainfrom
joelguittet:feature/espressif-rmt-driver

Conversation

@joelguittet
Copy link
Contributor

Add expected source files to CMakeLists.txt for each relevant targets.

@joelguittet joelguittet force-pushed the feature/espressif-rmt-driver branch from 52e8b8f to 35199ef Compare December 23, 2025 22:00
@joelguittet
Copy link
Contributor Author

@wmrsouza thanks for the inputs, however, I'm not sure how the pinctrl should be done for such driver. Actually the pin is configured when creating a channel. It's configured at runtime and can change depending on application behavior. How to set pins in the device tree in the rmt node and then reuse them when creating channels in the application? Do you have a similar example in mind?

@wmrsouza
Copy link
Collaborator

@joelguittet pincfgs will permit to apply different states to the peripheral pins according to the Zephyr's power management state. At least you should define rmt pincfg in device tree for the default state and then:

int err = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);

during peripheral instance initialization or configuration

for instance, rmt initialization and channel configuration is very similar to i2s

@wmrsouza
Copy link
Collaborator

@joelguittet for pincfgs, take a look in the PR#282 where i2s was suported on esp32s3 and esp32c3 (and related pins entry were inserted)
zephyr/port/pincfgs/esp32s3.yml

i2s0:
  mclk:
    sigo: i2s0_mclk_out
    gpio: [[0, 21], [26, 48]]
  i_bck:
    sigi: i2s0i_bck_in
    sigo: i2s0i_bck_out
    gpio: [[0, 21], [26, 48]]
  i_ws:
    sigi: i2s0i_ws_in
    sigo: i2s0i_ws_out
    gpio: [[0, 21], [26, 48]]
  i_sd:
    sigi: i2s0i_sd_in
    gpio: [[0, 21], [26, 48]]
  o_bck:
    sigi: i2s0o_bck_in
    sigo: i2s0o_bck_out
    gpio: [[0, 21], [26, 48]]
  o_ws:
    sigi: i2s0o_ws_in
    sigo: i2s0o_ws_out
    gpio: [[0, 21], [26, 48]]
  o_sd:
    sigo: i2s0o_sd_out
    gpio: [[0, 21], [26, 48]]

rmt case will be, probably:

...
rmt0
rx:
    sigi: rmt0_rx
    gpio: [[range0], [range1], ...]
tx:
    sigo: rmt0_out
    gpio: [[range0], [range1], ...]
...

consult TRM and datasheet to get pin ranges

@joelguittet joelguittet force-pushed the feature/espressif-rmt-driver branch from 35199ef to ff71c37 Compare January 8, 2026 01:02
@joelguittet joelguittet force-pushed the feature/espressif-rmt-driver branch from ff71c37 to 7467d4f Compare January 8, 2026 11:44
@joelguittet joelguittet requested a review from wmrsouza January 8, 2026 16:35
@wmrsouza wmrsouza self-assigned this Jan 8, 2026
@wmrsouza
Copy link
Collaborator

wmrsouza commented Jan 8, 2026

LGTM

@wmrsouza wmrsouza dismissed their stale review January 8, 2026 16:46

Changes applied in subsequent commit. Dismissing review.

@wmrsouza
Copy link
Collaborator

wmrsouza commented Jan 8, 2026

@sylvioalves , @marekmatej , @LucasTambor , @raffarost , PTAL

@sylvioalves
Copy link
Collaborator

@joelguittet I suggest you to re-work rmt.h entries to adapt to Zephyr-like, i.e., removing freertos calls, converting to Zephyr locks, add kernel.h and so. This way you can use hal_espressif headers in Zephyr driver directly.

@joelguittet
Copy link
Contributor Author

@joelguittet I suggest you to re-work rmt.h entries to adapt to Zephyr-like, i.e., removing freertos calls, converting to Zephyr locks, add kernel.h and so. This way you can use hal_espressif headers in Zephyr driver directly.

Hello @sylvioalves
I suspect you speak of the files:

  • components/driver/deprecated/driver/rmt.h
  • components/driver/include/esp_private/rmt.h
    Correct? However I don't really understand what should I do with those files... Actually not used, should I simply delete them ? What do you suggest to move here, some stuff from the zephyr repo in the other PR ?

@joelguittet joelguittet force-pushed the feature/espressif-rmt-driver branch 2 times, most recently from 47d6d27 to e9d66c0 Compare February 25, 2026 13:15
@joelguittet joelguittet force-pushed the feature/espressif-rmt-driver branch 2 times, most recently from 4d1c664 to 48f99c6 Compare March 16, 2026 16:09
)
zephyr_include_directories_ifdef(
CONFIG_ESPRESSIF_RMT
../../components/esp_hal_rmt/include
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would you mind moving this to common include section at the top? I know it is global includes and eventually will improve this..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No problem, will do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@joelguittet joelguittet force-pushed the feature/espressif-rmt-driver branch 2 times, most recently from fc610c3 to 66b473f Compare March 18, 2026 09:23
@wmrsouza wmrsouza self-requested a review March 18, 2026 10:49
Add expected source files to CMakeLists.txt for each relevant targets.

Signed-off-by: Joel Guittet <joelguittet@gmail.com>
@joelguittet joelguittet force-pushed the feature/espressif-rmt-driver branch from 66b473f to 955a901 Compare March 18, 2026 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants