Rtk.gpio and klipper

Is possible use rtk.gpio in klipper?

What do you want to do with rtk.gpio concerning klipper?

Turn on a led or activate a fan! and many other things, I don’t understand why I don’t see anything with gpiodetect from bash

Do you have some schematics?

This is the board.
Working with USB cable and python.

http://www.zoobab.com/ch341-usb-spi-i2c-uart-isp-dongle

Hi DarkPhoinix,

this one?

Yes but work only with python script and not found hardware on /dev/gpio … Klipper don’t work for execute external python script like led_on.py !Or not?

Without being the real authority to judge this:

  • It seems that additional libraries are needed to control this board
  • Klipper does not know these libraries nor can handle their functions
  • As such I would consider a direct integration in the Klipper world currently as not implemented
  • A work-around could be the shell command that allows you to call a shell or py script directly (unofficial / not supported extension). Big drawback is that this is only a one way thing, this means any output from such a script cannot be directly returned to Klipper (although this could be worked around as well)

I think anyone make a firmware for work on linux without GTK …

This might sound like a bit off the wall, but why don’t you use something like the EBB42:

https://www.aliexpress.com/item/1005004242943483.html

If you’re looking to run a fan (or two) as well as some LEDs (including neoPixels) it could be the perfect solution. It can be powered by a Raspberry Pi (or other computer running Klipper) through USB and run Klipper firmware so you can control or access devices using it like the controller or other boards in your printer from your printer.cfg or macros. Depending on where you live, it would probably cost the same as the RTK.gpio when you factor in shipping costs.

We had a discussion on a custom Klipper running USB expansion board, that is probably exactly what you want, some time ago here:

@aycaramba , can you give us a status update?

YES i like this!
I can install klipper in a STM32? and next i see gpiodetect work on bash? Right?

Unfortunately, I’m in the process of writing my engineering thesis, so I don’t have much time to work on this project. The PCB was ordered, however I had to put it aside for now.

You can flash klipper on stm32.
there are tutorials on the internet how to use klipper on bluepill, check it out. You will have to program the appropriate inputs/outputs. It will probably make it much easier to use the ready-made config, because some motherboards use the same STM processor. In this case, it’s probably enough to assign the appropriate i/o to what you want to use.

Remember that RTk.GPIO does not have any transistors, resistor dividers, dc-dc converters etc, so you’ll need to add them if necessary.

1 Like

Yes, you can install klipper onto many STM32F (and G) MCUs, but I don’t believe you will be able to do it simply for the RTk.gpio as there doesn’t seem to be any publicly available schematics and the MCU (STM32F030C8T6) used with it isn’t in the list of devices for Klipper’s make menuconfig.

This isn’t to say that it isn’t possible, but it will be a lot more work than doing it for the EBB42 or @aycaramba 's board.

I just saw that you asked @aycaramba about Klipper firmware for the RTK.gpio and I think you need to do some reading about how Klipper works.

Creating Klipper firmware is quite easy to do if the board you’re working with is supported in the Klipper make utility (both the EBB42 which uses the STM32F072 and @aycaramba 's board which uses the STM32F103, are devices that can have Klipper built for them using the standard tools). The STM32F030C8T6, used in the RTk.gpio isn’t available in the list of MCUs and doesn’t have a built in USB port, which means that there will be some software effort involved (others here can say whether the USB in Klipper is setup as a CDC port or uses some other protocol). Who ever does the work will also need to buy a device programmer for it (anywhere from $20-$50 USD, depending on the programmer).

When you have a board connected to Klipper, you won’t be able to use gpiodetect as the board and its peripherals are all local to Klipper and not accessible to the rPi system at large.

Probably not a lot of what you want to hear, but if you are looking for a few simple IO devices for Klipper, the EBB42 (or similar) board is probably your best bet.

root@klipper:/home/klipper# gpiodetect
gpiochip0 [INT33FC:00] (102 lines)
gpiochip1 [INT33FC:01] (28 lines)
gpiochip2 [INT33FC:02] (44 lines)
gpiochip3 [INT0002 Virtual GPIO] (3 lines)
root@klipper:/home/klipper# gpioinfo
gpiochip0 - 102 lines:
        line   0:      unnamed "volume_down" input active-low [used]
        line   1:      unnamed  "volume_up"   input   active-low [used]
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused   input  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high
        line  32:      unnamed       unused   input  active-high
        line  33:      unnamed       unused   input  active-high
        line  34:      unnamed       unused   input  active-high
        line  35:      unnamed       unused   input  active-high
        line  36:      unnamed       unused   input  active-high
        line  37:      unnamed       unused   input  active-high
        line  38:      unnamed "80860F14:02" input active-low [used]
        line  39:      unnamed       unused   input  active-high
        line  40:      unnamed "rotation_lock" input active-low [used]
        line  41:      unnamed       unused   input  active-high
        line  42:      unnamed       unused   input  active-high
        line  43:      unnamed       unused   input  active-high
        line  44:      unnamed       unused   input  active-high
        line  45:      unnamed       unused   input  active-high
        line  46:      unnamed       unused   input  active-high
        line  47:      unnamed       unused   input  active-high
        line  48:      unnamed       unused   input  active-high
        line  49:      unnamed       unused   input  active-high
        line  50:      unnamed       unused   input  active-high
        line  51:      unnamed       unused   input  active-high
        line  52:      unnamed       unused   input  active-high
        line  53:      unnamed       unused   input  active-high
        line  54:      unnamed       unused  output  active-high
        line  55:      unnamed       unused   input  active-high
        line  56:      unnamed       unused   input  active-high
        line  57:      unnamed       unused   input  active-high
        line  58:      unnamed       unused   input  active-high
        line  59:      unnamed       unused   input  active-high
        line  60:      unnamed       unused   input  active-high
        line  61:      unnamed       unused   input  active-high
        line  62:      unnamed       unused   input  active-high
        line  63:      unnamed       unused   input  active-high
        line  64:      unnamed       unused   input  active-high
        line  65:      unnamed       unused   input  active-high
        line  66:      unnamed       unused   input  active-high
        line  67:      unnamed       unused   input  active-high
        line  68:      unnamed       unused   input  active-high
        line  69:      unnamed       unused   input  active-high
        line  70:      unnamed       unused   input  active-high
        line  71:      unnamed       unused   input  active-high
        line  72:      unnamed       unused   input  active-high
        line  73:      unnamed       unused   input  active-high
        line  74:      unnamed       unused   input  active-high
        line  75:      unnamed       unused   input  active-high
        line  76:      unnamed       unused   input  active-high
        line  77:      unnamed       unused   input  active-high
        line  78:      unnamed       unused   input  active-high
        line  79:      unnamed       unused   input  active-high
        line  80:      unnamed       unused   input  active-high
        line  81:      unnamed       unused   input  active-high
        line  82:      unnamed       unused   input  active-high
        line  83:      unnamed       unused   input  active-high
        line  84:      unnamed       unused   input  active-high
        line  85:      unnamed       unused   input  active-high
        line  86:      unnamed       unused   input  active-high
        line  87:      unnamed       unused   input  active-high
        line  88:      unnamed       unused   input  active-high
        line  89:      unnamed       unused   input  active-high
        line  90:      unnamed       unused   input  active-high
        line  91:      unnamed       unused   input  active-high
        line  92:      unnamed       unused   input  active-high
        line  93:      unnamed       unused   input  active-high
        line  94:      unnamed       unused   input  active-high
        line  95:      unnamed       unused  output  active-high
        line  96:      unnamed       unused   input  active-high
        line  97:      unnamed       unused   input  active-high
        line  98:      unnamed       unused   input  active-high
        line  99:      unnamed       unused   input  active-high
        line 100:      unnamed "ACPI:OpRegion" output active-high [used]
        line 101:      unnamed       unused   input  active-high
gpiochip1 - 28 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused  output  active-high
        line   4:      unnamed       unused  output  active-high
        line   5:      unnamed       unused  output  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused  output  active-high
        line  10:      unnamed  "backlight"  output  active-high [used]
        line  11:      unnamed      "panel"  output  active-high [used]
        line  12:      unnamed       unused  output  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed "ACPI:OpRegion" output active-high [used]
        line  16:      unnamed       "home"   input   active-low [used]
        line  17:      unnamed       unused  output  active-high
        line  18:      unnamed       unused  output  active-high
        line  19:      unnamed       unused  output  active-high
        line  20:      unnamed       unused  output  active-high
        line  21:      unnamed       unused  output  active-high
        line  22:      unnamed       unused  output  active-high
        line  23:      unnamed       unused  output  active-high
        line  24:      unnamed     "enable"  output  active-high [used]
        line  25:      unnamed "device-wake" output active-high [used]
        line  26:      unnamed       unused  output  active-high
        line  27:      unnamed       unused   input  active-high
gpiochip2 - 44 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed "ACPI:OpRegion" output active-high [used]
        line   2:      unnamed       unused  output  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed  "interrupt"   input  active-high [used]
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused  output  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused  output  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed "ACPI:Event"   input  active-high [used]
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed "ACPI:OpRegion" output active-high [used]
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused  output  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed "ACPI:Event"   input  active-high [used]
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed       unused   input  active-high
        line  29:      unnamed       unused  output  active-high
        line  30:      unnamed       unused   input  active-high
        line  31:      unnamed       unused   input  active-high
        line  32:      unnamed       unused   input  active-high
        line  33:      unnamed       unused   input  active-high
        line  34:      unnamed       unused   input  active-high
        line  35:      unnamed       unused   input  active-high
        line  36:      unnamed       unused   input  active-high
        line  37:      unnamed       unused   input  active-high
        line  38:      unnamed       unused   input  active-high
        line  39:      unnamed       unused   input  active-high
        line  40:      unnamed       unused   input  active-high
        line  41:      unnamed       unused   input  active-high
        line  42:      unnamed       unused   input  active-high
        line  43:      unnamed       unused   input  active-high
gpiochip3 - 3 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed "ACPI:Event"   input  active-high [used]

I habe found a suprise in my old Atom …
But for flash STM32 is not a problem RTk.GPIO have CH340G i have a lot of tools for flash:


But if not possible have a cooked firmware to see in bash with gpiodectect i think buy your board is very powerful or the EBB42 recommended by mykepredko.
But I would like to recover the GTk.GPIO without spending money. Adding a transistor to a high or low logic level is not a problem.

@DarkPhoinix ,

It looks like you have the physical programming tools but not the software which is the more costly piece of the puzzle. You can’t expect anybody to spend any time developing a Klipper firmware image for a unique board (using an MCU that isn’t currently supported by Klipper) if there isn’t anything in it for them.

The RTk.GPIO is an interesting board but I don’t see anybody clamoring for its functionality, especially when there are options, like the EBB42, available that can be used to satisfy the needs that you are looking for very easily.

Sorry there isn’t a Klipper solution for the RTk.GPIO.

I think I will continue to post what I find on the Gtk.GPIO for the moment. Maybe there is someone interested and will come out later.

2 Likes

https://www.emcraft.com/som/stm32f7/controlling-gpio-from-linux-user-space