Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On SKR mini v 1.1 and latest klipper - issues device descriptor read/64, error -32 #1884

Closed
vladbabii opened this issue Aug 13, 2019 · 131 comments

Comments

@vladbabii
Copy link

vladbabii commented Aug 13, 2019

compiled with latest version - effe6f6

Dmesg output when connecting to usb

[  521.874046] usb 1-1.2: new full-speed USB device number 6 using dwc_otg
[  521.974049] usb 1-1.2: device descriptor read/64, error -32
[  522.194049] usb 1-1.2: device descriptor read/64, error -32
[  522.414056] usb 1-1.2: new full-speed USB device number 7 using dwc_otg
[  522.514053] usb 1-1.2: device descriptor read/64, error -32
[  522.744162] usb 1-1.2: device descriptor read/64, error -32
[  522.864138] usb 1-1-port2: attempt power cycle
[  523.524074] usb 1-1.2: new full-speed USB device number 8 using dwc_otg
[  523.964085] usb 1-1.2: device not accepting address 8, error -32
[  524.294097] usb 1-1.5: reset high-speed USB device number 5 using dwc_otg
[  525.174460] usb 1-1.4: USB disconnect, device number 4
[  525.175135] ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
[  525.175216] ch341 1-1.4:1.0: device disconnected

With this version everything works fine - c176b66

commit c176b66f291371e8ba1c171e56bb2a0416ccf16f
Author: Kevin O'Connor <[email protected]>
Date:   Sun Jul 28 22:27:32 2019 -0400

    stm32f4: Allow the USART serial port to be configured

    Signed-off-by: Kevin O'Connor <[email protected]>

I will try to compile with newer versions than above and see when things broke, and will post here with results. As far as can tell it should be about when make menuconfig added options for different cpu types for STM32F103

Please let me know what information i can provide, since klipper logs is useless because the service is not even started.

Tested this on pi 3b+, pi4 ajnd lubuntu 18.04

Thank you

@vladbabii
Copy link
Author

klippy.log
Fake klipper log for bot

@KevinOConnor
Copy link
Collaborator

There's been a bunch of changes to the stm32 code recently. However, the USB support on the stm32f103 was not changed. The config options have changed a bit, though, so make sure you have a clean checkout, be sure to rerun "make menuconfig", and make sure the appropriate config settings are in place (basically, select stm32f103, 28KiB bootloader, and otherwise use the defaults).

If you continue to have issues, can you attach your .config file here?

-Kevin

@vladbabii
Copy link
Author

I believe the printer config file doesn't really matter because the USB serial connection is not detected on the OS level for the klipper software be able to use it. I have attached it here.
printer.cfg.zip

The printer is /dev/printerhill because i have a file in /etc/udev/rules.d/99-printerhill.rules with:
SUBSYSTEM=="tty", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="abcd", SYMLINK+="printerhill"

It's a testing platform for the X/Y part of Corexy and it moves and works corectly with the firmware version mentioned above.

I will re-compile from latest in about 8 hours hours. If its any help I can provide remote ssh access to a pi or laptop connected to that board and can help you debug.

I have used the 28kb bootloader and noticed the change in the menuconfig options - that prompted me to try older klipper versions because when i bought the mini boards (about one and a half months ago) i managed to get it running with the older menuconfig options.

@vladbabii
Copy link
Author

git clone https://github.com/KevinOConnor/klipper .
make clean
git describe --tags
> v0.7.0-769-ge817b85
make menuconfig

then selected microcontroller "stmicroelectronics stm32f1/f4"

then selected processor model stm32f103

then selected booloader offset 28kib

left default 'use usb for communication (instead of serial)'

usb ids:

  • vendor id: 2341
  • usb device id: 0xabcd
  • usb serial number: 12345
make

got this error now (this is new)

ERROR: The compiler failed to correctly compile Klipper
It will be necessary to upgrade the compiler
See: https://bugs.launchpad.net/ubuntu/+source/newlib/+bug/1767223
apt update
apt upgrade -y
...
make clean
make menuconfig

made sure all settings remained then ran make

  Build Kconfig config file
  Creating symbolic link out/board
  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/adccmds.o
  Compiling out/src/spicmds.o
  Compiling out/src/thermocouple.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/spi_software.o
  Compiling out/src/neopixel.o
  Compiling out/src/stm32/main.o
  Compiling out/src/stm32/watchdog.o
  Compiling out/src/stm32/gpio.o
  Compiling out/src/generic/crc16_ccitt.o
  Compiling out/src/generic/armcm_irq.o
  Compiling out/src/generic/armcm_timer.o
  Compiling out/src/../lib/stm32f1/system_stm32f1xx.o
  Compiling out/src/stm32/stm32f1.o
  Compiling out/src/stm32/adc.o
  Compiling out/src/stm32/spi.o
  Compiling out/src/stm32/usbfs.o
  Compiling out/src/generic/usb_cdc.o
  Building out/compile_time_request.o
Version: v0.7.0-769-ge817b85-20190819_205041-octopus
  Assembling out/src/../lib/stm32f1/gcc/startup_stm32f103xb.o
  Preprocessing out/stm32.ld
  Linking out/klipper.elf
  Creating hex file out/klipper.bin
git rev-parse HEAD
> e817b85b78b1482c1269ef6549e430b918da01b5

put file on microsd card and powered on board with 12v power and no usb

then shutdown 12v power, removed microsd and check if a file BIGTREETECH.bigtreetech is there - and it was

Now ran

dmesg -c 

to clean dmesg output from linux. Then plugged usb wire back into the board

[554916.514653] usb 3-3: new full-speed USB device number 26 using ohci-pci
[554916.674834] usb 3-3: device descriptor read/64, error -32
[554916.942838] usb 3-3: device descriptor read/64, error -32
[554917.234828] usb 3-3: new full-speed USB device number 27 using ohci-pci
[554917.394970] usb 3-3: device descriptor read/64, error -32
[554917.662645] usb 3-3: device descriptor read/64, error -32
[554917.770740] usb usb3-port3: attempt power cycle
[554918.270859] usb 3-3: new full-speed USB device number 28 using ohci-pci
[554918.686864] usb 3-3: device not accepting address 28, error -32
[554918.870873] usb 3-3: new full-speed USB device number 29 using ohci-pci
[554919.286867] usb 3-3: device not accepting address 29, error -32
[554919.286993] usb usb3-port3: unable to enumerate USB device

next, ran dmesg -c and powercycled the board (12v off, 10 second wait, 12v on

dmesg output:

[554999.596155] usb 3-3: new full-speed USB device number 30 using ohci-pci
[554999.756177] usb 3-3: device descriptor read/64, error -32
[555000.024176] usb 3-3: device descriptor read/64, error -32
[555000.320192] usb 3-3: new full-speed USB device number 31 using ohci-pci
[555000.480054] usb 3-3: device descriptor read/64, error -32
[555000.748170] usb 3-3: device descriptor read/64, error -32
[555000.856261] usb usb3-port3: attempt power cycle
[555001.356208] usb 3-3: new full-speed USB device number 32 using ohci-pci
[555001.772197] usb 3-3: device not accepting address 32, error -32
[555001.956199] usb 3-3: new full-speed USB device number 33 using ohci-pci
[555002.372199] usb 3-3: device not accepting address 33, error -32
[555002.372339] usb usb3-port3: unable to enumerate USB device

@vladbabii
Copy link
Author

Next, reverted to old working firmware via sd card upload and repowered the board:

Dmesg output:

[555172.060626] usb 3-3: USB disconnect, device number 38
[555172.506799] usb 3-3: new full-speed USB device number 39 using ohci-pci
[555172.709877] usb 3-3: New USB device found, idVendor=2341, idProduct=abcd
[555172.709888] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[555172.709894] usb 3-3: Product: Klipper firmware
[555172.709901] usb 3-3: Manufacturer: Klipper
[555172.709907] usb 3-3: SerialNumber: 12345
[555172.713987] cdc_acm 3-3:1.0: ttyACM0: USB ACM device

This is on the same machine with everything the same (cable, usb port, board, etc).

@vladbabii
Copy link
Author

@KevinOConnor please let me know what else to try.

Do you know on which revision the build menu for this processor changed? I'd like to make a build before and one after to see if that is the cause or something else.

Thank you for your time!

@KevinOConnor
Copy link
Collaborator

Do you know on which revision the build menu for this processor changed?

In ec3d865 it was possible to build both the old and the new stm32f103 code (the new code was under the stm32f4 menu option). In the following commit (8b9cc62) the old build method was removed.

-Kevin

@KevinOConnor
Copy link
Collaborator

Can you attach the ".config" file from the failed build? (It is a file produced by "make menuconfig" - it should be in ~/klipper/.config .)

-Kevin

@vladbabii
Copy link
Author

vladbabii commented Aug 19, 2019

dot.config.zip
This is config from latest

@vladbabii
Copy link
Author

vladbabii commented Aug 19, 2019

And this is from the working one - c176b66
Uploaded correct file now for working revision.
working.zip

@KevinOConnor
Copy link
Collaborator

Can you retry with the latest code (commit c930fc3)?

-Kevin

@vladbabii
Copy link
Author

In 5 minutes

@vladbabii
Copy link
Author

vladbabii commented Aug 20, 2019

git clone https://github.com/KevinOConnor/klipper.git
git rev-parse HEAD
> c930fc392b6977b17d6f7953bd738583974208c2
make clean
make menuconfig

stm31f1/f2 -> smt32f103 -> 28kib

.config contents:

#
# Automatically generated file; DO NOT EDIT.
# Klipper Firmware Configuration
#
# CONFIG_LOW_LEVEL_OPTIONS is not set
# CONFIG_MACH_AVR is not set
# CONFIG_MACH_ATSAM is not set
# CONFIG_MACH_ATSAMD is not set
# CONFIG_MACH_LPC176X is not set
CONFIG_MACH_STM32=y
# CONFIG_MACH_STM32F0 is not set
# CONFIG_MACH_PRU is not set
# CONFIG_MACH_LINUX is not set
# CONFIG_MACH_SIMU is not set
CONFIG_STEP_DELAY=2
CONFIG_BOARD_DIRECTORY="stm32"
# CONFIG_MACH_atmega2560 is not set
# CONFIG_MACH_atmega1280 is not set
# CONFIG_MACH_at90usb1286 is not set
# CONFIG_MACH_at90usb646 is not set
# CONFIG_MACH_atmega32u4 is not set
# CONFIG_MACH_atmega1284p is not set
# CONFIG_MACH_atmega644p is not set
# CONFIG_MACH_atmega328p is not set
# CONFIG_MACH_atmega328 is not set
# CONFIG_MACH_atmega168 is not set
CONFIG_MCU="stm32f103xb"
CONFIG_CLOCK_FREQ=72000000
CONFIG_USBSERIAL=y
CONFIG_SERIAL_PORT=1
CONFIG_FLASH_SIZE=0x10000
CONFIG_RAM_SIZE=0x5000
CONFIG_STACK_SIZE=512
CONFIG_FLASH_START=0x7000
CONFIG_STM32_SELECT=y
CONFIG_MACH_STM32F103=y
# CONFIG_MACH_STM32F405 is not set
# CONFIG_MACH_STM32F407 is not set
# CONFIG_MACH_STM32F446 is not set
CONFIG_MACH_STM32F1=y
CONFIG_HAVE_STM32_USBFS=y
# CONFIG_HAVE_STM32_USBOTG is not set
# CONFIG_STM32_FLASH_START_2000 is not set
CONFIG_STM32_FLASH_START_7000=y
# CONFIG_STM32_FLASH_START_0000 is not set
CONFIG_CLOCK_REF_8M=y

#
# USB ids
#
CONFIG_USB_VENDOR_ID=0x2341
CONFIG_USB_DEVICE_ID=0xabcd
CONFIG_USB_SERIAL_NUMBER="12345"
CONFIG_HAVE_GPIO=y
CONFIG_HAVE_GPIO_ADC=y
CONFIG_HAVE_GPIO_SPI=y
# CONFIG_HAVE_GPIO_I2C is not set
# CONFIG_HAVE_GPIO_HARD_PWM is not set
CONFIG_HAVE_GPIO_BITBANGING=y
CONFIG_INLINE_STEPPER_HACK=y

make command...

  Build Kconfig config file
#
# configuration written to /opt/klipperlatest/klipper/.config
#
  Creating symbolic link out/board
  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/adccmds.o
  Compiling out/src/spicmds.o
  Compiling out/src/thermocouple.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/spi_software.o
  Compiling out/src/neopixel.o
  Compiling out/src/stm32/main.o
  Compiling out/src/stm32/watchdog.o
  Compiling out/src/stm32/gpio.o
  Compiling out/src/generic/crc16_ccitt.o
  Compiling out/src/generic/armcm_irq.o
  Compiling out/src/generic/armcm_timer.o
  Compiling out/src/../lib/stm32f1/system_stm32f1xx.o
  Compiling out/src/stm32/stm32f1.o
  Compiling out/src/stm32/adc.o
  Compiling out/src/stm32/spi.o
  Compiling out/src/stm32/usbfs.o
  Compiling out/src/generic/usb_cdc.o
  Building out/compile_time_request.o
Version: v0.7.0-773-gc930fc3-20190820_090132-octopus
  Assembling out/src/../lib/stm32f1/gcc/startup_stm32f103xb.o
  Preprocessing out/stm32.ld
  Linking out/klipper.elf
  Creating hex file out/klipper.bin

dmesg output with toggle power off to on

[597867.420322] usb 3-3: new full-speed USB device number 45 using ohci-pci
[597867.580306] usb 3-3: device descriptor read/64, error -62
[597867.848314] usb 3-3: device descriptor read/64, error -62
[597868.140354] usb 3-3: new full-speed USB device number 46 using ohci-pci
[597868.328335] usb 3-3: device descriptor read/64, error -62
[597868.596338] usb 3-3: device descriptor read/64, error -62
[597868.704411] usb usb3-port3: attempt power cycle
[597869.176339] usb 3-3: new full-speed USB device number 47 using ohci-pci
[597869.592388] usb 3-3: device not accepting address 47, error -62
[597869.748357] usb 3-3: new full-speed USB device number 48 using ohci-pci
[597870.192357] usb 3-3: device not accepting address 48, error -62
[597870.192495] usb usb3-port3: unable to enumerate USB device
[597875.312435] usb 3-3: new full-speed USB device number 49 using ohci-pci
[597875.472320] usb 3-3: device descriptor read/64, error -32
[597875.740331] usb 3-3: device descriptor read/64, error -32
[597876.004331] usb 3-3: new full-speed USB device number 50 using ohci-pci
[597876.164451] usb 3-3: device descriptor read/64, error -32
[597876.432456] usb 3-3: device descriptor read/64, error -32
[597876.540544] usb usb3-port3: attempt power cycle
[597877.040460] usb 3-3: new full-speed USB device number 51 using ohci-pci
[597877.456461] usb 3-3: device not accepting address 51, error -32
[597877.612462] usb 3-3: new full-speed USB device number 52 using ohci-pci
[597878.028482] usb 3-3: device not accepting address 52, error -32
[597878.028607] usb usb3-port3: unable to enumerate USB device

dmesg output with replugging in the usb cable

[597939.141431] usb 3-3: new full-speed USB device number 53 using ohci-pci
[597939.329416] usb 3-3: device descriptor read/64, error -32
[597939.597437] usb 3-3: device descriptor read/64, error -32
[597939.861313] usb 3-3: new full-speed USB device number 54 using ohci-pci
[597940.021454] usb 3-3: device descriptor read/64, error -32
[597940.289446] usb 3-3: device descriptor read/64, error -32
[597940.397524] usb usb3-port3: attempt power cycle
[597940.869457] usb 3-3: new full-speed USB device number 55 using ohci-pci
[597941.285449] usb 3-3: device not accepting address 55, error -32
[597941.441469] usb 3-3: new full-speed USB device number 56 using ohci-pci
[597941.873469] usb 3-3: device not accepting address 56, error -32
[597941.873605] usb usb3-port3: unable to enumerate USB device

@KevinOConnor
Copy link
Collaborator

A separate user was reporting that if they hit the reset button a couple of times, it would eventually come up. (Though that user also reports the latest version does boot on its own.) Do you eventually see a connection when clicking reset?

-Kevin

@vladbabii
Copy link
Author

I will try that but in a couple of hours. Is the reset press required every boot? Because with older firmware it always connects to usb no matter what.

@vladbabii
Copy link
Author

Done a ton of resets. No change. same errors ( -62 ). Tried different cables, different ports, a laptop, a desktop, a pi, a usb 1.1 hub, a usb 3.0 hub....

@KevinOConnor
Copy link
Collaborator

Alas, I'm unable to reproduce the problem, so it's difficult to track this down.

Are you able to successfully compile and run ec3d865 ? If so, can you provide the klipper log file from that run?

I put some code changes up on the work-stm32f1-20190820 branch:
cd ~/klipper ; git fetch ; git checkout origin/work-stm32f1-20190820 ; make ; ...flash...

You could try with that branch - but the changes on that branch are just wild guesses at this point.

-Kevin

@vladbabii
Copy link
Author

vladbabii commented Aug 21, 2019

trying ec3d865

configuration written to /opt/klipperlatest/klipper/.config

*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

blue@octopus:/opt/klipperlatest/klipper$ make
  Build Kconfig config file
  Creating symbolic link out/board
  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/adccmds.o
  Compiling out/src/spicmds.o
  Compiling out/src/thermocouple.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/spi_software.o
  Compiling out/src/neopixel.o
  Compiling out/src/stm32f1/main.o
  Compiling out/src/stm32f1/gpio.o
  Compiling out/src/stm32f1/adc.o
  Compiling out/src/stm32f1/spi.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_adc.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_spi.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_gpio.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_exti.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_fsmc.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_usb.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_dma.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_rtc.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_pwr.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_utils.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_i2c.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_rcc.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_dac.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_crc.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_usart.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_sdmmc.o
  Compiling out/src/../lib/stm32f1/hal/source/stm32f1xx_ll_tim.o
  Compiling out/src/generic/crc16_ccitt.o
  Compiling out/src/generic/armcm_irq.o
  Compiling out/src/generic/armcm_timer.o
  Compiling out/src/../lib/stm32f1/system_stm32f1xx.o
  Compiling out/src/stm32f1/usbserial.o
  Compiling out/src/generic/usb_cdc.o
  Building out/compile_time_request.o
Version: v0.7.0-733-gec3d865-20190821_090759-octopus
  Assembling out/src/../lib/stm32f1/gcc/startup_stm32f103xb.o
  Preprocessing out/stm32f1.ld
  Linking out/klipper.elf
  Creating hex file out/klipper.bin

config file

#
# Automatically generated file; DO NOT EDIT.
# Klipper Firmware Configuration
#
# CONFIG_LOW_LEVEL_OPTIONS is not set
# CONFIG_MACH_AVR is not set
# CONFIG_MACH_ATSAM is not set
# CONFIG_MACH_ATSAMD is not set
# CONFIG_MACH_LPC176X is not set
# CONFIG_MACH_STM32F0 is not set
CONFIG_MACH_STM32F1=y
# CONFIG_MACH_STM32F4 is not set
# CONFIG_MACH_PRU is not set
# CONFIG_MACH_LINUX is not set
# CONFIG_MACH_SIMU is not set
CONFIG_STEP_DELAY=2
CONFIG_BOARD_DIRECTORY="stm32f1"
CONFIG_CLOCK_FREQ=72000000
CONFIG_USBSERIAL=y
CONFIG_FLASH_START=0x7000
CONFIG_STM32F1_SELECT=y
# CONFIG_STM_FLASH_START_2000 is not set
CONFIG_STM_FLASH_START_7000=y
# CONFIG_STM_FLASH_START_0000 is not set

#
# USB ids
#
CONFIG_USB_VENDOR_ID=0x2341
CONFIG_USB_DEVICE_ID=0xabcd
CONFIG_USB_SERIAL_NUMBER="12345"
CONFIG_HAVE_GPIO=y
CONFIG_HAVE_GPIO_ADC=y
CONFIG_HAVE_GPIO_SPI=y
# CONFIG_HAVE_GPIO_I2C is not set
# CONFIG_HAVE_GPIO_HARD_PWM is not set
CONFIG_HAVE_GPIO_BITBANGING=y
CONFIG_INLINE_STEPPER_HACK=y

This one works

[684733.100719] usb 3-3: USB disconnect, device number 94
[684748.659158] usb 3-3: new full-speed USB device number 95 using ohci-pci
[684748.819158] usb 3-3: device descriptor read/64, error -62
[684749.087165] usb 3-3: device descriptor read/64, error -62
[684749.351160] usb 3-3: new full-speed USB device number 96 using ohci-pci
[684749.510974] usb 3-3: device descriptor read/64, error -62
[684749.779156] usb 3-3: device descriptor read/64, error -62
[684749.887245] usb usb3-port3: attempt power cycle
[684750.595186] usb 3-3: new full-speed USB device number 97 using ohci-pci
[684750.649720] usb 3-3: New USB device found, idVendor=2341, idProduct=abcd
[684750.649731] usb 3-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[684750.649738] usb 3-3: Product: Klipper firmware
[684750.649745] usb 3-3: Manufacturer: Klipper
[684750.649751] usb 3-3: SerialNumber: 12345
[684750.657248] cdc_acm 3-3:1.0: ttyACM1: USB ACM device

@vladbabii
Copy link
Author

vladbabii commented Aug 21, 2019

work-stm32f1-20190820 branch

  Build Kconfig config file
  Creating symbolic link out/board
  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/adccmds.o
  Compiling out/src/spicmds.o
  Compiling out/src/thermocouple.o
  Compiling out/src/i2ccmds.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/spi_software.o
  Compiling out/src/neopixel.o
  Compiling out/src/stm32/main.o
  Compiling out/src/stm32/watchdog.o
  Compiling out/src/stm32/gpio.o
  Compiling out/src/generic/crc16_ccitt.o
  Compiling out/src/generic/armcm_irq.o
  Compiling out/src/generic/armcm_timer.o
  Compiling out/src/../lib/stm32f1/system_stm32f1xx.o
  Compiling out/src/stm32/stm32f1.o
  Compiling out/src/stm32/adc.o
  Compiling out/src/stm32/i2c.o
  Compiling out/src/stm32/spi.o
  Compiling out/src/stm32/usbfs.o
  Compiling out/src/generic/usb_cdc.o
  Building out/compile_time_request.o
Version: v0.7.0-779-gd2118c8-20190821_091559-octopus
  Assembling out/src/../lib/stm32f1/gcc/startup_stm32f103xb.o
  Preprocessing out/stm32.ld
  Linking out/klipper.elf
  Creating hex file out/klipper.bin

config:

#
# Automatically generated file; DO NOT EDIT.
# Klipper Firmware Configuration
#
# CONFIG_LOW_LEVEL_OPTIONS is not set
# CONFIG_MACH_AVR is not set
# CONFIG_MACH_ATSAM is not set
# CONFIG_MACH_ATSAMD is not set
# CONFIG_MACH_LPC176X is not set
CONFIG_MACH_STM32=y
# CONFIG_MACH_STM32F0 is not set
# CONFIG_MACH_PRU is not set
# CONFIG_MACH_LINUX is not set
# CONFIG_MACH_SIMU is not set
CONFIG_STEP_DELAY=2
CONFIG_BOARD_DIRECTORY="stm32"
CONFIG_MCU="stm32f103xb"
CONFIG_CLOCK_FREQ=72000000
CONFIG_USBSERIAL=y
CONFIG_SERIAL_PORT=1
CONFIG_FLASH_SIZE=0x10000
CONFIG_RAM_SIZE=0x5000
CONFIG_STACK_SIZE=512
CONFIG_FLASH_START=0x7000
CONFIG_STM32_SELECT=y
CONFIG_MACH_STM32F103=y
# CONFIG_MACH_STM32F405 is not set
# CONFIG_MACH_STM32F407 is not set
# CONFIG_MACH_STM32F446 is not set
CONFIG_MACH_STM32F1=y
CONFIG_HAVE_STM32_USBFS=y
# CONFIG_HAVE_STM32_USBOTG is not set
# CONFIG_STM32_FLASH_START_2000 is not set
CONFIG_STM32_FLASH_START_7000=y
# CONFIG_STM32_FLASH_START_0000 is not set
CONFIG_CLOCK_REF_8M=y

#
# USB ids
#
CONFIG_USB_VENDOR_ID=0x2341
CONFIG_USB_DEVICE_ID=0xabcd
CONFIG_USB_SERIAL_NUMBER="12345"
CONFIG_HAVE_GPIO=y
CONFIG_HAVE_GPIO_ADC=y
CONFIG_HAVE_GPIO_SPI=y
CONFIG_HAVE_GPIO_I2C=y
# CONFIG_HAVE_GPIO_HARD_PWM is not set
CONFIG_HAVE_GPIO_BITBANGING=y
CONFIG_INLINE_STEPPER_HACK=y

this one does not work

[685124.546825] usb 3-3: USB disconnect, device number 98
[685124.999826] usb 3-3: new full-speed USB device number 99 using ohci-pci
[685125.159921] usb 3-3: device descriptor read/64, error -32
[685125.427924] usb 3-3: device descriptor read/64, error -32
[685125.719922] usb 3-3: new full-speed USB device number 100 using ohci-pci
[685125.879932] usb 3-3: device descriptor read/64, error -32
[685126.147920] usb 3-3: device descriptor read/64, error -32
[685126.267803] usb usb3-port3: attempt power cycle
[685126.767946] usb 3-3: new full-speed USB device number 101 using ohci-pci
[685127.183945] usb 3-3: device not accepting address 101, error -32
[685127.367952] usb 3-3: new full-speed USB device number 102 using ohci-pci
[685127.783954] usb 3-3: device not accepting address 102, error -32
[685127.784081] usb usb3-port3: unable to enumerate USB device
[685165.984317] usb 3-3: new full-speed USB device number 103 using ohci-pci
[685166.148323] usb 3-3: device descriptor read/64, error -62
[685166.444449] usb 3-3: device descriptor read/64, error -62
[685166.740444] usb 3-3: new full-speed USB device number 104 using ohci-pci
[685166.900456] usb 3-3: device descriptor read/64, error -62
[685167.168436] usb 3-3: device descriptor read/64, error -62
[685167.276514] usb usb3-port3: attempt power cycle
[685168.080447] usb 3-3: new full-speed USB device number 105 using ohci-pci
[685168.496457] usb 3-3: device not accepting address 105, error -32
[685168.680456] usb 3-3: new full-speed USB device number 106 using ohci-pci
[685169.096466] usb 3-3: device not accepting address 106, error -32
[685169.096552] usb usb3-port3: unable to enumerate USB device
[685177.128383] usb 3-3: new full-speed USB device number 107 using ohci-pci
[685177.288391] usb 3-3: device descriptor read/64, error -32
[685177.556586] usb 3-3: device descriptor read/64, error -32
[685177.820588] usb 3-3: new full-speed USB device number 108 using ohci-pci
[685177.980590] usb 3-3: device descriptor read/64, error -32
[685178.248590] usb 3-3: device descriptor read/64, error -32
[685178.356557] usb usb3-port3: attempt power cycle
[685178.856601] usb 3-3: new full-speed USB device number 109 using ohci-pci
[685179.272603] usb 3-3: device not accepting address 109, error -32
[685179.456602] usb 3-3: new full-speed USB device number 110 using ohci-pci
[685179.872509] usb 3-3: device not accepting address 110, error -32

@vladbabii
Copy link
Author

Should i try revisions after ec3d865 until i find one that does not work?

@vladbabii
Copy link
Author

I will try building a couple more firmware versions after the one mentioned above and see what happens.

@vladbabii
Copy link
Author

ec3d865 works
but the next one
8b9cc62 does not work

@vladbabii
Copy link
Author

@KevinOConnor can i use some other 2 pins for serial communication instead of usb port? I think that might solve things temporarily if the USB connection is the only issue.

@vladbabii
Copy link
Author

I got some files from another user on discord that uses this fork

Git: https://github.com/BlackStump/klipper
Revision: b2eaab922621f700d52b2519284eb0299aad010e

config.menu.zip
klipper.zip

This works on my board

@vladbabii
Copy link
Author

vladbabii commented Aug 21, 2019

compiling on a pi 3b+ and on a ubuntu 18.04 produce different files for same git revision

dsfa
left is pi, right is ubuntu

dfas
Files have different size. I was expecting the same identical size for both sources

Revision 078d278

@KevinOConnor
Copy link
Collaborator

can i use some other 2 pins for serial communication instead of usb port?

The mini has a "tft" header that seems to expose uart pins. So, you should be able to disable USB support in "make menuconfig" and use a regular serial port instead. If you do this, be sure the voltages match correctly.

Files have different size. I was expecting the same identical size for both sources

Different versions of gcc produce slightly different code. It's normal.

-Kevin

@vladbabii
Copy link
Author

@KevinOConnor compiling for skr mini works only on raspberry pi or arm systems. I'll leave this ever if anyone happens to have the same issue.

I think for now we can close this ticket? Or should I leave it open due to different behaviour of firmware depending on where it was compiled?

@KevinOConnor
Copy link
Collaborator

Can you provide more details? Are you now able to boot the latest code on the mini? What OS is unable to correctly compile Klipper? Is that system able to compile an older version of Klipper?

-Kevin

@vladbabii
Copy link
Author

This system cannot make workable firmwares:

Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.3 LTS
Release:	18.04
Codename:	bionic

On this pi builds work:

No LSB modules are available.
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 9.4 (stretch)
Release:	9.4
Codename:	stretch

@qldestlp
Copy link

One of the problems, I can not figure out the pins

@qldestlp which pins are you not able to figure out?

I've attached my config here. The setup is probably different than yours, this is the E3 Mini DIP with 4 TMC2208 drivers in UART mode (single wire mode), and a BLtouch.

current.cfg.txt

I had a problem with uart and tx pins. In the end, I left only uart. I tried your config. But the miracle did not happen. I can’t imagine where I was wrong.

@pusewicz
Copy link
Contributor

pusewicz commented Oct 4, 2019

@KevinOConnor @vladbabii Did you guys manage to get any debugging done for this issue?

@vladbabii
Copy link
Author

@KevinOConnor @pusewicz

I'm tryng to figure out the skr mini 1.1 pins and openocd config file - openocd starts then shuts down right now

Do i need to connect sck/sdo pins on the icsp header ? Or the ones rx/tx next to board corner ? The reset pin i asume is the RST in the corner, in the row with +5v,gnd,tx,rx,rst

I also have this cable, could i use this instead of direct wiring? - https://www.adafruit.com/product/954

OpenOCD config - not sure what i should put here

# Uses RPi pins: GPIO25 for SWDCLK, GPIO24 for SWDIO, GPIO18 for nRST
source [find interface/raspberrypi2-native.cfg]
bcm2835gpio_swd_nums 25 24
bcm2835gpio_srst_num 18
transport select swd

# Set the chip (at91samd51j19 in this example)
#set CHIPNAME at91samd51j19
#source [find target/atsame5x.cfg]
set CHIPNAME stm32f1x
source [find target/stm32f1x.cfg]

# Set the adapter speed
adapter_khz 40
adapter_nsrst_delay 100
adapter_nsrst_assert_width 100

init
targets
reset halt

@vladbabii
Copy link
Author

@KevinOConnor helped me, below is the openocd config that works. The bcm2835gpio_.. lines were needed for pi 4

source [find interface/raspberrypi2-native.cfg]
bcm2835gpio_swd_nums 24 25
bcm2835gpio_srst_num 18
transport select swd


bcm2835gpio_peripheral_base 0xFE000000
bcm2835gpio_speed_coeffs 236181 60


# Set the chip (at91samd51j19 in this example)
#set CHIPNAME at91samd51j19
#source [find target/atsame5x.cfg]
#set CHIPNAME stm32f1x
source [find target/stm32f1x.cfg]

# Set the adapter speed
adapter_khz 40
adapter_nsrst_delay 100
adapter_nsrst_assert_width 100

init
targets
reset halt

@theophile
Copy link
Contributor

I apologize if this is a dumb question but is this issue with the SKR mini 1.1 limited to attempts to flash the firmware from the sdcard, or does it affect directly flashing over USB as well? I recently installed an SKR mini 1.1 as a secondary MCU and got it up and running using the "known good" build linked in this thread. But now that the firmware is installed, I'm wondering if I can direct-flash update to a more recent build. Or will that reintroduce the USB connection errors?

@vladbabii
Copy link
Author

@theophile I only managed to flash it via SD card. Haven't looked into how to upload via usb yet but might need a different bootloader

@Rubber1Duck
Copy link

Any new findings to this Issue?

@vladbabii
Copy link
Author

Kevin debugged for a while on my pi4 and then we had some issues. I figured out you need a usb 2 hub on a pi4 to get reliable usb connection between a mini and pi4. The test platform is still up and Kevin said he will be also ordering a mini to test things on.

I am trying to figure out now how to replace the bootloader (new to openocd and these tools) and try to see if that makes a difference.

I will post here if I have anything new.

@Rubber1Duck
Copy link

@vladbabii thanks very mucht for your feedback.
What i not understand is why some commits are working und some not, and ..... marlin do not have this issue with the SKR minis (mini, E3, E3 DIP) or i am not able to find that issue.
I'm looking forward that you specialists are doing the thing. Thanks for your hard work .....
One question, is every Version on the PI (the Part that ist running on the PI) working with every version that is flashed on the board
i compiled commit c380d46 and flashed it on my board successfully. Is the newest commit of the PI part working with this "serverversion"? I hope my question is clear .....

@colintate
Copy link

Apologies for the lack of logs/data etc, but I just wanted to say I have had similar issues, and with help from a few people managed to resolve using ec3d865.

  • SKR Mini E3 v1.2
  • Worked with git ec3d865 / Did not work with latest build (as of 10th October 2019)
  • STM32F103 with a "28KiB bootloader".
  • "Enable extra low-level configuration options"
  • Configure "GPIO pins to set at micro-controller startup" to "!PC13".

@KevinOConnor
Copy link
Collaborator

Those with an SKR Mini (and similar) should retry with the latest code (commit 1e8582e).

-Kevin

@thomil
Copy link

thomil commented Oct 13, 2019

I can confirm that commit 1e8582e fixes the USB connection issue on an SKR Mini E3 DIP. Thanks a lot for your efforts and for fixing this.

Do you have any theory of how reverting the SPI changes from commit 7031202 seems to have worked around this issue?

@theophile
Copy link
Contributor

I don't know if it's related or not, but when I try to update an SKR mini 1.1 using "make flash" I get this error:

Flashing out/klipper.bin to /dev/serial/by-id/usb-Klipper_Klipper_firmware_54321-if00
Entering bootloader on /dev/serial/by-id/usb-Klipper_Klipper_firmware_54321-if00
Device reconnect on /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.3/1-1.1.3:1.0
sudo dfu-util -p 1-1.1.3 -R -a 2 -D out/klipper.bin

dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

dfu-util: Invalid DFU suffix signature
dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!
dfu-util: No DFU capable USB device available

Failed to flash to /dev/serial/by-id/usb-Klipper_Klipper_firmware_54321-if00: Error running dfu-util

If the device is already in bootloader mode it can be flashed with the
following command:
  make flash FLASH_DEVICE=1eaf:0003

If attempting to flash via 3.3V serial, then use:
  make serialflash FLASH_DEVICE=/dev/serial/by-id/usb-Klipper_Klipper_firmware_54321-if00

src/stm32/Makefile:50: recipe for target 'flash' failed
make: *** [flash] Error 255

@pusewicz
Copy link
Contributor

@KevinOConnor Can confirm it connects on SKR MINI E3 V1:

[  689.725461] usb 2-2.2: new full-speed USB device number 14 using uhci_hcd
[  689.840120] usb 2-2.2: New USB device found, idVendor=2341, idProduct=abcd
[  689.840122] usb 2-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  689.840123] usb 2-2.2: Product: Klipper firmware
[  689.840123] usb 2-2.2: Manufacturer: Klipper
[  689.840124] usb 2-2.2: SerialNumber: 12345
[  689.843501] cdc_acm 2-2.2:1.0: ttyACM0: USB ACM device

@pusewicz
Copy link
Contributor

@theophile Flashing through USB does not work on SKR MINI for now. Copy the klipper.bin to the MicroSD as firmware.bin and restart the board. It should auto-reflash itself.

@Rubber1Duck
Copy link

I can confirm that commit 1e8582e fixes the USB connection issue on an SKR Mini E3 DIP, too.
Thanks a lot for your efforts and for fixing this.

@vladbabii
Copy link
Author

@KevinOConnor i can confirm lastest commit 1e8582e works with mini 1.1

[334140.626994] usb 1-1.2.1: new full-speed USB device number 11 using xhci_hcd
[334140.727254] usb 1-1.2.1: device descriptor read/64, error -32
[334140.947245] usb 1-1.2.1: device descriptor read/64, error -32
[334141.167001] usb 1-1.2.1: new full-speed USB device number 12 using xhci_hcd
[334141.267261] usb 1-1.2.1: device descriptor read/64, error -32
[334141.487266] usb 1-1.2.1: device descriptor read/64, error -32
[334141.607129] usb 1-1.2-port1: attempt power cycle
[334142.267032] usb 1-1.2.1: new full-speed USB device number 13 using xhci_hcd
[334142.306128] usb 1-1.2.1: New USB device found, idVendor=2341, idProduct=abcd, bcdDevice= 1.00
[334142.306143] usb 1-1.2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[334142.306156] usb 1-1.2.1: Product: Klipper firmware
[334142.306168] usb 1-1.2.1: Manufacturer: Klipper
[334142.306179] usb 1-1.2.1: SerialNumber: 12345
[334142.308957] cdc_acm 1-1.2.1:1.0: ttyACM0: USB ACM device

Testing the board now...

@Wireheadbe
Copy link

skr mini v1.2 board is working with latest pull from git, but using
stty -F /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00 -hupcl before attempting any connection

@r15ch13
Copy link

r15ch13 commented Oct 14, 2019

Connecting to SKR E3 DIP also works with 1e8582e.
But make flash FLASH_DEVICE=/dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
doesn't work. Same error as #1884 (comment)

@KevinOConnor
Copy link
Collaborator

Do you have any theory of how reverting the SPI changes from commit 7031202 seems to have worked around this issue?

No, I don't know why the old code sometimes worked. It's possible some obscure race was allowing the usb packet memory to function long enough and/or some obscure race resulted in a well timed reset after enabling the usb clock.

But make flash doesn't work.

The bootloader on the skr mini does not support writes by usb. Follow the directions at the top of config/generic-bigtreetech-skr-mini.cfg to flash.

-Kevin

@vladbabii
Copy link
Author

@KevinOConnor would changing bootloader make the board capable of upload firmware via usb ? or maybe using openocd ?

@KevinOConnor
Copy link
Collaborator

Myself and some others have replaced the bootloader with the stm32duino bootloader which does support flashing over usb. Specifically this file was used: https://github.com/rogerclarkmelbourne/STM32duino-bootloader/raw/master/bootloader_only_binaries/generic_boot20_pb7.bin

As a general notice, replacing the bootloader is an advanced option - there is some info in docs/Bootloaders.md, but be sure you are comfortable with the operation and are confident you can restore the old bootloader before proceeding.

-Kevin

@pusewicz
Copy link
Contributor

@KevinOConnor What's required hardware-wise to flash the new bootloader?

I imagine this is the approach to take? https://github.com/KevinOConnor/klipper/blob/master/docs/Bootloaders.md#stm32f103-with-stm32duino-bootloader

Anybody else willing to share the actual steps (ideally with pics if applicable?)

@vladbabii
Copy link
Author

Once i manage to figure out all the steps I will post here unless someone beats me to it.

@KevinOConnor
Copy link
Collaborator

I'm going to close this ticket as it appears the original issue has been resolved.

-Kevin

@theophile
Copy link
Contributor

@vladbabii, were you able to successfully flash a USB-capable bootloader to the mini 1.1? If so, could you share your steps? Thanks!

@theophile
Copy link
Contributor

@vladbabii, just wanted to check in with you and see if you were able to flash a USB-capable bootloader to the SKR Mini v1.1? If so, what was your procedure?

@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests