Skip to content

fix "pulseio.PulseIn maxlen is limited to 128 in esp32" #10397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Sola85
Copy link

@Sola85 Sola85 commented Jun 2, 2025

Sets .flags.with_dma = 1 in RMT config that is used in pulseio.PulseIn and fixes #9234.

Quoting the documentation:

The receiver saves the incoming signals into its internal memory block or DMA buffer, in the format of rmt_symbol_word_t.
Due to the limited size of the memory block, the RMT receiver can only save short frames whose length is not longer than the memory block capacity

By my understandig, this removes the limit only being able to receive 128 pulses, which arises due to the "internal memory" being limited to a size given by SOC_RMT_MEM_WORDS_PER_CHANNEL.

In DMA-mode, self->raw_symbols has to be located in internal RAM, not PSRAM, hence the remaining changes.

I have tested this on a Waveshare ESP32-S3-Zero and in my setup I can now receive pulse sequences of length 250, which was not possible before.

The documentation also says:

However, the DMA backend is not available on all ESP chips, please refer to [TRM] before you enable this option. Or you might encounter a ESP_ERR_NOT_SUPPORTED error.

But I checked the esp-idf documentation of all esp variants, and they all reference DMA mode, if RMT hardware is available, so I'm not sure what the documentation is referring to here... If there really are some variants that support RMT but not DMA mode, then this PR would need some guards for that.

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.

pulseio.PulseIn maxlen is limited to 128 in esp32
1 participant