Skip to content

RFC: Add RMT RX module. - #18454

Open
elvis-epx wants to merge 5 commits into
micropython:masterfrom
elvis-epx:rmtrx
Open

elvis-epx wants to merge 5 commits into
micropython:masterfrom
elvis-epx:rmtrx

Conversation

@elvis-epx

Copy link
Copy Markdown
Contributor

Summary

This is a proposal to add RX support to esp32 RMT, that currently supports TX only.

Testing

Tested on ESP32, ESP32-S3, ESP32-C3 and ESP32-C6 boards.

Trade-offs and Alternatives

A different class esp32.RMTRX was introduced. I feel it does not have much in common with esp32.RMT, and using TX and RX at the same time over the same pin is not usual in RMT. But someone may disagree.

@elvis-epx
elvis-epx force-pushed the rmtrx branch 2 times, most recently from 078969b to 84d4181 Compare November 21, 2025 15:27
This was referenced Dec 9, 2025
@projectgus
projectgus self-requested a review December 17, 2025 04:53

@projectgus projectgus left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for submitting this PR, @elvis-epx. I think this will be a really useful feature to have in MicroPython.

I've left some comments, mostly minor style and nitpicky things. The main high-level question I have is about the software filtering features.

The other thing that would be great to have here would a test, in tests/ports/esp32. It would be new as we also don't have a test for RMT TX ( 😢 ) but you could use the same loopback wiring pattern from tests/target_wiring/esp32.py to connect two GPIOs and then measure output from one via RMTRX. Would you be up for implementing something like this?

Comment thread docs/library/esp32.rst Outdated
Comment thread ports/esp32/esp32_rmtrx.c Outdated
Comment thread ports/esp32/esp32_rmtrx.c Outdated
Comment thread docs/library/esp32.rst Outdated
Comment thread docs/library/esp32.rst Outdated
Comment thread docs/library/esp32.rst Outdated
Comment thread docs/library/esp32.rst Outdated
Comment thread docs/library/esp32.rst
Comment thread docs/library/esp32.rst
Comment thread docs/library/esp32.rst Outdated
@elvis-epx

Copy link
Copy Markdown
Contributor Author

Thanks for submitting this PR, @elvis-epx. I think this will be a really useful feature to have in MicroPython.

I've left some comments, mostly minor style and nitpicky things. The main high-level question I have is about the software filtering features.

The other thing that would be great to have here would a test, in tests/ports/esp32. It would be new as we also don't have a test for RMT TX ( 😢 ) but you could use the same loopback wiring pattern from tests/target_wiring/esp32.py to connect two GPIOs and then measure output from one via RMTRX. Would you be up for implementing something like this?

Sounds great, will take a while until I find time to write this test, but seems worthwhile.

@github-actions

github-actions Bot commented Jan 21, 2026 •

Copy link
Copy Markdown

Code size report:

Reference:  zephyr: Add support for RISC-V RV32IMC native code emitter. [9721955]
Comparison: esp32: Add RMT simple test. [merge of 2a4ec5c]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32: +5932 +0.340% ESP32_GENERIC[incl +1440(data)]
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

elvis-epx and others added 4 commits January 26, 2026 16:33
Signed-off-by: Elvis Pfutzenreuter <[email protected]>
Small fixes and style changes in RMT RX documentation.

Co-authored-by: Angus Gratton <[email protected]>
Signed-off-by: Elvis Pfützenreuter <[email protected]>
Align the code style to esp32_rmt.c.

Signed-off-by: Elvis Pfutzenreuter <[email protected]>
Add comment to clarify where the 15-bit value comes from.

Signed-off-by: Elvis Pfutzenreuter <[email protected]>
@codecov

codecov Bot commented Jan 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.42%. Comparing base (25b400f) to head (2a4ec5c).
⚠️ Report is 77 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #18454      +/-   ##
==========================================
+ Coverage   98.38%   98.42%   +0.04%     
==========================================
  Files         171      174       +3     
  Lines       22299    22333      +34     
==========================================
+ Hits        21938    21982      +44     
+ Misses        361      351      -10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@elvis-epx

Copy link
Copy Markdown
Contributor Author

Thanks for submitting this PR, @elvis-epx. I think this will be a really useful feature to have in MicroPython.
I've left some comments, mostly minor style and nitpicky things. The main high-level question I have is about the software filtering features.
The other thing that would be great to have here would a test, in tests/ports/esp32. It would be new as we also don't have a test for RMT TX ( 😢 ) but you could use the same loopback wiring pattern from tests/target_wiring/esp32.py to connect two GPIOs and then measure output from one via RMTRX. Would you be up for implementing something like this?

Sounds great, will take a while until I find time to write this test, but seems worthwhile.

