Replies: 4 comments 5 replies
-
Did you try to use machine.time_pulse_us()? |
Beta Was this translation helpful? Give feedback.
-
With the ESP32 the RMT devices would be optimal for your case, bit RMT read is not implemented. So the only chance I see is busy polling into a data buffer with IRQ disabled after the first IRQ and then decoding the 0/1 pattern, which is not elegant. And the ESP32 is notoriously slow in responding to IRQ. A RP2040 might do better, because you can use the PIO to do the work. |
Beta Was this translation helpful? Give feedback.
-
If your application allows it, I'd use the method explained in 5.7 of the application note. That way you could start sampling with the ESP32 shortly at a known time before the data arrives, wasting less time and not depending on a fast ISR. But this has other drawbacks, too. |
Beta Was this translation helpful? Give feedback.
-
This is difficult on an ESP32 because it supports only soft IRQ's. If you could use a Pico or a Pico W you'd be better placed. On ESP32 there is another possible approach. A complete frame takes ~2.6ms: you could use the IRQ to start a decode which then polls the pin. This means that the ISR blocks for 2.6ms but you avoid the overhead of handling the slow and variable IRQ response time. Delays in responding to that initial high to low transition might mean you get occasional parity errors, but I think you could make a workable decoder using polling. |
Beta Was this translation helpful? Give feedback.
-
I'm trying to implement temperature readings from a TSic 506F using the ZACwire protocol. This requires measuring the length of low pulses lasting either 20-40 microseconds or 80-100 microseconds.
I tried doing so using IRQ callbacks but it seems to take ~70 us just to read the state of a pin using
pin.value()
, so I suspect my approach is flawed, and I couldn't find an existing library for micropython. Does anybody have suggestions on the best strategy to achieve something like that?The TSic sensors are nice for scientific projects because of their high accuracy.
Beta Was this translation helpful? Give feedback.
All reactions