Repository navigation
RFC: Add RMT RX module. - #18454
RFC: Add RMT RX module.#18454elvis-epx wants to merge 5 commits into
Conversation
078969b to
84d4181
Compare
There was a problem hiding this comment.
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. |
|
Code size report: |
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
@projectgus added a simple test, see if this is going the direction you want |
352036a to
8537c3a
Compare
projectgus
left a comment
There was a problem hiding this comment.
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.
Add simple end-to-end test for RMT RX, and TX. Signed-off-by: Elvis Pfutzenreuter <[email protected]>
Backports micropython/micropython#18454 from MP 1.29 (or later)
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 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)
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.