Capturing long stream of pulses with RMT?
Posted: Fri Jun 23, 2023 8:26 pm
I have an application where I need to capture just the time between low-going pulses on a GPIO. The pulses come from a sensor that is proportional to the event it is monitoring. The pulse width can range from 2.000us to 20.000us, and has a 25ns resolution.
It seems that the RMT peripheral should be able to capture up to a 12.5ns resolution with CLK_DIV=1 (2 would be 25ns), but the number of samples is limited to some buffer that is built into the periphera (64 x 32 for each block)l. I need to capture 300,000 samples at a time (and will need to play those back, but I will leave that for later). There is 2MB of PSRAM in the ESP32S2 that I am using, which is plenty of space to hold the samples.
Is it wrong to believe that it should be possible to start a capture and then copy the 32 bit capture times into the PSRAM? I don't see a hardware based ping-pong where it would generate an interrupt after every buffer switch. I only see an interrupt for every single pulse capture. I know that the PSRAM is theoretically capable of storing the data fast enough, but is 2us too short of a period for handling the interrupt every single capture (even if using assembly code)?
Is there a better solution for this than the RMT?
I would appreciate any feedback on this. Thanks!
It seems that the RMT peripheral should be able to capture up to a 12.5ns resolution with CLK_DIV=1 (2 would be 25ns), but the number of samples is limited to some buffer that is built into the periphera (64 x 32 for each block)l. I need to capture 300,000 samples at a time (and will need to play those back, but I will leave that for later). There is 2MB of PSRAM in the ESP32S2 that I am using, which is plenty of space to hold the samples.
Is it wrong to believe that it should be possible to start a capture and then copy the 32 bit capture times into the PSRAM? I don't see a hardware based ping-pong where it would generate an interrupt after every buffer switch. I only see an interrupt for every single pulse capture. I know that the PSRAM is theoretically capable of storing the data fast enough, but is 2us too short of a period for handling the interrupt every single capture (even if using assembly code)?
Is there a better solution for this than the RMT?
I would appreciate any feedback on this. Thanks!