@projectgus added a simple test, see if this is going the direction you want

@projectgus projectgus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @elvis-epx,

I have one minor suggestion but the new test looks great, thank you! 😁

The only other request I have is to please name the new test esp32_rmt.py instead of check_rmt.py, that's the (rough) convention we use for the other tests.

Comment thread tests/target_wiring/esp32.py Outdated
@projectgus projectgus added this to the release-1.28.0 milestone Feb 3, 2026
Add simple end-to-end test for RMT RX, and TX.

Signed-off-by: Elvis Pfutzenreuter <[email protected]>
ChrisDick pushed a commit to emfcamp/badge-2024-software that referenced this pull request Sep 14, 2026
Robotmad added a commit to TeamRobotmad/badge-2024-software that referenced this pull request Sep 15, 2026
commit 398a2ce
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:25:59 2026 +0100

    use TILDAGON_XXX_I2C_PORT definitions in place of magic numbers for I2C mux ports

commit 83e1411
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:25:32 2026 +0100

    GPIO pins via AW9523B: cache output state, direction and mode in RAM. Use tildagon-i2c-manager one-shot C callback job for the last write of any action so that micropython can return and leave that to take place in parallel.  FreeRTOS Semaphore used to mange serialisation of I2C access for maximum performance.  Move toggle to C layer to take advantage of caching. Update fakes for Pin and ePin.

commit ffc479b
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:23:27 2026 +0100

    Frontboard 2026 compass - use tildagon-i2c-manager job for polling.  The job only does data transfer - so conversion from raw bytes to meaningful values moved to the read function.

commit 78da35e
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:22:28 2026 +0100

     IMU class:: use of tildagon-i2c-manager jobs for I2C polling.  get and set_period() methods. Default to sensor I2C polling being Off - automatically activated on first read at 'legacy' rates 40mS for gyro/accelerometer, 1000mS for temperature and steps (now controlled separately from accel/gyro). Uses refactored BMI270 driver.  Use of const to reduce RAM use.  New tildagon_imu_state_t structure for RAM so that lsm6ds3 and bmi270 don't have duplicate static allocations internally.  lsm6ds3 control register set to filter sensor data in sync wtih the intended I2C read poll rate.

commit a78d22c
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:21:32 2026 +0100

    support 16 bit addressing of i2c device registers (e.g. SCD4X)

commit 5ee12dc
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:14:29 2026 +0100

    tildagon_i2c_manager: new task in place of imu task, supports i2c operations running in parallel wtih micropython for imu, but also any other i2c transaction can now take advantage of this parallelism via C callbacks for C/micropython 'jobs'.  micropython API provided for 'jobs' comprising up to 5 steps.  READ/WRITE/READ16/WRITE16/CHECK step types.  One-Shot (run_once) or Periodic execution with status monitoring and optional 'Pin.irq' style callback upon completion.  Support for I2C devices with 8 bit and 16 bit register addressing. 10 slots for I2C callbacks/jobs.  Replace extern ad-hoc declarations.

commit 9c3948f
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:01:48 2026 +0100

    IMU - refactored minimal bmi270 driver in place of flow3r one, with support for setting read/update period and hence internal filters to match I2C polling period.

