What happens when RMT receive overflows?

Timmmm
Posts: 2
Joined: Wed Jun 05, 2019 12:54 pm

What happens when RMT receive overflows?

Postby Timmmm » Fri Jul 26, 2019 5:49 pm

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!

CollinK
Posts: 18
Joined: Mon Apr 16, 2018 11:38 pm

Re: What happens when RMT receive overflows?

Postby CollinK » Sat Nov 23, 2019 1:00 am

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.

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: What happens when RMT receive overflows?

Postby WiFive » Sun Nov 24, 2019 11:53 pm

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.

CollinK
Posts: 18
Joined: Mon Apr 16, 2018 11:38 pm

Re: What happens when RMT receive overflows?

Postby CollinK » Mon Nov 25, 2019 1:11 am

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.

Who is online

Users browsing this forum: No registered users and 55 guests