-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Multi mcu homing #3956
Multi mcu homing #3956
Conversation
7023066
to
5b1a2bd
Compare
I have modified Pontus great toolboard tiny design, changing to use STM32G04 mpcu & easy high voltage inductive probe connection. G04 for FD-CAN mainly (expect another PR on stm32g4 support ;) ) During rebuild of one of my Voron I plan to use set of 7 huvud boards:
Everything connected using something similar to ring network with CAN / FD-CAN and talking to RPi Zero via USBCAN dongle as Pontus suggested (CAN2) for the beginning. WIll that be a good test bed for this PR? |
FYI, that's similar to my current setup. I have a voron 2.4 with 3 huvud boards - one on the toolhead and two controlling the corexy motors. I did purchase additional huvud boards with the intent of converting the Z motors to them, but ultimately decided to use a low-cost skr board for the Z instead (I'm using the skr-mini-mz). I'm not sure which USB2CAN board you are planning on using, but I would not recommend purchasing the innomaker board. It is reordering packets and it appears the stm32 chip on it has been been locked down so that no firmware fixes are possible. -Kevin |
Well, I have discussed that with Pontus and he gave me some insight on that toopis. Citing him: Ultimatelly I can design and order from JLCPCB such a simple dongle having only F042 & FDCAN tranceiver. |
Looks like really useful code with some interesting problems to solve, and I'd love to try it out. One Q: Do you have any sense for the amount of inaccuracy to potentially expect, related to known issue 1 above? Presumably, as long as the time between triggering an endstop and detecting the change is small... but what would that amount potentially be? Thanks! |
it's timing based, so it depends on your homing speed. assuming up to 25ms, this means 0.25mm at 10mm/s, 0.5mm at 20mm/s... |
Unfortunately, the STM32F042 is out of stock virtually everywhere right now. You will need to use a G0/G4 with CAN and write some custom firmware. Fortunately a decent amount of candleLight is portable. |
5b1a2bd
to
6025f0e
Compare
I've got a Huvud doing all it needs to print, and this would remove 2 wires used for the X endstop. I've added those notes here: ... but I'm hesitant to try out these branch. @KevinOConnor - would you be up to rebase this on master now that the CAN improvements are merged? Thanks for those improvements, BTW. Worked great for me on the first try today. This would be icing on that cake. |
6025f0e
to
9460195
Compare
FYI, I rebased this branch. Note though, that accuracy problems are still present - I would not recommend using multi-mcu homing/probing on Z. -Kevin |
@KevinOConnor Will it be a general problem using multi-mcu for z probing, or is it just for now, and will it be possible to fix in near feature? Really looking forward for this feature :-) |
This branch is still very much a "work in progress" - its intended audience is other developers. I hope to fix all of its deficiencies. I'll only merge it into the master branch when it is ready. -Kevin |
tl;dr: Works For Me. I rebased atop today's master w/no issues, recompiled for a Huvud and an SKR to get past an endstop format error, restarted to avoid a
... and homing seems to work fine. 2 more wires down on the toolhead. Thanks! |
9460195
to
9c2c218
Compare
I have rebased this branch and made several improvements:
This new code should, hopefully, be testable on a number of different printers. However, there are still some caveats with this code:
This code continues to use a 25ms max timeout when implementing multi-mcu homing. That is, when using multi-mcu homing/probing, it is possible for the carriage to continue moving even after the endstop/probe has signaled. For example, if homing at 10mm/s then the carriage may overshoot by as much as .250mm. This timeout is not configurable, and I'm leaning towards not making it configurable (it's unclear that a user can reasonably choose an alternate setting). The new code will determine the overshoot and (assuming it does not cause a mechanical failure) it will be accounted for - so the overshoot should not negatively impact accuracy. If you run tests with this new code, please let me know your results (success or failure). -Kevin |
@KevinOConnor I tried out the updated branch, and the code no longer works for me. With the printer in the middle, X and Y homing work fine. But then at the extent of motion (back right), with endstops already triggered, when Y or Z homing is triggered, I get a 'move out of range' error and motors shut off and make a horrible skipping noise:
This is a CoreXY w/slight-less-than-120mm square bed (Voron 0). Probably relevant: ` [stepper_y] It does look like the code is compensating for the variability, as I can see the X value varying between 118.03-118.05 after X-only homing. Increasing position_max a bit doesn't seem to help. To revert, it looks like I'll have reload the firmware on the SKR and the Huvud... argh:
At least I'm now saving the SKR firmwares, so the build/menuconfig cycle doesn't add delay. |
@KevinOConnor I tried out the mult mcu homing. While homing Y everything works as normal Im getting:
Im Using a 500kbit CANbus for both MCU's |
Okay - that will need to be fixed. In the interim, you should be able to update the homing sequence so that each axis is individually homed and then backed away from the endstop prior to homing any other axis.
Not sure why you'd get skipped steps in that case though. -Kevin |
Okay, thanks. The code definitely did something wrong. I'll try to track it down. -Kevin |
@KevinOConnor For whatever reason, the code drives the motors when already homed, in either +Y or +X, which would both trigger skips. I can test this without the motors actually connected if that would help, to see if this is CoreXY-specific, without the horrible noises. Let me know if that would useful; should be easy enough after reflashing the code. Has this code been tested on CoreXY yet? Thanks. |
Yes - I tested the code on my voron 2.4 printer. Multi-mcu homing with each xy stepper on its own huvud board. -Kevin |
9c2c218
to
26f6d87
Compare
I've rebased this branch and fixed some bugs. I think the "timer too close" issue should now be fixed. There is still the issue of an overshoot during homing causing "invalid move" errors. To workaround this issue for now, either 1) always back off from the axis after homing it, or 2) increase the position_min/position_max of the axis so that the valid range is a little past the position_endstop. -Kevin |
26f6d87
to
c2cfb18
Compare
Can confim the "timer too close" issue is fix works now fine for me. |
65d276a
to
7bb78e9
Compare
@KevinOConnor Hi, Kevin. I run into homing issue too. First i move the head to the middle of machine, then do QUAD_GANTRY_LEVEL. When finished, i do G28, then it tell me "!! Move out of range: 350.038 345.000 10.000 [0.000]". After that i try more commands like "G28 X" "G28 Y" "FIRMWARE_RESTART" "RESTART", finally it can home now. I give you my log, hope it will help you debug. |
7bb78e9
to
6571a72
Compare
@Tircown @KevinOConnor I'm running this branch on a printer with hybrid-corexy kinematics (IDEX) and two CAN Huvud toolhead boards. The X enstops are mounted to the toolheads and routed through the Huvud. When I try to home X, the first toolhead moves toward the left (X0) as expected, triggers the endstop, retracts, and triggers it again. However, when it triggers the second time, I get the following error:
If I switch the first toolhead to a sensorless X home and leave the second toolhead with the toolhead MCU endstop, the first toolhead homes properly, but the second toolhead errors out in the same way as the first case (triggers the endstop once, retracts, and faults out the second time it homes). I tried slowing down the triggering and slowing down the retract speed (to add a bit more delay before it homes the second time), but it didn't change the case. I assume something is interacting between the IDEX X axis homing routine and the multi-mcu homing. For now I'll just run extra wires for the X endstops, but I wanted to document it for reference. |
@Tircown's pull request fixed the issue with idex_modes.py! |
6571a72
to
8912076
Compare
@GerogeFu - sorry I missed your message earlier. I'm not sure why that would be. It is possible on this branch for the toolhead to nominally end outside the build area with this change. But, I'm not sure what would lead to getting the "move out of range" error. If you can recreate, can you issue an Separately, it should be possible to avoid the issue by changing your start scripts to move to a valid position after a -Kevin |
FYI, I plan to merge the next set of changes on this branch. I plan to merge the "homing based on timing" part of this change in the next few days. The current Klipper code calculates the home position based on where the steppers are located after homing - with this next merge Klipper will calculate the home position based on the time that the endstop switch triggers. The above merge will not include multi-mcu support, but the remaining changes after that are small. -Kevin |
8912076
to
3a73497
Compare
Since 3814a13 I've seen a couple reports from Voron users of "move out of range" errors after homing. Instead of requiring changes to the post-homing procedure as mentioned in Config_Changes, I think this could be solved by having the homing routine itself move the toolhead back to the endstop position. Would this be a difficult thing to do? |
If anyone is getting strange "move out of range errors", please make sure you are on the latest code. If the problem reoccurs, run There are workarounds possible, but I'd prefer to have a good understanding of why these errors are occurring before deploying a countermeasure. -Kevin |
Am I correct that this has now been fully pushed to the main branch? If so, how do I switch back to that branch? |
My Voron 2.4 runs on a single Spider board. I ran into this Let me know if you need more testing from me. -Li Jiang |
As Kevin mentioned “The above merge will not include multi-mcu support, but the remaining changes after that are small.” so not fully merged yet. If you want go Bach to master ssh in your pi: |
He said that in reference to "the above merge", but the next day he merged
I don't want to go back to the master unless it supports multi-mcu homing, but it's not clear to me. |
247bb64
to
2893e83
Compare
Support endstops and probes attached to a different micro-controller than their associated steppers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2893e83
to
9504778
Compare
FYI, I just merged the last of the changes on this branch in to the master branch (commit 9504778). Of the original issues identified, the -Kevin |
Thanks Kevin! This is really exciting, as it means I can put both a Z probe (Klicky) and the X endstop togther on a toolhead board (Huvud), and not be managing off-master code. 4 toolhead wires go away, bringing the total from 9 down to 5 for me (CANH, CANL, 24V, 5V, GND). Nice. And a Q re: the mutli-stepper axis limitation... I've never seen a >1-stepper printer board that doesn't have at least 4 drivers, and even with QGL or TBL you're covered. Is the current limitation you describe only going to affect those with individual-motor boards on each Z axis then? Unless we live in a future with single-motor-integrated toolhead boards, I can't think of a use case. |
The huvud .6 has 5v on it and support for up to 3 probes it can make you
drop to just 4
…On Mon, Aug 30, 2021, 4:48 PM Brandon Heller ***@***.***> wrote:
Thanks Kevin! This is really exciting, as it means I can put both a Z
probe (Klicky) and the X endstop togther on a toolhead board (Huvud), and
not be managing off-master code. 4 toolhead wires go away, bringing the
total from 9 down to 5 for me (CANH, CANL, 24V, 5V, GND).
Nice.
And a Q re: the mutli-stepper axis limitation... I've never seen a
>1-stepper printer board that doesn't have at least 4 drivers, and even
with QGL or TBL you're covered.
Is the current limitation you describe only going to affect those with
individual-motor boards on each Z axis then? Unless we live in a future
with single-motor-integrated toolhead boards, I can't think of a use case.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3956 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APNYI6GTXROT3AVFFSJHZYTT7PVALANCNFSM4XZSYYNA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
Mixing multi-mcu-homing and multi-mcu-axis would be a rare case. I don't know of anyone doing that today. -Kevin |
Question @KevinOConnor/klipper
***@***.***> the
huvud v.61 has 3 endstop pins as pb10 pb11 pb12 and a 5v and grnd power but
the servo will not respond I assumed it was cause the no multi mcu but
updated and still nothing. So I tried defining as a servo pin and manually
commanding but got nothing as well. Is this cause of something with klipper
still or maybe the bl touch needs the pwm signal to be 5v for the servo pin
. I ordered a few 4 channel line level converters to try just encase
…On Mon, Aug 30, 2021, 8:10 PM KevinOConnor ***@***.***> wrote:
Mixing multi-mcu-homing and multi-mcu-axis would be a rare case. I don't
know of anyone doing that today.
-Kevin
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3956 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APNYI6BDFDJUWUYZL7CV5XTT7QMY3ANCNFSM4XZSYYNA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
klippy.log |
This PR adds initial (currently incomplete) support for homing and probing when steppers and their endstops are on different micro-controllers. As an example, this may be useful with "toolhead boards" that have a Z probe attached, but don't directly control the Z stepper motors.
The main challenge with multi-mcu homing is having a reliable way to stop the steppers, even if there is a communication fault during homing. (Otherwise, if the mcu with the endstop is unable to communicate with the mcu controlling the steppers, the steppers may continue to move the carriage past the endstop, potentially causing significant damage.) To account for this issue, the code in this PR uses a system where each micro-controller announces that it is still active every 10ms and requires that it receive a message indicating all other mcus are still active at least every 25ms. Should a mcu not receive that response, it will stop the homing sequence (stepper movement will cease). Thus, even in the result of a communication failure, the steppers should not overshoot by more than 25ms of movement (eg, 0.500mm if homing at 20mm/s).
This PR is a work-in-progress. The current code does "work" in that it will home, but it is currently too inacurate to be used for printing. This is an early release that other developers can look at should they be interested.
Some known issues:
Despite the above limitations, this is a fairly significant feature addition to Klipper. I think it may enable some very interesting hardware capabilities in the future.
@mattshepcar - fyi.
-Kevin