-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
pulseio.PulseIn maxlen is limited to 128 in esp32 #9234
Comments
|
Its been a little while since I wrote this code. I think my intent was to limit the maxlen to the amount the RMT peripheral can buffer. I didn't want to assume PSRAM was accessible when PulseIn was running. (Writing the filesystem will disable it temporarily.) I think some RMTs can use multiple channels worth of memory if needed. That could improve things. Note each RMT word stores two "pulses" one active and one inactive. That's why 64 words give a length of 128. |
Thanks for your comment. This is a difficult area to understand for me, but I found an article that might be relevant. It seems that chips with the feature SOC_RMT_SUPPORT_RX_PINGPONG can handle more data than buffers. |
Not to muddle up this topic but I also noticed a maxlen limit of 128 pulses on an ESP32-S3 QTPy no PSRAM. My main issue was that PulseIn doesn't work at all to capture a set of pulses (<128) from a constant pulsed data stream. Details here |
So how to get continuously pulses and store them in an array without missing any? |
Raise an exception to note the limitation. |
CircuitPython version
Code/REPL
Behavior
prints "128"
Description
It is possible that this is an intended specification, but I am reporting it.
I have a HITACHI air conditioner remote control data (848+6 data length) being read by pulseio.pulseIn. Regardless of the maxlen I gave it, it only read a maximum of 128 data.
I looked into the cause and found the following code in ports/espressif/common-hal/pulseio/PulseIn.c#103 .
When I delete the MIN(64, x) calculation as follows, the behavior differed depending on the CPU.
The ESP32S3(M5 AtomS3) and ESP32C6(M5 NanoC6) received all 854 data as desired, but the ESP32-PICO(M5 Matrix) still had 128 data. This seems to reproduce #7352.
Is MIN(64, x) required by some constraint? If almost esp32 chips can receive more data, I would like to receive it.
Additional information
No response
The text was updated successfully, but these errors were encountered: