[HELP] RMT single wire bidirectional communication (dshot telemetry)

Jye___
Posts: 3
Joined: Sun May 05, 2019 11:07 pm

[HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby Jye___ » Sun May 05, 2019 11:30 pm

Hi Everyone,

First post here and its bit of a long one :)

I am looking to use RMT to transmit a 16 bit packet and then receive a 16 bit packet sent back on the same wire. If after reading the below if you have a suggestion for a better method please let me know.

For multicopters there is a flight controller (FC) to electronic speed controller (ESC) protocol called dshot (https://blck.mn/2016/11/dshot-the-new-kid-on-the-block/). Dshot sends a 16 bit packet as defined below for communicating speed and now it can request a packet be sent back with telemetry data e.g. temperature, voltage, rpm, etc (https://github.com/betaflight/betaflight/pull/7264 and https://github.com/betaflight/betafligh ... d_Spec.txt)

Bit length (total timing period) is 1.67 microseconds (T0H + T0L or T1H + T1L).
For a bit to be 0, the pulse width is 625 nanoseconds (T0H – time the pulse is high for a bit value of ZERO)
For a bit to be 1, the pulse width is 1250 nanoseconds (T1H – time the pulse is high for a bit value of ONE)

Previous post I found on the topic (https://www.esp32.com/viewtopic.php?f=1 ... ilit=dshot) but is now old and not dealing with telemetry.

I am able to send dshot packets to the ESC to control the speed (https://github.com/JyeSmith/dshot-esc-t ... tester.ino) but am now looking for suggestion on what would be the best method of receiving telemetry packets sent back???

End goal is to be able to control the speed and read voltage+erpm telemetry. This will allow me to make a KV tester for hand wound motors :)

Thanks for looking

linuxfpv
Posts: 7
Joined: Sun Jan 13, 2019 12:17 pm

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby linuxfpv » Thu May 23, 2019 9:13 pm

Hi, so u r talking of the new bidirectional DSHOT? In this case, did u flash the latest BLHeli Version?
With the old BLHeli Version, the TelemetryData is sent over a serial connection.
Maybe we can work together on the bidirectional DSHOT. Because the ESP32 has too few UART's :

Best Regards
Linus

User avatar
citoyx
Posts: 13
Joined: Sat Sep 28, 2019 10:14 am

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby citoyx » Mon Jun 29, 2020 11:55 am

Any progress to have rmt dual way communication ?

User avatar
citoyx
Posts: 13
Joined: Sat Sep 28, 2019 10:14 am

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby citoyx » Fri Oct 02, 2020 9:21 pm

Would it be possible to attach two rmt channels to on signal gpio so that one is configured for sending and the other one is configured for receiving.

As dshot600 telemetry is very simple : each packet received by ESC with the last bit to 1, requires a telemetry packet answer from the esc on the same wire.

So something like ->
- write dshot packet into channel0 ram
- send packet via rmt using channel0
- end of transmission trigger an interruption to swith to listening to answer on same gpio using rmt channel1 with data accessible in the ram memory channel1 space.
- trigger an interruption at end of listening to clear the memory of channel1 and loop to first step

What do you think ?

For quadcopter usually there are 4esc associated to 4 brushless motors.
therefore with 8rmt channels, it's possible to control and monitor thoses four esc.

My missing point from studying esp-idf code, is to find how channel are associated to gpio pins. And if it's possible to have 2 channels associated to one gpio pins in receiving/transmiting mode

Bastian2001
Posts: 3
Joined: Thu Sep 30, 2021 8:21 pm

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby Bastian2001 » Thu Sep 30, 2021 9:11 pm

Have you found a way yet?
I'm also very interested in using bidirectional DShot in one of my projects, but am failing to do it in a clean manner. Two not so good ways:
1) Use the telemetry wire, the telemetry frame (115200 baud, Serial 8N1) limits you to roughly 1kHz of signal rate, but for your purpose this should be ok (notice: slower erpm updates, no GCR encoding, ...)
2) Use a 1kOhm resistor between two GPIOs. One is the output, one is the input. Now connect the ESC signal wire to the input pin. The input pin will see this:
dshot signal.png
dshot signal.png (3.84 KiB) Viewed 11168 times
. From there, I think you know where to go (GCR decoding etc.)https://brushlesswhoop.com/dshot-and-bi ... nal-dshot/

But if you have found a cleaner (software) solution by using one pin as in- and output, I would be very interested to know, how you did it.
For me, this will be a long going project, so even if you find a solution in a year or more, please reply :)

danirebollo
Posts: 1
Joined: Sat Oct 23, 2021 4:32 pm

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby danirebollo » Sat Oct 23, 2021 4:50 pm

HI,
I'm working on a bidirectional one wire interface between microcontrollers. It is not the best way to interconnect, I preffer I2C, SPI, CAN or other robust protocols, but I needed to use one wire sometimes so I did this: https://github.com/danirebollo/dr_onewire

I'm improving this over the time so please put some issue on github if you found some bug.

Example details:
-In github example sender and receiver is done by different core using FREERTOS tasks pinned to cores.
-To use this library with another microcontroller only is need to change the first lines (HAL) of the dr_onewire.cpp file.

Characteristics:
-Send and receive 16B value or 2x 8B value (command/message)
-Each reception is cheched with parity bit
-Each send is acknowledged by receiver. Otherwise throws an error.

Notes:
-This library uses interrupts, not RMT
-I need to use the standard library folder structure

wjxway
Posts: 15
Joined: Wed Aug 05, 2020 2:52 am

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby wjxway » Wed Mar 13, 2024 7:35 am

Hi! I'm also faced with the issue of using bi-directional Dshot on esp32, is it possible at all? Thanks!

Bastian2001
Posts: 3
Joined: Thu Sep 30, 2021 8:21 pm

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby Bastian2001 » Sat Apr 13, 2024 6:50 pm

@wjxway I have not significantly pursued this any further on the ESP32. I found a way to capture the signal on another ESP32 and decode it successfully. I don't know where I have the code anymore, but regardless, I wasn't able to combine it into one ESP32 due to complications with the interrupt handler. I'm pretty sure it's possible, I just didn't have the knowledge back then.

However, if you want to do this on an RP2040 using its PIO hardware, I recently started my own flight controller project and you can find the code on GitHub: https://github.com/bastian2001/Kolibri- ... hot_x1.pio for the PIO program and here's how you can run the program from your code: https://github.com/bastian2001/Kolibri- ... pp#L81-L82 lines 81-82 (at least today) are writing the data every cycle, the rest is for the returned ERPM. https://github.com/bastian2001/Kolibri- ... p#L77-L136 is used to decode the ERPM packet.

Also, please keep asking for advice in public. I did not even get a notification/email from your DM (I am not even allowed to answer or write DMs in this forum yet), yet if I answered your DM instead of writing a post here, nobody else would be able to see my code (that is, if I had some for the ESP32).

Bastian2001
Posts: 3
Joined: Thu Sep 30, 2021 8:21 pm

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby Bastian2001 » Wed Apr 24, 2024 11:04 am

@wjxway I am not connected to this guy or repo in any way, so I don't have any opinion on this, but I stumbled across it. I know another person successfully using it though: https://github.com/derdoktor667/DShotRMT

wjxway
Posts: 15
Joined: Wed Aug 05, 2020 2:52 am

Re: [HELP] RMT single wire bidirectional communication (dshot telemetry)

Postby wjxway » Thu May 23, 2024 3:39 am

Here's a piece of random code I wrote to achieve bi-directional DShot:

https://github.com/wjxway/ESP32-Bidirectional-DShot

Who is online

Users browsing this forum: No registered users and 72 guests