Klipper3d / klipper

Klipper is a 3d-printer firmware
GNU General Public License v3.0
9.27k stars 5.27k forks source link

Lose Connection with Duet 2 WiFi after flashing #4933

Closed armysolo closed 2 years ago

armysolo commented 2 years ago

I was having issues with Moonraker so I decided to create a new Klipper USB(I like to use USB drives because their faster and more stable than SD cards). I have a RPI 4 8gb, 32gb USB 3.1 flash drive and Duet 2 WiFi. I used the kiauh.sh script to install Klipper, Fluid and Moonraker.

ls /dev/serial/by-id/* /dev/serial/by-id/usb-03eb_6124-if00

I'm able to flash the Duet but after flashing it seems like the board becomes locked. When I re-run ls /dev/serial/by-id/ I get an error for "ls: cannot access '/dev/serial/by-id/*': No such file or directory". If I erase the flash on the Duet the RPI can communicate with it again. I've tried reflashing the Duet and the RPI many times but I'm not sure what else I can do to fix this.

klippy (1).log

armysolo commented 2 years ago

After swapping USB cables and re-flashing this is what the output is.

`/dev/serial/by-id/usb-03eb_6124-if00 ls /dev/serial/by-id/* /dev/serial/by-id/usb-03eb_6124-if00 make flash FLASH_DEVICE=/dev/serial/by-id/usb-03eb_6124-if00

pi@raspberrypi:~ $ ls /dev/serial/by-id/*
/dev/serial/by-id/usb-03eb_6124-if00
pi@raspberrypi:~ $ ls /dev
autofs hwrng null ram9 stdin tty24 tty42 tty60 vcs2 vga_arbiter
block initctl port random stdout tty25 tty43 tty61 vcs3 vhci
bsg input ppp raw tty tty26 tty44 tty62 vcs4 video10
btrfs-control kmsg ptmx rfkill tty0 tty27 tty45 tty63 vcs5 video11
bus log pts rpivid-h264mem tty1 tty28 tty46 tty7 vcs6 video12
cachefiles loop0 ram0 rpivid-hevcmem tty10 tty29 tty47 tty8 vcsa video13
cec0 loop1 ram1 rpivid-intcmem tty11 tty3 tty48 tty9 vcsa1 video14
cec1 loop2 ram10 rpivid-vp9mem tty12 tty30 tty49 ttyACM0 vcsa2 video15
char loop3 ram11 sda tty13 tty31 tty5 ttyAMA0 vcsa3 video16
console loop4 ram12 sda1 tty14 tty32 tty50 ttyprintk vcsa4 video18
cuse loop5 ram13 sda2 tty15 tty33 tty51 ttyS0 vcsa5 watchdog
disk loop6 ram14 serial tty16 tty34 tty52 uhid vcsa6 watchdog0
dma_heap loop7 ram15 serial0 tty17 tty35 tty53 uinput vcsm-cma zero
dri loop-control ram2 serial1 tty18 tty36 tty54 urandom vcsu
fd mapper ram3 sg0 tty19 tty37 tty55 v4l vcsu1
full media0 ram4 shm tty2 tty38 tty56 vchiq vcsu2
fuse media1 ram5 snd tty20 tty39 tty57 vcio vcsu3
gpiochip0 mem ram6 spidev0.0 tty21 tty4 tty58 vc-mem vcsu4
gpiochip1 mqueue ram7 spidev0.1 tty22 tty40 tty59 vcs vcsu5
gpiomem net ram8 stderr tty23 tty41 tty6 vcs1 vcsu6
pi@raspberrypi:~ $ ls /dev/serial
by-id by-path
pi@raspberrypi:~ $ ls /dev/serial/by-id
usb-03eb_6124-if00
pi@raspberrypi:~ $ lsusb
Bus 002 Device 002: ID 0781:5583 SanDisk Corp. Ultra Fit
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 007: ID 03eb:6124 Atmel Corp. at91sam SAMBA bootloader
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@raspberrypi:~ $ cd klipper
pi@raspberrypi:~/klipper $ make clean
pi@raspberrypi:~/klipper $ make menuconfig
Creating symbolic link out/board
Loaded configuration '/home/pi/klipper/.config'
No changes to save (for '/home/pi/klipper/.config')
pi@raspberrypi:~/klipper $ sudo service klipper stop pi@raspberrypi:~/klipper $ make
Building out/autoconf.h
Compiling out/src/sched.o
Compiling out/src/command.o
Compiling out/src/basecmd.o
Compiling out/src/debugcmds.o
Compiling out/src/initial_pins.o
Compiling out/src/gpiocmds.o
Compiling out/src/stepper.o
Compiling out/src/endstop.o
Compiling out/src/trsync.o
Compiling out/src/adccmds.o
Compiling out/src/spicmds.o
Compiling out/src/thermocouple.o
Compiling out/src/i2ccmds.o
Compiling out/src/pwmcmds.o
Compiling out/src/spi_software.o
Compiling out/src/sensor_adxl345.o
Compiling out/src/lcd_st7920.o
Compiling out/src/lcd_hd44780.o
Compiling out/src/buttons.o
Compiling out/src/tmcuart.o
Compiling out/src/neopixel.o
Compiling out/src/pulse_counter.o
Compiling out/src/atsam/main.o
Compiling out/src/atsam/gpio.o
Compiling out/src/atsam/i2c.o
Compiling out/src/atsam/spi.o
Compiling out/src/atsam/hard_pwm.o
Compiling out/src/generic/armcm_boot.o
Compiling out/src/generic/armcm_irq.o
Compiling out/src/generic/armcm_timer.o
Compiling out/src/generic/crc16_ccitt.o
Compiling out/src/atsam/sam4_usb.o
Compiling out/src/atsam/chipid.o
Compiling out/src/generic/usb_cdc.o
Compiling out/src/atsam/sam4e_afec.o
Compiling out/src/atsam/sam4_cache.o
Compiling out/src/../lib/sam4e/gcc/system_sam4e.o
Building out/compile_time_request.o
Version: v0.10.0-130-g68c92991
Preprocessing out/src/generic/armcm_link.ld
Linking out/klipper.elf
Creating bin file out/klipper.bin pi@raspberrypi:~/klipper $ make flash FLASH_DEVICE=/dev/serial/by-id/usb-03eb_6124-if00
Flashing out/klipper.bin to /dev/serial/by-id/usb-03eb_6124-if00
Entering bootloader on /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.2:1.0
Device reconnect on /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.2:1.0
lib/bossac/bin/bossac -U -p /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.2:1.0 -e -w out/kli pper.bin -v

Erase flash

Done in 4.305 seconds
Write 22708 bytes to flash (45 pages)
[==============================] 100% (45/45 pages)
Done in 0.319 seconds
Verify 22708 bytes of flash
[==============================] 100% (45/45 pages)
Verify successful
Done in 0.246 seconds
Device reconnect on /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.2:1.0 pi@raspberrypi:~/klipper $ sudo cp "./scripts/klipper-mcu-start.sh" /etc/init.d/klipper_mcu
pi@raspberrypi:~/klipper $ sudo update-rc.d klipper_mcu defaults
pi@raspberrypi:~/klipper $ make clean
pi@raspberrypi:~/klipper $ make menuconfig
Creating symbolic link out/board
Loaded configuration '/home/pi/klipper/.config'
Configuration saved to '/home/pi/klipper/.config'
pi@raspberrypi:~/klipper $ make
Creating symbolic link out/board
Building out/autoconf.h
Compiling out/src/sched.o
Compiling out/src/command.o
Compiling out/src/basecmd.o
Compiling out/src/debugcmds.o
Compiling out/src/initial_pins.o
Compiling out/src/gpiocmds.o
Compiling out/src/stepper.o
Compiling out/src/endstop.o
Compiling out/src/trsync.o
Compiling out/src/adccmds.o
Compiling out/src/spicmds.o
Compiling out/src/thermocouple.o
Compiling out/src/i2ccmds.o
Compiling out/src/pwmcmds.o
Compiling out/src/spi_software.o
Compiling out/src/sensor_adxl345.o
Compiling out/src/lcd_st7920.o
Compiling out/src/lcd_hd44780.o
Compiling out/src/buttons.o
Compiling out/src/tmcuart.o
Compiling out/src/neopixel.o
Compiling out/src/pulse_counter.o
Compiling out/src/linux/main.o
Compiling out/src/linux/timer.o
Compiling out/src/linux/console.o
Compiling out/src/linux/watchdog.o
Compiling out/src/linux/pca9685.o
Compiling out/src/linux/spidev.o
Compiling out/src/linux/analog.o
Compiling out/src/linux/hard_pwm.o
Compiling out/src/linux/i2c.o
Compiling out/src/linux/gpio.o
Compiling out/src/generic/crc16_ccitt.o
Compiling out/src/generic/alloc.o
Compiling out/src/linux/sensor_ds18b20.o
Building out/compile_time_request.o
Version: v0.10.0-130-g68c92991
Linking out/klipper.elf pi@raspberrypi:~/klipper $ make flash
Flashing
Installing micro-controller code to /usr/local/bin/
Attempting host MCU restart... pi@raspberrypi:~ $ ls /dev/serial/by-id/
ls: cannot access '/dev/serial/by-id/
': No such file or directory pi@raspberrypi:~ $ ls /dev/serial/by-id/
ls: cannot access '/dev/serial/by-id/
': No such file or directory
pi@raspberrypi:~ $ ls /dev
autofs hwrng null ram9 stdout tty25 tty43 tty61 vcs4 video10
block initctl port random tty tty26 tty44 tty62 vcs5 video11
bsg input ppp raw tty0 tty27 tty45 tty63 vcs6 video12
btrfs-control kmsg ptmx rfkill tty1 tty28 tty46 tty7 vcsa video13
bus log pts rpivid-h264mem tty10 tty29 tty47 tty8 vcsa1 video14
cachefiles loop0 ram0 rpivid-hevcmem tty11 tty3 tty48 tty9 vcsa2 video15
cec0 loop1 ram1 rpivid-intcmem tty12 tty30 tty49 ttyAMA0 vcsa3 video16
cec1 loop2 ram10 rpivid-vp9mem tty13 tty31 tty5 ttyprintk vcsa4 video18
char loop3 ram11 sda tty14 tty32 tty50 ttyS0 vcsa5 watchdog
console loop4 ram12 sda1 tty15 tty33 tty51 uhid vcsa6 watchdog0
cuse loop5 ram13 sda2 tty16 tty34 tty52 uinput vcsm-cma zero
disk loop6 ram14 serial0 tty17 tty35 tty53 urandom vcsu
dma_heap loop7 ram15 serial1 tty18 tty36 tty54 v4l vcsu1
dri loop-control ram2 sg0 tty19 tty37 tty55 vchiq vcsu2
fd mapper ram3 shm tty2 tty38 tty56 vcio vcsu3
full media0 ram4 snd tty20 tty39 tty57 vc-mem vcsu4
fuse media1 ram5 spidev0.0 tty21 tty4 tty58 vcs vcsu5
gpiochip0 mem ram6 spidev0.1 tty22 tty40 tty59 vcs1 vcsu6
gpiochip1 mqueue ram7 stderr tty23 tty41 tty6 vcs2 vga_arbiter
gpiomem net ram8 stdin tty24 tty42 tty60 vcs3 vhci
pi@raspberrypi:~ $ lsusb
Bus 002 Device 002: ID 0781:5583 SanDisk Corp. Ultra Fit
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
`

It seems the USB isn't recognized after flashing the Duet and RPI MCU and reboot.

armysolo commented 2 years ago

It seems it's an issue with Klipper. I've tried cutting the 5v wire on the USB to ensure the Duet isn't being powered from the RPI.

I've tried with 3 different Duet boards and 2 different RPIs along with trying to manually flash with my PC using Bossa. Every way I've tried I get the same result. The board cannot communicate once it's flashed. But if I erase the firmware it can communicate.

Sineos commented 2 years ago

Try this approach: https://duet3d.dozuki.com/Wiki/Installing_and_Updating_Firmware#Section_All_other_Duet_boards

armysolo commented 2 years ago

I've already tried that

zueski commented 2 years ago

I am having the same issue on a fresh install on a new pi4 with the latest on debian. I had a working install on a different pi that will not work now even after reflashing without rebuilding. The interesting part is the serial ID changed from: /dev/serial/by-id/usb-Klipper_sam4e8e_00313753595252533136303532303436-if00 to a non-working: /dev/serial/by-id/usb-03eb_6124-if00 I have not been able to get it back up after the first flash on the latest commit from Nov 21

p5y commented 2 years ago

I am in the same boat as above. Was running 0.9.1-something before, that worked as intended. Created a fresh raspbian-bullseye SD and used kiauh to set things up. I was able to see the Duet when using raspbian buster + klipper 0.9.1-something firmware, but after flashing the new firmware the board wouldn't boot properly.

I tried erasing by jumper, and also flashing the firmware with bossa from windows. This did not help. Going back to the old rpi SD and flashing the Duet would fix things. Switching to a SKR mini e3 and things ran in no time with the latest klipper.

Unfortunately I don't have the time nor tools to debug the issue right now. Hopefully this info will help someone along.

p5y commented 2 years ago

I'm not sure how to approach debugging this board. How do I easily debug the code without JTAG? I can't find anything in the klipper developer docs or Duet wiki that can help me along either. @KevinOConnor can you maybe give me some pointers?

Stepping through klipper revisions to see where it breaks is a fallback, but that's a tedious job.

p5y commented 2 years ago

I played with this issue a bit this weekend.

danielschramm commented 2 years ago

Hello,

I also like to confirm this issue in a similar setup. I had to move to RPI with USB Boot - latest Raspbian this week and I also have Issues. (Before used Banana Pi with Armbian with Klipper 0.8 or so.)

Board reset to bootloader mode via Erase jumper is OK:

usb 1-1.4: new full-speed USB device number 43 using xhci_hcd
usb 1-1.4: New USB device found, idVendor=03eb, idProduct=6124, bcdDevice= 1.10
usb 1-1.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
cdc_acm 1-1.4:1.0: ttyACM0: USB ACM device

Flashing via make flash works without issues. And than I just get an error:

usb 1-1.4: new full-speed USB device number 59 using xhci_hcd
usb 1-1.4: unable to read config index 0 descriptor/all
usb 1-1.4: can't read configurations, error -110
usb 1-1-port4: unable to enumerate USB device

Lastest revision from git:

daniel@raspberrypi:~/klipper $ git show
commit 4c8d24ae03eadf3fc5a28efb1209ce810251d02d (HEAD -> master, origin/master, origin/HEAD)
Author: Kevin O'Connor <kevin@koconnor.net>
Date:   Fri Jan 7 22:17:26 2022 -0500

    stm32: Update Kconfig as CANBUS isn't available on stm32f401

    Signed-off-by: Kevin O'Connor <kevin@koconnor.net>

I Just tried to switch to Release 0.10.0 and 0.9.1 and they show exactly the same behavior.

danielschramm commented 2 years ago

I just repeated everything with Ubuntu 20.10 on the same setup and everything is working as expected . So it really seems that the build process of the duet2 firmware is just failing on the current raspbian.

github-actions[bot] commented 2 years ago

Hello,

It looks like there hasn't been any recent updates on this Klipper github issue. If you created this issue and no longer consider it open, then please login to github and close the issue. Otherwise, if there is no further activity on this thread then it will be automatically closed in a few days.

Best regards,

~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

Zodiak1993 commented 2 years ago

I have the same problem with a Duet Wifi. Really dont know what to do now...Using Pi Os Lite with Kiauh - tried it 2 times with a clear installation.

Sineos commented 2 years ago

I just repeated everything with Ubuntu 20.10 on the same setup and everything is working as expected . So it really seems that the build process of the duet2 firmware is just failing on the current raspbian.

@Zodiak1993 see the reply just above by @danielschramm

Zodiak1993 commented 2 years ago

Sorry I am new to Linux and Raspberries - Ubuntu is an alternative to PI OS Lite? Do I have to flash the board with Ubuntu and then install PI Os Lite again? Or can I stay with Ubuntu? Why is this happening, that the build process fails ?

Sineos commented 2 years ago

Yes, Ubuntu is another Linux OS and can replace PI OS. Reason why this is happening is not clear. As Klipper is depending on certain packages that come with the Linux OS, there might be some unwanted interaction.

Zodiak1993 commented 2 years ago

So for everybody - I could solve it with the "Mainsail OS" https://docs.mainsail.xyz/setup/mainsail-os

Thank you for your support.

Sineos commented 2 years ago

Topics seems concluded. Apparently some OS issue and not depending on Klipper.

ccollinscj commented 2 years ago

The problem still exists.

mak0t0san commented 2 years ago

So for everybody - I could solve it with the "Mainsail OS" https://docs.mainsail.xyz/setup/mainsail-os

Thank you for your support.

Had this same issue. Could not get a working setup with the latest Bullseye version of Raspbian. Using MainsailOS , which uses Buster, works fine.

DefektSan commented 2 years ago

Actual problem. When compile fw for SAM4E8E mcu in Debian 11 Bullseye, mcu does not stars and still place in DFU mode. Fw compiled in Debian 10 buster works normal.

gjsmo commented 2 years ago

@Sineos Can this issue please be re-opened? I can reliably reproduce this on a brand new installation of Debian 11, with only Klipper installed. This is the latest version of Raspberry Pi OS, so it's not a particularly unique setup. Yes, it does change based on OS, bu that isn't evidence that the OS itself is the issue.

bwright85428 commented 1 year ago

eems concluded. Apparently some OS issue and not depending on Klipper.

@Sineos "Apparently some OS issue" the latest version of Raspbian? So Klipper isn't supported on the latest version of Raspbian?

AlexTOOT commented 1 year ago

I got same issue on Debian11 using bigtreetech CB1 and Duet2 wifi. before flashing, it shows up as usb-03eb_6124-if00, after flashing, duet goes offline, can not find anything in /dev/serial/by-id switching os version do solve the problem but still wanna fix the issue

viesturz commented 1 year ago

Still a problem.

underpk commented 1 year ago

Anyone know how to solve this problem? I just have the same issue.

Sineos commented 1 year ago

See https://klipper.discourse.group/t/duet-2-firmware-compilation-broken-on-debian-11/4762/

Only known fix is to use a different Linux version for compiling and flashing

nzidol commented 1 year ago

hmm tried mainsailOS 1.2.1; now also bullseye based and fails with same issue

lesaux commented 1 year ago

Sep 11 2023, I needed to use the ubuntu-server 20.04 image to be able to flash my duet2 wifi + duext5. Tried raspian buster-lite, mainsailos and neither would work.

DefektSan commented 1 year ago

Tried raspian buster-lite, mainsailos and neither would work.

You need use raspberry Pi OS Lite (Legacy) on Debian 10 (buster), on this version firmware compile correctly and work fine.