Skip to content

Conversation

@rogerlz
Copy link
Contributor

@rogerlz rogerlz commented Apr 14, 2025

This PR enables non-critical MCU support for CAN bus devices, allowing them to be disconnected and reconnected without causing errors or requiring a Klipper restart. Previously, this functionality was limited to USB devices, but with the changes from #391 that allowed querying of already-assigned devices, we can now extend this feature to CAN bus devices as well.

I tested:

  • Boot with the device already connected
  • Disconnecting and reconnecting devices during operation
  • MCU temperature sensors
  • ADXL queries before disconnection, while disconnected, and after reconnection

I did not test:

  • Multiple devices on the same bus

@rogerlz rogerlz requested a review from a team as a code owner April 14, 2025 00:50
@Team5ooo
Copy link

This fixed my issue perfectly. Had a Cartographer on CAN that would disconnect after a few hours of printing and kill the job. It's my second CAN device on the bus so can confirm it works with 2 devices.

@HenrikH96
Copy link

Hi,
I tested this branch on a toolchanger prototype I’m currently building.
The tools are potentially hot-swappable because they don’t connect via cables.

My goal was to see if Klipper could avoid crashing when I detach a tool from the system. Initially, it seemed to work. However, when I run simple HOME or MOVE commands without my SBB_2209 board connected, Klipper shuts down quite quickly with the following error:

MCU 'mcu' shutdown: Timer too close
This often indicates the host computer is overloaded. Check
for other processes consuming excessive CPU time, high swap
usage, disk errors, overheating, unstable voltage, or
similar system problems on the host computer.
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown

@thetic
Copy link
Contributor

thetic commented Aug 15, 2025

i tested this with one of isik's boards. i2c timeouts on the BME280 crash the whole system even though it's set as non-critical.

@rogerlz
Copy link
Contributor Author

rogerlz commented Sep 26, 2025

Hi, I tested this branch on a toolchanger prototype I’m currently building. The tools are potentially hot-swappable because they don’t connect via cables.

My goal was to see if Klipper could avoid crashing when I detach a tool from the system. Initially, it seemed to work. However, when I run simple HOME or MOVE commands without my SBB_2209 board connected, Klipper shuts down quite quickly with the following error:

MCU 'mcu' shutdown: Timer too close
This often indicates the host computer is overloaded. Check
for other processes consuming excessive CPU time, high swap
usage, disk errors, overheating, unstable voltage, or
similar system problems on the host computer.
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown

That use case will likely require a lot more development and testing.. Unfortunately, this feature is not the primary goal.

@rogerlz
Copy link
Contributor Author

rogerlz commented Sep 26, 2025

i tested this with one of isik's boards. i2c timeouts on the BME280 crash the whole system even though it's set as non-critical.

Thanks for the feedback. The whole i2c connection isnt ready for non-critical yet

Copy link
Contributor

@dalegaard dalegaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks fine, but can someone verify with this rebased to newest main?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants