Why is the srtt I calculated negative

Basic Information:

Printer Model:
MCU / Printerboard:
Host / SBC
klippy.log

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:


Hello @lss !

Also: Describing your issue in the topic is not enough.
We need more background information. Always descibe your issue with more details in the post.

Thank you.

3 Likes

klippy.log (632.7 KB)
Sorry, my log is here

Sorry, but this report does not really make any sense:

  • Klipper sources seem to be modified in core areas like clock syncing.
  • You provided no context regarding any modifications, their goals, etc.

Thank you for your response,

I am using a baud rate of 115200 and have not made any modifications to the time synchronization. The printed model is complex, and at a fixed time, there will always be negative rtt values, followed by timer too close. I have also checked the clock sending and receiving times for time synchronization, and it seems that they are not using the same time source? This negative rtt will only appear when I print it

And I use other upper computers with the same configuration and lower computer Gcode, This problem can still occur

Starting Klippy...
Args: ['/home/linaro/klipper/klippy/klippy.py']
Git version: 'v0.12.0-762-gf61e8721-dirty'
Modified files: klippy/chelper/serialqueue.c, klippy/clocksync.py, klippy/klippy.py, klippy/serialhdl.py, scripts/whconsole.py
Branch: master
Remote: origin
Tracked URL: https://gitee.com/miroky/klipper.git

This is from your log. We do not support unofficial versions with unknown modifications unless one can demonstrate that the same error also occurs in the pristine Klipper mainline.

For debugging purposes, I modified the parameters that should have been input on the command line and added some print() to debug, without making any changes to the working logic of Klipper

As stated above:
We only support Klipper versions with unmodified sources from the original repository.

Klipper is sensitive to code modifications, especially in the “hot” areas. Hunting for bugs that come from careless modifications makes no sense.

klippy-1227.log (366.1 KB)

This is the log generated from my latest clone code,please help me check it.

I increased the baud rate from 112500 to 250000, which solved the problem of negative values

But I can’t see from the code why the baud rate is low. During the process of printing complex models, there will be negative values for rtt

You are getting timer too close, because PWM arrives to MCU later than it should.
Looks like your system is overloaded


I don’t think this is related to printed models in any way.

I think it is more about the resolution of Gcode and host processing power.

So, you can either play with slicer settings or slow down your printer.

Thank you for your answer,but the system load calculation is not correct.Due to a problem with my wireless driver module ,ther are five processes in state D.Therefore,the system load after booting is above 5,but the CPU is very idle.As shown in your picture, i think the reason for the timer too close is due to communication load. i doubled the baud rate and the problem was solved.i’m even more curious why alow baud rate causes the RTTcalculation tobe negative. i can’t see the problem from the communication code.


This is just my speculation.
eventtime afaik should be propagated from klippy to C,
last_receive_sent_time- should be received from the response.

Your bus is overloaded, so possibly the receipt is delayed more than expected, so the delta is negative.
Which can make srtt negative

sq->srtt = (7.0 * sq->srtt + delta) / 8.0;

thank you for your reply,but i think the negative delta is impossible,

The serial port receiving time of the sending queue should not be earlier than the MCU’s reply time, which is the eventtime of update_deceive_seq.
so i think delta = eventtime - sq->last_receive_sent_time is a constant positive number