-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much!
I've suggested a few changes to use an API we have internally that can be used to request DMA-capable memory. It uses the same routines you called explicitly. Would you be willing to test again with these changes? Thanks.
Co-authored-by: Dan Halbert <[email protected]>
@dhalbert Thanks for the suggestions. I've applied them and will try them using the build artifacts, once they are done. I'll let you know when I've confirmed that this still works in my setup. |
@dhalbert Actually, I know that the esp-idf I noticed some funny looking logic in circuitpython/ports/espressif/supervisor/port.c Lines 306 to 320 in 5dd6010
If Not sure whether the logic in |
I was thinking PSRAM was not DMA capable, but that's on RP2xxxx, let me rethink this! I think you may be right about the logic. |
Just checked the documentation here and here:
and
So I believe that the logic in |
Thanks, so I agree that the current code in |
@Sola85 I reworked |
Thanks! I just flashed the artifacts and everything seems to be working again. No more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix and for working out the storage allocation questions!
Sets
.flags.with_dma = 1
in RMT config that is used inpulseio.PulseIn
and fixes #9234.Quoting the documentation:
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:
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.