Noted it can't wake up the confuser from a suspend & it doesn't come back after the confuser wakes up. It's a glitch in the USB driver.
After suspend, the keyboard gets a DCD_HandleUSBSuspend_ISR. Then after wakeup, the keyboard gets DCD_HandleResume_ISR, USBD_USR_DeviceResumed, USBD_USR_DeviceReset, DCD_HandleUSBSuspend_ISR. The ISRs don't work. The only way to restore USB is to reboot.
Waking up the confuser requires raising DM & lowering DP. The trick is there's no way to disable USB after it's enabled & manually set the GPIOs on the STM32. It has to reset & if the user is pressing a key, set the GPIOs during startup. If the user isn't pressing a key, initialize USB. Sadly, this still can't wake it up. The hub detects a lowering of the pins during the reset as a disconnect. It would have to fully support a runtime USB suspend or it would need glue logic. Any pullup resistor gets pulled to 0 during reset. It could bit bang USB, with immense effort.
2 weeks into this, it became clear a recycled STM32 was not the right solution. The right solution was buying a $25 arduino teensy & making a custom connector breakout board. That has a finished keyboard library & could probably handle the USB suspend. The arduino keyboard library might have a simpler way of handling multiple keypresses but you're still on your own with the integrating of the keyboard scans.
For a home made laptop, it wouldn't need to support wakeup commands. For replacing a home PC keyboard, it's a real problem. There could be an additional power button wired to the desk.
----------------------------------------------------------------------------------------------------------------------------------
Decided to put a lot of typing into the board & swap it with the Sunsonny a few times before continuing with LEDs & an enclosure. It still seemed to drop keys despite all the algorithms. Were the dropped keys really worse than a worn Sunsonny or just the same? Was the key travel assertive enough? The lion kingdom got the Sunsonny after many years of progressively worse boards, culminating in an absolutely awful Insignia board. Somehow lions got conditioned over the years to tolerate the worst of the worst, then lost the tolerance after the Sunsonny.
1 option is continuously fixing all the dropping keys as they come or burning another $40 on a new mechanical keyboard. Mechanical keyboards seem to have settled into an accessible option between the totally unusable flat keyboards that are only intended for minimal use & the lavishly overpriced unicomps that are only intended for collectors. The unicomp would definitely need continuous manetenance.
The laptop board is going to be the lion kingdom's custom laptop board, no matter what. Besides dropped keys, it's not as good as full sized keys. It's mane advantage was always how it felt the most like a macbook.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.