qmk / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
18.02k stars 38.74k forks source link

[Bug] The slave side hangs up at cold start of PC in the case of a split keyboard with Raspberry Pi Pico #18571

Closed yoichiro closed 1 year ago

yoichiro commented 1 year ago

The slave side certainly hangs up at cold start of a PC in the case of a split keyboard with Raspberry Pi Pico.

Describe the Bug

I have created a Lunakey Pico keyboard which is the split keyboard and each side has a Raspberry Pi Pico. Each side is connected by TRRS cable. When a cold startup of my PC, the slave side certainly hangs up. Then, when reconnecting the USB cable, it works.

The following list is I tried:

The PCB design file is: https://github.com/yoichiro/lunakey/tree/main/pico/rev2/pcb

System Information

Keyboard: Lunakey Pico Operating system: Microsoft Windows 11 and Ubuntu Linux 22.04 qmk doctor output:

Ψ QMK Doctor is checking your environment.
Ψ CLI version: 1.1.0
Ψ QMK home: /home/yoichiro/projects/keyboard/qmk_firmware
Ψ Detected Linux.
⚠ Missing or outdated udev rules for 'atmel-dfu' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'kiibohd' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'stm32-dfu' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'apm32-dfu' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'gd32v-dfu' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'bootloadhid' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'usbasploader' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'usbtinyisp' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'md-boot' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Detected ModemManager without the necessary udev rules. Please either disable it or set the appropriate udev rules if you are using a Pro Micro.
⚠ Missing or outdated udev rules for 'caterina' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
⚠ Missing or outdated udev rules for 'hid-bootloader' boards. Run 'sudo cp /home/yoichiro/projects/keyboard/qmk_firmware/util/udev/50-qmk.rules /etc/udev/rules.d/'.
Ψ Git branch: master
Ψ Repo version: 0.18.8
Ψ - Latest master: 2022-10-01 12:54:42 +1000 (9f0d9b4fbe) -- onekey: fix quine keymap (#18555)
Ψ - Latest upstream/master: 2022-10-03 12:26:04 +1100 (cc1565f2a3) -- `:flash`: print bootloader (#18569)
Ψ - Latest upstream/develop: 2022-10-02 09:36:07 +1100 (c4ff8192c2) -- Reverse keymap search order (#18449)
Ψ - Common ancestor with upstream/master: 2022-10-01 12:54:42 +1000 (9f0d9b4fbe) -- onekey: fix quine keymap (#18555)
Ψ - Common ancestor with upstream/develop: 2022-10-01 12:54:42 +1000 (9f0d9b4fbe) -- onekey: fix quine keymap (#18555)
Ψ All dependencies are installed.
Ψ Found arm-none-eabi-gcc version 10.3.1
Ψ Found avr-gcc version 5.4.0
Ψ Found avrdude version 6.3-20171130
Ψ Found dfu-util version 0.9
Ψ Found dfu-programmer version 0.6.1
Ψ Submodules are up to date.
Ψ Submodule status:
Ψ - lib/chibios: 2022-06-11 09:09:45 +0000 --  (f836d24b0)
Ψ - lib/chibios-contrib: 2022-07-27 10:46:15 +0200 --  (d03aa9cc)
Ψ - lib/googletest: 2021-06-11 06:37:43 -0700 --  (e2239ee6)
Ψ - lib/lufa: 2022-08-26 12:09:55 +1000 --  (549b97320)
Ψ - lib/pico-sdk: 2022-05-17 19:19:01 +0200 --  (07edde8)
Ψ - lib/printf: 2022-06-29 23:59:58 +0300 --  (c2e3b4e)
Ψ - lib/vusb: 2022-06-13 09:18:17 +1000 --  (819dbc1)
Ψ QMK is ready to go, but minor problems were found

Any keyboard related software installed?

tzarc commented 1 year ago

Possibly related to #18511?

yoichiro commented 1 year ago

@tzarc I guess that this issue is not same as the #18511, because the master side certaily works normally but the slave side does not work in my case.

drashna commented 1 year ago

Might be related to https://github.com/qmk/qmk_firmware/pull/18574

yoichiro commented 1 year ago

@drashna I will try latest code set to confirm whether this issue is reproduced or not later.

yoichiro commented 1 year ago

@drashna Unfortunately, this issue still occurs using the latest develop branch. Both sides certainly hang up at cold starting of my PC.

KarlK90 commented 1 year ago

Did you update the chibios-contrib submodule when switching to the develop branch? There is a critical bug fix for the USB driver. The easiest way to update would be to run make git-submodule in the root folder.

yoichiro commented 1 year ago

@KarlK90 I have already updated all sub modules and tried when switching to the develop branch. However, this issue was reproduced.

Then, I tried using SPLIT_USB_TIMEOUT 5000 and SPLIT_USB_TIMEOUT_POLL 25, and I was able to confirm that my keyboard was normally recognized and works. I close this issue. Thanks @drashna @KarlK90 @tzarc for advices!

yoichiro commented 1 year ago

@drashna @tzarc @KarlK90 I have tested the latest develop branch and the #define USB_VBUS_PIN GP24 and the #define SPLIT_HAND_PIN GP22 for Lunakey Pico which is a split keyboard using Raspberry Pi Pico just now. As the result, the keyboard finally normally works without using the SPLIT_USB_DETECT.

The slave side of the keyboard gets VCC from VSYS pin, therefore I thought that the USB_VBUS_PIN is available.

Screenshot_20221011_205458

Raspberry Pi Pico has the GPIO24 pin to detect whether VBUS is provided from USB or not.

Screenshot_20221011_204757

Using the develop branch, my Lunakey Pico keyboard launches normally and works without any delay of the SPLIT_USB_DETECT at cold starting of my PC.