Hey, I'm trying to spin a brushless motor with an ESP32. I got DShot to work using the RMT peripheral.
Now I need the RPM of that motor. Ideally, I want bidirectional DShot. But how does that work?
I've seen that I need to send something like a 32-35 via the signal line to get that as a response. But in which format do I get it back? I can't find anything about the logic I have to read out and so on.
I don't have a logic analyzer to check the output of the ESC and surprisingly the internet seems to not have any information/documentation on that at all.
I get tons of info on how to enable that in betaflight/cleanflight/ArduPilot but not how the protocol works.
At least for now, the secret is the protocol itself, not necessarily how to read it with DMA or thing like that.
@robin2 DShot is a digital protocol for sending data quickly to the ESC. DShot 300 works at 300kbit/s for example. Roughly speaking, for every bit you want to transmit you transmit 3 parts. You transmit a logic HIGH LOW LOW sequence to transmit a 0 and for a 1 it is HIGH HIGH LOW. That way, it's a one wire interface. For DShot 300 one of these sequences is 1/300th of a millisecond in length, meaning that one HIGH or LOW is 1/900th of a millisecond.
One DShot command consists of three packages: 11 bits data, 1 bit telemetry request and 4 bit CRC checksum (just XOR the previous 3 nibbles).
The RMT peripheral on the ESP32 is used to transmit data very quickly. You have an 80MHz clock for that and a division factor. Then you can write data to your RAM and it'll spit out one bit from RAM each (1/80,000,000)/clk_div seconds. That way you can somewhat easily write data very quickly to your GPIO pins without using digitalWrite()