-
Notifications
You must be signed in to change notification settings - Fork 7.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
fix(rmt): set rx filter resolution_hz to rmt_sclk (IDFGH-13418) #14325
base: master
Are you sure you want to change the base?
Conversation
Fixes assignment of `filter_clock_resolution_hz` to `rx_channel->base.resolution_hz`, which is the clock frequency after the fractional divider `RMT_SCLK_DIV` (also referenced as `rmt_sclk` in the TRM), instead of the previously used value from `group->resolution_hz`, which represents the full undivided frequency from clock selected by `RMT_SCLK_SEL` (APB, RC_FAST or XTAL). Before this fix, this mixup resulted in error `signal_range_min_ns too big` returned by the `rmt_receive` function due to the check at https://github.com/espressif/esp-idf/blob/8e4454b285ad39881c5bf3f440d8be617a2f18a8/components/esp_driver_rmt/src/rmt_rx.c#L410-L413 failing no matter the `resolution_hz` used in configuration of the channel.
👋 Hello LonerDan, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
NOTE: I couldn't verify this fix's correctness for the ESP32-C5 and ESP32-P4, since I could not find their TRMs (I suppose those are not available yet). |
Hi @LonerDan I'm afraid this is not a mistake. The RX channel can filter out glitches in the signals, so it needs a high frequency base clock. The hardware uses the group's clock as the filter's tick clock. |
Hi @suda-morris
If that's not really the case, It could be beneficial to clarify this in the documentation. |
@LonerDan The |
@suda-morris Ah, I see. Thank you for the correction. I looked closer into the source code and found the part where the esp-idf/components/esp_driver_rmt/src/rmt_common.c Lines 210 to 214 in 8e4454b
In my opinion, this should be configurable since the resolution of the filter is application-specific. In my case, the signal has shortest pulse length around 12 us and there is a lot of short spikes/noise mixed in, so I would like to filter out anything less than say 8 us to limit the number of data rmt rx channel generates for me to process. I am willing to try to implement this, I just wanted to ask where you think is the best place to incorporate this parameter into? Not sure if rmt_rx_channel_config_t is the correct place since the sclk divider is common to the group.
|
Fixes assignment of
filter_clock_resolution_hz
torx_channel->base.resolution_hz
, which is the clock frequency after the fractional dividerRMT_SCLK_DIV
(also referenced asrmt_sclk
in the TRM), instead of the previously used value fromgroup->resolution_hz
, which represents the full undivided frequency from clock selected byRMT_SCLK_SEL
(APB, RC_FAST or XTAL).Before this fix, this mixup resulted in an error
signal_range_min_ns too big
being returned by thermt_receive
function due to this check failing no matter theresolution_hz
used in the configuration of the channel.