Specialist Supplier of Crystals & Frequency Control Componentssales@mecxtal.com.cn0755-26500570
MERLIN home / Rednote / System Validation and Replacement

Why improving ESP32-S3 RMT resolution can lose longer pulses

An ESP32-S3 fixture measures sensor pulses with RMT and uses a 40 MHz passive crystal. Increasing receive resolution appears to improve short-pulse timing, but a formerly valid 5 ms level disappears. Verify the physical pulse first, then check representation range and the driver's stop condition. A finer tick changes the amount of elapsed time that fits in a fixed-width duration field.

Separate the clock source from the receive tick

Espressif documents the external 40 MHz crystal as a clock-tree source. RMT also has a source selection. In this example the RMT branch is explicitly sourced from the 40 MHz passive crystal. Its receive configuration then establishes an internal tick rate. A displayed 10 MHz resolution means ten million RMT ticks per second, not a change to the crystal. Record the SDK version, source, requested resolution and measured scale. Where another RMT channel is active, check the documented shared resource and clock-source requirements.

One hardware symbol describes two levels. Each has a 15-bit duration and a level bit. Durations are tick counts. The numeric maximum for one field is 32,767 ticks. Do not assume that a long unchanged level automatically becomes several segments that software can reassemble. Inspect raw levels and durations before applying an application decoder. A reported symbol count is also distinct from elapsed signal time.

Test the same signal at two resolutions

Generate a known signal with a 10 µs short pulse and a 5 ms maximum valid level, followed by a longer separating gap. At an actual 10 MHz tick rate, one tick is 100 ns and 10 µs is 100 ticks. The single-field range is 3.2767 ms. A 5 ms level would require 50,000 ticks. Check that limit, then see whether the driver rejects a requested range or the receiver stops early.

At a verified 2 MHz resolution, each tick is 0.5 µs. The short pulse takes 20 ticks and 5 ms takes 10,000. The field reaches 16.3835 ms. Both fit now, with a coarser measurement step. A test that must resolve two widths separated by 200 ns may need another setting or approach. Specify minimum distinguishable width difference, longest valid level and gap separately.

Retain filter and stop settings with the trace

The SDK can reject pulses shorter than a configured glitch limit and stop reception when one level lasts past the maximum. Test these independently. A 5 ms level can fit the duration field and still end reception early if the maximum is 3 ms. At the lower tick rate, choose a driver-validated stop setting above the valid level and below the real separating gap. Sweep narrow pulses separately to verify noise rejection without losing valid data.

A full receive buffer can also shorten a result. Start with a few known pulses, then use the actual sequence length and gaps. Compare the input-pin waveform, raw symbols and application decode. A long level on the pin but absent from raw symbols calls for checking duration and stop. If raw symbols contain it, check grouping and units in the decoder. Change one timing variable at a time.

Check a known 100 µs pulse to establish the count scale, then exercise 4 ms and 5 ms at both resolutions while holding the final gap constant. Readback can match a requested setting without proving the actual conversion. Set limits with acquisition quantization and the protocol tolerance in mind.

A long pulse at the beginning can also be clipped if reception starts late. Mark when the receiver is armed and when the generator triggers. Test the same duration at the beginning and later in the message, then exercise the production startup and wake sequence separately.

If the input crosses an optocoupler or comparator, measure both source and receiving pins. Edge shape and threshold change effective width. Choose the range from the actual input level duration.

Record the 40 MHz passive crystal and RMT source, measured resolution, longest level, end gap and captures. After an SDK change or adding another channel, verify that the requested resolution still holds. Test both the short and long landmarks to demonstrate adequate precision and range.

References

WeChat

MERLIN · TIMING COMPONENTS

Scan with WeChat to contact Sales

Add our WeCom contacts from your usual WeChat app.

On desktop, scan with your phone. On mobile, save the QR image and select it from your album in WeChat Scan.