-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Recent LPC "toggle" change breaks multi-driver axis configs #27341
Comments
Same issue with mks sgen l v1 |
If you disconnect the first motor but do not remove the driver, the second motor remains in the brake mode or something like that. Also, the second motor works properly if you remove the Z1 driver. |
#27489 is a duplicate of this issue. I, too, have dual Z axes and TMC2209 but do not have the problem. The primary difference that I can is is that I am running on 8 bit AVR and all those reporting the problem have LPC1768. Looking at the code, |
@tombrazier TOGGLE was recently changed on the LPC176x #27149 ... |
Okay, @moriamoria, @anomalchik and @Sanguium here is something to try: Change the file Remove and replace it with Does this resolve the problem? I have a bunch of mainboards but no LPC1768 to test on. |
Hello, I have kill my SKR 1.3 motherboard, the X- Y- pullup end switch seems dead ! I have order a new SKR 1.4 turbo, and i will do the test when I receive it. Thanks for your support Regards |
Tested with latest bugfix, this change does fix the problem. Thanks. |
I think I have found the race condition. Function The function is
Reading chapter 9 of the LPC1768 user manual (a copy can be found here) this function reads As a consequence, when two pin toggles occur in quick succession the second read of the pin state can happen before the pin has actually changed after the first toggle operation (at least this is my working theory). I think the function should be modified to:
If there is anyone who is able to find their platformio directory (on Linux it is Also any comment by @p3p would be appreciated. |
@Sanguium Yes you can keep it until a fix is merged. The difference is slightly less clean step timing, but that's way better than steps not actually happening. PS If you're able to test the change to |
This also works. |
Excellent. So the solution is to submit a PR to @p3p's LPC1768 framework. I would appreciate pretty wide testing, I wouldn't want to break a the framework accidentally. |
Sorry for #27149 opening up a can of issues. @tombrazier Great investigation!
That's also my read of the code and the reported issue. Z step pin gets toggled with I think the proposed solution: [[gnu::always_inline]] inline void toggle() {
gpio_reg().reg_control = gpio_reg().reg_set ^ gpio_mask();
} is correct to fix |
@mh-dm Do you have an LPC mainboard you could do some testing on? I'd like to see this tested fairly widely considering it affects the underlying framework. |
I'll try to check it today. |
@tombrazier |
@anomalchik Thanks. |
Sure. Tested in the same scenario as in #27149 and can confirm that the proposed |
Thanks Mihai. |
Did you test the latest
bugfix-2.1.x
code?Yes, and the problem still exists.
Bug Description
When activating a second Z driver and EDGE_STEPPING, the first Z motor grinds and loses steps, while the second works fine.
All other axis work fine, problem goes away when disabling the Z2 driver OR disabling EDGE_STEPPING.
This is the M122 report after moving Z 10m up with and without EDGE_STEPPING enabled:
EDGE_STEPPING OFF:
EDGE_STEPPING ON:
Using SKR v1.3 with TMC2009 drivers
Bug Timeline
Tested wrong in 2.1.2.4 and current bugfix-2.1.x
Expected behavior
Dual Z drivers work fine with the recomended EDGE_STEPPING for trinamic drivers
Actual behavior
First Z motor rattles and loses steps
Steps to Reproduce
Z_DRIVER_TYPE TMC2209
andZ2_DRIVER_TYPE TMC2209
EDGE_STEPPING
Version of Marlin Firmware
Commit 0ec1a54
Printer model
Custom cartesian
Electronics
SKR v1.3 board with TMC2209 drivers
LCD/Controller
BIGTREE_TFT24_V1_1
Other add-ons
No response
Bed Leveling
None
Your Slicer
None
Host Software
None
Don't forget to include
Configuration.h
andConfiguration_adv.h
.Additional information & file uploads
Config.zip
The text was updated successfully, but these errors were encountered: