dw-0 / kiauh

Klipper Installation And Update Helper
GNU General Public License v3.0
3.37k stars 488 forks source link

Firmware build + flash hang on reconnecting #126

Closed petriheino closed 3 years ago

petriheino commented 3 years ago

Hi,

When using KIAUH to re-flash (update) Klipper from v0.9.1 to v0.10.0 it froze on reconnect.

The re-flash was successfull though and after reconnecting everything seems to work ok (closed terminal window and connected again).

Below is the output at the moment when freezing in terminal (Using via MacOS terminal on SSH.).

/=======================================================\
|     ~~~~~~~~~~~~~~~~~ [ KIAUH ] ~~~~~~~~~~~~~~~~~     |
|        Klipper Installation And Update Helper         |
|     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     |
\=======================================================/

###### Please wait...

###### Initializing firmware build ...

###### Checking for the following dependencies:
● build-essential 
● dpkg-dev 
● make 
>>>>>> Dependencies already met! Continue...
Using default symbol values (no '/home/pi/klipper/.config')
Configuration saved to '/home/pi/klipper/.config'
  Creating symbolic link out/board
  Creating symbolic link out/board
Loaded configuration '/home/pi/klipper/.config'
Configuration saved to '/home/pi/klipper/.config'

###### Building firmware ...
  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/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-47-g97d36ac4
  Preprocessing out/src/generic/armcm_link.ld
  Linking out/klipper.elf
  Creating bin file out/klipper.bin
>>>>>> Firmware built!
/=======================================================\
|        ~~~~~~~~~~~~ [ Flash MCU ] ~~~~~~~~~~~~        |
|-------------------------------------------------------|
| Please select the flashing method to flash your MCU.  |
| Make sure to only select a method your MCU supports.  |
| Not all MCUs support both methods!                    |
|-------------------------------------------------------|
|                                                       |
| 1) Regular flashing method                            |
| 2) Updating via SD-Card Update                        |
|                                                       |
|-------------------------------------------------------|
|         B) « Back         |        H) Help [?]        |
\=======================================================/
###### Please select: 1
###### > Regular flashing method

/=======================================================\
| Make sure to have the controller board connected now! |
|                                                       |
| How is the controller board connected to the host?    |
| 1) USB                                                |
| 2) UART                                               |
\=======================================================/
###### Connection method: 1

###### Identifying MCU ...
 ● (USB) MCU #1: /dev/serial/by-id/usb-Klipper_sam4e8e_0031385338484A323135303231303437-if00

/=======================================================\
|                   !!! ATTENTION !!!                   |
|-------------------------------------------------------|
| Make sure, to select the correct MCU!                 |
| ONLY flash a firmware created for the respective MCU! |
\=======================================================/
###### List of available MCU:
 1) /dev/serial/by-id/usb-Klipper_sam4e8e_0031385338484A323135303231303437-if00

###### Select MCU to flash: 1

###### You selected:
 ● MCU #1: /dev/serial/by-id/usb-Klipper_sam4e8e_0031385338484A323135303231303437-if00

###### Continue? (Y/n): y
###### > Yes

###### Flashing /dev/serial/by-id/usb-Klipper_sam4e8e_0031385338484A323135303231303437-if00 ...

###### Stopping klipper.service ...
>>>>>> klipper.service stopped!
  Building bossac
make[1]: wx-config: Command not found
make[1]: wx-config: Command not found
CPP APPLET src/WordCopyArm.cpp
CPP COMMON src/Samba.cpp
CPP COMMON src/Flash.cpp
CPP COMMON src/D5xNvmFlash.cpp
CPP COMMON src/D2xNvmFlash.cpp
CPP COMMON src/EfcFlash.cpp
CPP COMMON src/EefcFlash.cpp
CPP COMMON src/Applet.cpp
CPP COMMON src/WordCopyApplet.cpp
CPP COMMON src/Flasher.cpp
CPP COMMON src/Device.cpp
CPP COMMON src/PosixSerialPort.cpp
CPP COMMON src/LinuxPortFactory.cpp
CPP BOSSAC src/bossac.cpp
CPP BOSSAC src/CmdOpts.cpp
LD bin/bossac
  Flashing out/klipper.bin to /dev/serial/by-id/usb-Klipper_sam4e8e_0031385338484A323135303231303437-if00
Entering bootloader on /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1:1.0
Device reconnect on /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1:1.0
lib/bossac/bin/bossac -U -p /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1:1.0 -e -w out/klipper.bin -v

Erase flash

Done in 4.844 seconds
Write 22676 bytes to flash (45 pages)
[==============================] 100% (45/45 pages)
Done in 0.309 seconds
Verify 22676 bytes of flash
[==============================] 100% (45/45 pages)
Verify successful
Done in 0.251 seconds
Device reconnect on /dev/serial/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1:1.0
dw-0 commented 3 years ago

Hi,

this is no KIAUH issue. The script doesn't control any of what is happening during the flashing process. In the background it is simply executing the usual commands for flashing you would find in the official klipper docs.

petriheino commented 3 years ago

Ok thanks for quick reply. I was thinking if a reconnect timeout - and re-try repetion could be added that would avoid this or then to return back to main menu. But I havent looked at the code yet, so if its working normally then I guess we can close this issue.