I can't see in the reference manual but when you trigger a receive with RMT and it receives more than 128 edges (or however much you have given it space for), what happens? Does it just stop? Does it trigger an interrupt? Does it loop back to the start?
My use case is accurately measuring the duty cycle of a ~1 kHz square wave. If there's a better way let me know!
What happens when RMT receive overflows?
Re: What happens when RMT receive overflows?
In your example what happens is that the first 128 transitions are saved then NOTHING HAPPENS until the signal line goes idle. At that point the interrupt happens and the first 128 transitions are available to you. What happens to the rest? They're silently thrown away with no indication at all! Isn't that lovely?! This is a huge limitation of the RMT hardware. The documentation seems to admit that the hardware storage for RMT is too small and of course people would want to do buffering in RAM to build up larger signals. They failed badly at that task. The hardware should cause an interrupt when the buffer fills so you can immediately grab the data. Of course, for fast signals you won't have enough time to copy the whole thing out of hardware to RAM. So, really it ought to interrupt at the half way point and then you can copy half buffers at a time ping ponging back and forth so that you're always reading the other half of the buffer while the hardware writes to the one half.
Anyway, it's pretty limiting.
Anyway, it's pretty limiting.
Re: What happens when RMT receive overflows?
Yes it should have been designed for continuous receive with threshold just like tx, not sure if they fixed this in S2 design. However you can assign more memory blocks to a channel if you are not using them all.
Re: What happens when RMT receive overflows?
Yeah, you can allocate more buffers. But, the problem with that is that it still isn't always good enough. Let's say I need to receive 1000 bits. This will generate 2000 events and exceed even the full 8 buffers (1024 records total). I tried looking for any info on RMT with the ESP32 S2 and as far as I can find it appears to be the same thing but now with half as many buffers. That doesn't give me hope that it would be more suited to my uses so it does look like additional creativity is in order.
So, I have some ideas but I would have rather not had to do them. That's life I suppose. I am trying to use the RMT hardware for purposes it was not designed for. I guess I can't expect everything to be perfect in that case. But, maybe I can figure out something.
So, I have some ideas but I would have rather not had to do them. That's life I suppose. I am trying to use the RMT hardware for purposes it was not designed for. I guess I can't expect everything to be perfect in that case. But, maybe I can figure out something.
Who is online
Users browsing this forum: No registered users and 100 guests