I have some questions about the size of memory used by the RMT peripheral. (BTW, the RMT peripheral, as well as the LEDCPWM, MCPWM, and PCNT peripherals are AWESOME! I plan to use them for simultaneous servo, dc motor, and stepper motor control. I am astounded at the power contained in the ESP32 chip!)
The Technical Reference Manual says each of the eight RMT channels has a 64x32-bit block of memory. It also says users can extend the memory for a particular channel to use the blocks of subsequent channels. This implies that the maximum amount of memory a channel can have is 512x32-bit, and that only for channel 0.
The ESP-IDF Programming Guide also says the 8 channels share a 512x32-bit RAM block.
So apparently the maximum amount of memory allowed by a single channel is 512x32-bit, and that only for channel 0 and only if the other channels are not used.
However the Programming Guide also says the rmt_write_items function is able to send waveforms of any length. I LIKE THIS! But this seems to conflict with the earlier memory specifications. Which is correct?
Both documents indicate the memory is read over the APB bus. What is this bus? I haven't been able to find much documentation about it.
I have also examined the rmt_nec_tx_rx example which is located in the esp-idf/examples/periperals folder. This example uses a 3400x32-bit block of memory for channel 1. This is significantly larger than the 448x32-bit memory space allowed for channel 1. Yet the example works fine, confirming that the documentation for the rmt_write_items function is correct. I haven't yet tried to use more than one channel using this technique. I hope it works as I would like to use this technique to control up to eight stepper motors.
But why does this example work at all when it uses much more memory than what the documents say can be used? Does the rmt_write_items function use some other memory access method to eliminate the restrictive memory limitations of the APB bus (whatever that is)?
Clark
Questions regarding RMT memory size
-
- Posts: 9761
- Joined: Thu Nov 26, 2015 4:08 am
Re: Questions regarding RMT memory size
The trick used in the driver is that you can configure the memory reading process to 'wrap around', that is, if it arrives at the end of the memory allocated to the channel, it starts over again. That can be combined with another feature which allows you to trigger an interrupt when a certain amoun of data is sent, which can be set to e.g. trigger when the data for a channel is halfway sent: when this happens, if you're quick enough, you can replace the first (sent) half of the memory with more data. As soon as the RMT has processed all the data in the second half of memory, it re-starts at the beginning, where you just put more data. It also triggers that interrupt again, which now replaces the 2nd half of memory with more data. It's effectively a trick to send a very large amount of data using a limited hardware buffer.
The APB bus is an internal bus between the memory/cpu and peripherals. For programming the RMT, it doesn't really matter, it's just an implementation detail.
The APB bus is an internal bus between the memory/cpu and peripherals. For programming the RMT, it doesn't really matter, it's just an implementation detail.
Re: Questions regarding RMT memory size
Thank you for your quick and thorough response!
Who is online
Users browsing this forum: mensbufo and 119 guests