# DEADLINE\_MISSED in 0.5.2

**URL:** <https://discourse.odriverobotics.com/t/deadline-missed-in-0-5-2/7484>\
**Category:** Support\
**Created:** [July 28, 2021, 12:05am UTC](https://discourse.odriverobotics.com/t/deadline-missed-in-0-5-2/7484 "2021-07-28T00:05:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![grahameth](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/g/48db29/32.png) [@grahameth](https://discourse.odriverobotics.com/u/grahameth)\
**Post date:** [July 28, 2021, 12:05am UTC](https://discourse.odriverobotics.com/t/deadline-missed-in-0-5-2/7484/1 "2021-07-28T00:05:40Z")

</div>

Hi,  
I was having a lot of deadline\_missed failures in 0.5.1 and in the hopes of resolving these, I just ported my code to 0.5.2. Unfortunately, they still happen:

```auto
axis0
  axis: no error
  motor: Error(s):
    MOTOR_ERROR_CONTROL_DEADLINE_MISSED
  sensorless_estimator: no error
  encoder: no error
  controller: no error
axis1
  axis: no error
  motor: Error(s):
    MOTOR_ERROR_CONTROL_DEADLINE_MISSED
  sensorless_estimator: no error
  encoder: no error
  controller: no error

```

They don’t occur immediately, but usually don’t take long to happen, maybe 1-5 minutes.  
I use two AMS absolute encoders and INPUT\_MODE\_POS\_FILTER. The firmware is slightly modified. dump\_timing(odrv0) results in this:

 ![timings](https://discourse.odriverobotics.com/uploads/default/original/2X/a/a059a734212d781ccf8e80e3809448fe06476c95.png)  
But I have no idea what to make of this…  
Does anyone know what might cause this? I can provide more information if needed.

best regards  
grahameth

---

<div class="post-metadata">

**Author:** ![Wetmelon](https://discourse.odriverobotics.com/user_avatar/discourse.odriverobotics.com/wetmelon/32/10_2.png) [@Wetmelon](https://discourse.odriverobotics.com/u/Wetmelon)\
**Post date:** [July 28, 2021, 11:44pm UTC](https://discourse.odriverobotics.com/t/deadline-missed-in-0-5-2/7484/2 "2021-07-28T23:44:12Z")

</div>

> [@grahameth](#):
>
> The firmware is slightly modified.

What changes did you make? And how are you commanding the ODrive?

---

<div class="post-metadata">

**Author:** ![grahameth](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/g/48db29/32.png) [@grahameth](https://discourse.odriverobotics.com/u/grahameth)\
**Post date:** [July 29, 2021, 9:03am UTC](https://discourse.odriverobotics.com/t/deadline-missed-in-0-5-2/7484/3 "2021-07-29T09:03:05Z")

</div>

Hi,  
I changed the reading of the ams encoder so that it wouldn’t fail when the error flag of the encoder is set. Otherwise the odrive would fail with ERROR\_ABS\_SPI\_COM\_FAIL immediately in my setup. I also added a bunch of special cases that trigger when I set some variables, but the deadline-missed error happens even if I don’t trigger that code. So I don’t think that code is related to that. Still, if you want to have a look, here is the code of my firmware, relative to the current 0.5.2 branch:

> <https://github.com/hbuhle2s/ODrive/commit/b2cea193d0beb340d67081cbb1a4916413d2f14e>

I command the ODrive via native protocol and USB from a Jetson Nano. An USB to USB isolator is between the Jetson and the ODrive.  
The controlloop on the Jetson takes about 16ms per frame, and about 10ms of that is spent communicating with ODrive. But there are very frequent spikes where communication takes about 30ms:

 ![Clipboarder.2021.07.29](https://discourse.odriverobotics.com/uploads/default/original/2X/6/6a8dc87882e64ffb26ad703d31fbf90f430ad97a.png)  
Do you think those spikes might cause this? If so, how can I get rid of them?

best regards

---

<div class="post-metadata">

**Author:** ![Wetmelon](https://discourse.odriverobotics.com/user_avatar/discourse.odriverobotics.com/wetmelon/32/10_2.png) [@Wetmelon](https://discourse.odriverobotics.com/u/Wetmelon)\
**Post date:** [July 29, 2021, 11:15pm UTC](https://discourse.odriverobotics.com/t/deadline-missed-in-0-5-2/7484/4 "2021-07-29T23:15:09Z")

</div>

Hmm… Oscilloscope 36k items maybe? If not that, then the watchdog feed returning `any_error()` but I’m not sure that’s wrong.

Btw you don’t need that stack overflow crap for converting types to floats & back. `std::memcpy(&var, &floatVar, sizeof(float))` is defined behaviour. See the `can_helper.hpp` header for ideas. ODrive is little endian btw

---

<div class="post-metadata">

**Author:** ![grahameth](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/g/48db29/32.png) [@grahameth](https://discourse.odriverobotics.com/u/grahameth)\
**Post date:** [July 31, 2021, 2:27pm UTC](https://discourse.odriverobotics.com/t/deadline-missed-in-0-5-2/7484/5 "2021-07-31T14:27:01Z")

</div>

Hi,  
what do you mean about the oscilloscope? I increased the buffersize in my firmware as much as possible. I also added code to compress the floats into 16-bit values and also added code to monitor multiple variables. But the deadline missed error happens before I trigger the oscilloscope, so I don’t think that is the issue.  
I also added get\_any\_errors\_and\_watchdog\_feed, simply to save time while communicating with odrive. This way I can check for errors and feed the watchdog for both axes with one usb command instead of three. But I also don’t see how this can cause this error.

I did some more experiments and found out that odrive doesn’t seem to crash, once I stop the watchdog timers and all usb communication (but the motors keep running). Of course this is not conclusive, but it seems plausible that usb communication causes the error. Does anyone know how I can profile the communication stuff? It doesn’t seem to appear in dump\_timing(odrv0).

My theory is, that the lowest level of the usb stack randomly keeps resending packets due to EM noise. Does anyone know where this code is and how I can change it? Maybe the timeout is configurable?

best regards
