Connecting to arduino via SPI

hi,

My goal is to connect a general purpose Microcontroller like an Arduino to a board running Klipper and send custom data between them.
I have found the following in the documentation and I have some questions:

SPI Commands

  • spi_transfer oid=%c data=%*s : This command causes the micro-controller to send ‘data’ to the spi device specified by ‘oid’
  1. Does this mean Klipper can communicate with any SPI device?
  2. Just to clarify, I would initialize the SPI interface with config_spi and then use spi_transfer to send data?
  3. Does the printer board need to support SPI on a hardware level and have dedicated SPI pins or can any pin be configured as a SPI output?
  4. Is there a way to process the returning values as gcode? Let’s say the return message is X400 or G1 X400 can I route the spi transfer output into a macro?

Thanks!

Protocol - Klipper documentation and the details of the MCU commands assume that you have a Klipper HOST that is talking to a Klipper MCU.

This is not meant as a communication between a Klipper host and some arbitrary 3rd device.
For an SPI example, see klipper/klippy/extras/adxl345.py at 0844388d70f225f6458382c1c5d4e7eb37767758 · Klipper3d/klipper · GitHub

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.