Connecting arduino to klipper

Hi, i have a Qidi Plus 4 with Fluid, and i want to ad a arduino Nano as mai second MCU for output a output pin to control a servomotor.

I did like in this video

i flashed it with kiauh, added in printer.cfg

#Arduino nano

[mcu io]

serial: /dev/serial/by-id/usb-1a86_USB_Serial-if00

saved and restart

The nano is in the same USB, bute klipper cant connect to it, getting error:

mcu 'nano': Unable to connect
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Error configuring printer.

can some one tell me whatts wrong?

Hi @csl89 ,

Please attach the requested klippy.log to your next post.

soryy

klippy (3).log (212.2 KB)

Thank you.

Firstly, it looks like you’re running QIDI’s modded Klipper, so not everything might work as expected.

Could you please share the output of ls /dev/serial/by-id/*?

usb-1a86_USB_Serial-if00-port0

Your log points to the serial path /dev/serial/by-id/usb-1a86_USB_Serial-if00

but the real path should be:

/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 (note the -port0 at the end)

Could you please retry with the new serial address and upload a new klippy.log if the error persists?

klippy2.log (10.0 MB)

a question, is there any way to connect a arduino to the usb mcu? i tryed first with arduino esp32 sended by usb port macro comands like open or closeand got permision denied error…

also i read something like a back door comand in the printer.cfg

now im trying with arduino nano to put it like second mcu, olso having some problems with build and flash the nano getting error :

 Flashing out/klipper.elf.hex to /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 via avrdude
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x42
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x49
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x54
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x42
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x41
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x4e
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x47
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x45
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x44
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20

avrdude done.  Thank you.

make: *** [src/avr/Makefile:34: flash] Error 1
>>>>>> Flashing failed!

Too much time to see a 15 min. video the solution is so simple, first you need to flash the Arduino Nano, or which ever, with klipper firmware generated for the microcontroller in the board, once done you need to look for the serial channel, you need to define it, and that’s all, you can see a recent example with a Ramps board, on my Github:

Make sure you run sudo service klipper stop before trying to flash MCU’s so Klipper isn’t fighting to the same serial port you’re trying to flash.

Also, Klipper doesn’t support ESP32. I would stick to the normal Arduino Nano (ATMega328p)

when i try to flash the arduino i get

Flashing out/klipper.elf.hex to /dev/serial/by-id/usb-1a86_USB_Serial-if00-port0 via avrdude
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x42
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x49
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x54
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x42
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x41
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x4e
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x47
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x45
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x44
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20

avrdude done. Thank you.

make: *** [src/avr/Makefile:34: flash] Error 1

Flashing failed!

and the reason i think is beacuse klipper dosent know to comunicat with CH340 by USB with arduino…on pc i installed CH340 driver to comunicate with Nano

I doubt that’s the issue since I’m running an Arduino nano on Klipper connected to my Pi 4.

Please try this.

It’s not because of the driver, what you need in your case is a programmer, if you look at my Github you could see the picture of a programmer, I recommend you to use the “Arduino as ISP” programmer, you can do it simply loading a program to an existing Arduino, then you need to connect 6 wires to your Arduino Nano, using the ICSP 6 pins interface on it, and then programm it resuming, an Arduino as programmer connected via USB, and then six wires to your target Arduino, the first will program the second following your orders:

https://docs.arduino.cc/built-in-examples/arduino-isp/ArduinoISP/

One more tip, the file you need yo use, is the .elf, and not the .hex

i used uno as arduino isp to write the bootloader on the nano. tonight i will try again to flush the nano with the new tips

Has been written in Spanish but I hope you’ll be able to understand it, probably I will write it in English in a near future

On this file you have how to generate and load the firmware step by step

no results… cant flash the nano… can someone please enter on disscord and any desk to help me and explain whats wrong?

now you have the whole instructions translated to english

send me a link to Discord

silvyu. or silvyu#7058