commit f10ecb8
Author: Sam Machin <[email protected]>
Date:   Mon Sep 14 22:51:16 2026 +0100

    Feat/utc settings (emfcamp#440)

    * add utc offset to settings

    * add utc offset to settings

    * store seconds use offset as label

    * fix formating

commit 1fe0fad
Author: Sam Machin <[email protected]>
Date:   Mon Sep 14 22:21:36 2026 +0100

    keyboard enter done in TextDialog (emfcamp#443)

    Allows the enter key to trigger Done in a TextDialog

commit f2f6a3d
Author: Matthew Wilkes <[email protected]>
Date:   Mon Sep 14 22:19:22 2026 +0100

    Add RMT RX peripheral (emfcamp#425)

    Backports micropython/micropython#18454 from MP 1.29 (or later)

commit 9b833f0
Author: Sam Machin <[email protected]>
Date:   Mon Sep 14 21:28:10 2026 +0100

    add ntpsync service (emfcamp#442)

commit ee80b27
Author: Christopher Barnes <[email protected]>
Date:   Mon Sep 14 20:19:09 2026 +0100

    Change FreeRTOS tick rate to 1mS (emfcamp#456)
Robotmad added a commit to TeamRobotmad/badge-2024-software that referenced this pull request Sep 22, 2026
commit 71f5e11
Author: robotmad <[email protected]>
Date:   Fri Sep 18 00:39:04 2026 +0100

    update callaback arguments in interrupts-in-space files

commit 68c6ca4
Author: robotmad <[email protected]>
Date:   Thu Sep 17 23:51:49 2026 +0100

    update as per changes to aw9523b.h

commit c987957
Author: robotmad <[email protected]>
Date:   Thu Sep 17 23:51:04 2026 +0100

    Squashed commit of the following:

    commit a2e7dd0
    Author: Chris <[email protected]>
    Date:   Wed Aug 5 22:16:04 2026 +0100

        interrupt driven spaceagon

        buttons, joystick and touch running on interrupts. PMIC status read limited to rate of PMIC ADC (1Hz)

commit 3674e33
Author: robotmad <[email protected]>
Date:   Thu Sep 17 23:46:50 2026 +0100

    Merge branch 'i2c-scan-selective'

commit beb9122
Author: robotmad <[email protected]>
Date:   Thu Sep 17 23:40:48 2026 +0100

    memory saving from eliminating callback args - hence only need to remember the callback function as pin/port can be reconstructed.

commit 398a2ce
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:25:59 2026 +0100

    use TILDAGON_XXX_I2C_PORT definitions in place of magic numbers for I2C mux ports

commit 83e1411
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:25:32 2026 +0100

    GPIO pins via AW9523B: cache output state, direction and mode in RAM. Use tildagon-i2c-manager one-shot C callback job for the last write of any action so that micropython can return and leave that to take place in parallel.  FreeRTOS Semaphore used to mange serialisation of I2C access for maximum performance.  Move toggle to C layer to take advantage of caching. Update fakes for Pin and ePin.

commit ffc479b
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:23:27 2026 +0100

    Frontboard 2026 compass - use tildagon-i2c-manager job for polling.  The job only does data transfer - so conversion from raw bytes to meaningful values moved to the read function.

commit 78da35e
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:22:28 2026 +0100

     IMU class:: use of tildagon-i2c-manager jobs for I2C polling.  get and set_period() methods. Default to sensor I2C polling being Off - automatically activated on first read at 'legacy' rates 40mS for gyro/accelerometer, 1000mS for temperature and steps (now controlled separately from accel/gyro). Uses refactored BMI270 driver.  Use of const to reduce RAM use.  New tildagon_imu_state_t structure for RAM so that lsm6ds3 and bmi270 don't have duplicate static allocations internally.  lsm6ds3 control register set to filter sensor data in sync wtih the intended I2C read poll rate.

commit a78d22c
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:21:32 2026 +0100

    support 16 bit addressing of i2c device registers (e.g. SCD4X)

commit 5ee12dc
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:14:29 2026 +0100

    tildagon_i2c_manager: new task in place of imu task, supports i2c operations running in parallel wtih micropython for imu, but also any other i2c transaction can now take advantage of this parallelism via C callbacks for C/micropython 'jobs'.  micropython API provided for 'jobs' comprising up to 5 steps.  READ/WRITE/READ16/WRITE16/CHECK step types.  One-Shot (run_once) or Periodic execution with status monitoring and optional 'Pin.irq' style callback upon completion.  Support for I2C devices with 8 bit and 16 bit register addressing. 10 slots for I2C callbacks/jobs.  Replace extern ad-hoc declarations.

commit 9c3948f
Author: robotmad <[email protected]>
Date:   Tue Sep 15 21:01:48 2026 +0100

    IMU - refactored minimal bmi270 driver in place of flow3r one, with support for setting read/update period and hence internal filters to match I2C polling period.

commit f10ecb8
Author: Sam Machin <[email protected]>
Date:   Mon Sep 14 22:51:16 2026 +0100

    Feat/utc settings (emfcamp#440)

    * add utc offset to settings

    * add utc offset to settings

    * store seconds use offset as label

    * fix formating

commit 1fe0fad
Author: Sam Machin <[email protected]>
Date:   Mon Sep 14 22:21:36 2026 +0100

    keyboard enter done in TextDialog (emfcamp#443)

    Allows the enter key to trigger Done in a TextDialog

commit f2f6a3d
Author: Matthew Wilkes <[email protected]>
Date:   Mon Sep 14 22:19:22 2026 +0100

    Add RMT RX peripheral (emfcamp#425)

    Backports micropython/micropython#18454 from MP 1.29 (or later)

commit 9b833f0
Author: Sam Machin <[email protected]>
Date:   Mon Sep 14 21:28:10 2026 +0100

    add ntpsync service (emfcamp#442)

commit ee80b27
Author: Christopher Barnes <[email protected]>
Date:   Mon Sep 14 20:19:09 2026 +0100

    Change FreeRTOS tick rate to 1mS (emfcamp#456)

commit 42c2a0f
Author: Sam Machin <[email protected]>
Date:   Thu Aug 6 22:15:47 2026 +0200

    add missing chars  in text dialog (emfcamp#433)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants