DShot Implementation

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

DShot Implementation

Postby linuxfpv » Sun Jan 13, 2019 12:35 pm

First of all, hello forum, it's my first post here.

Maybe some of u will know, what DShot is, some not.
DShot is a digital protocol to communicate with ESC's (electronic speed controller). Sadly there is no official document, but this is the best description i found: https://dmrlawson.co.uk/index.php/2017/ ... -the-dark/.
So this protocol is pretty similar to the one used for WS2812 LED's. The only difference is, that DShot needs to be sent repeatedly, as WS2812 only, when the LED's need to change.

My first implementation is using a UART, where I mimic the timings of 1/4 high and 3/4 low(0) and 3/4 high and 1/4 low. But the problem is, that in this implementation the cpu has to send the bytes to the UART every 250 Microseconds, thus, the ESP crashes with the error: Core 1 panic'ed.

So I'm pretty new to the ESP32 and also never implemented such a protocol before, but my Idea is, that the CPU calculates the Bytes to send, saves it in RAM and then E.g. the message is sent over and over again (without using the CPU), until it is changed by the CPU.
Is this possible, that the DMA-Controller sends the same Bytes repeatedly?

Important to note: I don't want to use bitbanging, as I need to computate other things in parallel.

Best regards,
Linus


ESP_Sprite
Posts: 8921
Joined: Thu Nov 26, 2015 4:08 am

Re: DShot Implementation

Postby ESP_Sprite » Mon Jan 14, 2019 2:56 am

Also do take a look at the RMT peripheral, it may do what you need.

permal
Posts: 384
Joined: Sun May 14, 2017 5:36 pm

Re: DShot Implementation

Postby permal » Mon Jan 14, 2019 9:44 am

linuxfpv wrote: ....UART every 250 Microseconds, thus, the ESP crashes with the error: Core 1 panic'ed.
Sending data on UART shouldn't cause a crash, there is something else causing that. And like what ESP_Sprite wrote, the RMT perpherial is good fit for these kinds of tasks.

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

Re: DShot Implementation

Postby linuxfpv » Mon Jan 14, 2019 9:46 pm

Thank u all for u'r suggestions.
Found the problem. I was saving the BaudRate, which needs to be 600k in a uint16_t. Thus, the uart couldn't keep up with the interrupt, causing the crash. I found it by using a oszilloscope and looking on the exact timings. Furthermore, I tested the protocol for the delay between the 2 Bytes and 500Hz Update Rate is more than enough in my case (instead of the 4kHz i found on the internet). If anyone is interested in the code, send me a PN.

HenryHutch
Posts: 1
Joined: Mon Jan 21, 2019 1:26 am

Re: DShot Implementation

Postby HenryHutch » Tue Jan 22, 2019 6:48 pm

Hi, I am very interested in your code! Unfortunately I can't message you on here because I am a newly subscribed member! Is there any way you could message me first?

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

Re: DShot Implementation

Postby Jye___ » Tue May 07, 2019 1:59 am

Another new user here who cannot PM you.

Have you posted your code in a repo? Do you have it working with dshot telemetry?

Ive started to look at it with RMT but am also having difficulties understanding how to receive the dshot telemetry.

http://bbs.esp32.com/viewtopic.php?f=19 ... 6d97af393e

Cheers

clingmanr
Posts: 1
Joined: Sat Aug 22, 2020 6:29 pm

Re: DShot Implementation

Postby clingmanr » Sat Aug 22, 2020 6:32 pm

linuxfpv wrote:
Mon Jan 14, 2019 9:46 pm
If anyone is interested in the code, send me a PN.
Here is one more new user that would be interested in that code.

markxr
Posts: 15
Joined: Sun Aug 16, 2020 7:32 pm

Re: DShot Implementation

Postby markxr » Tue Aug 25, 2020 9:23 am

I have Dshot working, using the RMT peripheral.

Currently the status is a hacky test-program, but it does the following:

* Initialise a brushless esc settings some parameters
* Send dshot speed commands every few ms
* A UDP socket listener receives UDP packets and changes the motor speed accordingly.

This is a test-program and not indicative of production quality.

https://github.com/MarkR42/robotbits/tr ... /esp32test

Look at motors.c for the Dshot part.

Who is online

Users browsing this forum: No registered users and 148 guests