Modbus RTU Communication Help

Basic Information:

Printer Model: Custom
MCU / Printerboard: BTT Octopus
Host / SBC Lenovo PC Debian
klippy.log

Greetings everyone, I am developing an industrial 3d printer and I need your help about CanBus. I am using one PLC in the system and BTtT Octopus as the motherboard. Is it possible to communicate the PLC with Klipper via RS485 Modbus RTU? Has anyone worked on this before? (I will do it as communication, for example, functions such as activating an output of the PLC or receiving input).

Don’t think, that is possible. Sorry.

Hey
Everything depend on your use case.

If your intention is to use RS485 just as a communication channel to BTT or just to your PCL - most probably it’s possible.

If your intention is to use RS485 as a BUS for multiple devices together (PCL and BTT on same RS485 line) most probably there could be troubles.

Most probably you can have 2 physically separate RS485 lines also.

Hi, my current plan is just to introduce the PLC as my 2nd motherboard. For example, the outputs of my servo motors such as alarm or brake are connected to my PLC, I interpret them and send a lot of signals to my BTT card such as emergency stop trigger etc. For all of these signals, I gave input from a lot of fan outputs of my BTT card, for example, or I used the endstop pins to detect the outputs from the plc etc. So frankly, the wiring on this side is in great confusion and I want to minimize it.

Juts to be clear I understand everything correctly:
You want following chain ?

Debian (with klipper Host) <–USB/CAN/Serial–> BTT Octopus (MCU) <—RS485—> PLC

Yes, absolutely.

Well that seems pretty possible, but probably will require additional hardware and custom python code. Most probably it will be slow but it should work.

It should look like this:
Debian (with klipper Host) <–USB/CAN/Serial–> BTT Octopus (MCU)—>SPI<----> Transceiver <—RS485—> PLC

  1. You must be sure that PLC communication is not related to time critical stuff because of klipper architecture (Klipper Host and Klipper MCU live in different worlds and real-time gap can reach few seconds).

  2. Directly UART/RS485 is not supported in MCU firmware so HOST can’t ask MCU to do something on it’s UART interface, but SPI is supported on most boards and as I can see your BTT Octopus (STM32F446ZET6 chip) MCU firmware should support SPI ports. So you will need to introduce SPI-RS485 transceiver, something with MAX3140 or something similar.

  3. As MAX3140 (or similar) is currently not supported by Klipper Host - you will need to develop custom python module which will handle everything what you need, as a starting point look at sources around maxxxxxx-temperature-sensors as I remember those temp sensors works thru SPI by utilizing spi-commands, another entry point is adxl345 - it also use SPI

1 Like