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

For kinesis/kint41 keyboard, do not enter lower-power sleep mode when on the ChibiOS idle thread (#23053). #23054

Closed
wants to merge 2 commits into from

Conversation

stevenbetten
Copy link

@stevenbetten stevenbetten commented Feb 11, 2024

Description

For kinesis/kint41 keyboard, do not enter lower-power sleep mode when on the ChibiOS idle thread (#23053).

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project: C, Python
  • I have read the PR Checklist document and have made the appropriate changes.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@fauxpark
Copy link
Member

This doesn't do anything.

@fauxpark fauxpark closed this Feb 12, 2024
@stevenbetten
Copy link
Author

Hi, fauxpark. Can you please elaborate on why you commented (and presumably think) that "This doesn't do anything"? Adding OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=FALSE to the rules.mk, as my commit does, definitely does set the value to FALSE, whereas the default for all keyboards is now TRUE. And setting this to FALSE fixes the issue on my and other people's kint41 keyboards as documented in kinx-project/kint#77. Can you please indicate where my analysis is incorrect? Thanks!

@stevenbetten
Copy link
Author

Hi, fauxpark, please see 416af01 for the commit that switched all keyboards to OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE, thus breaking kinesis/kint41, whose value was implicitly FALSE before that commit.

@fauxpark
Copy link
Member

Sounds like something is wrong with the MIMXRT1062 code in ChibiOS then.

@stevenbetten
Copy link
Author

stevenbetten commented Feb 13, 2024 via email

@fauxpark
Copy link
Member

Teensy 4.x boards are barely supported by QMK as it is.

@stevenbetten
Copy link
Author

stevenbetten commented Feb 13, 2024 via email

@fauxpark
Copy link
Member

That's not what I'm saying. This is not a bug in QMK, it is a bug in ChibiOS. You need to take it up there.

@tzarc
Copy link
Member

tzarc commented Feb 13, 2024

For clarity, the ChibiOS code for MIMXRT1062 was apparently written purely for the kint41. It seems to be a bare-bones and potentially broken implementation -- it's been reported that anything to do with timing in QMK is flat-out broken on MIMXRT1062-based boards.

I've attached two files -- disassembly from before and after applying the PR. Apart from the WFI call, there seems to be a missing port_unlock()? Perhaps there's an issue with preprocessor in the underlying ChibiOS port, mistakenly removing the wrong function call?

kinesis_kint41_default.elf.base.dis.txt
kinesis_kint41_default.elf.pr.dis.txt

I'd say the general issue here is that the usual interrupts aren't firing, and ChibiOS isn't scheduling the QMK main thread for execution as a result. Interrupts such as USB or SysTick tend to keep QMK running, and perhaps these aren't enabled in the MIMXRT1062 port.

Also something to at least try -- ChibiOS creates an idle thread even though QMK should be running as a hard loop -- you could try adding -DCH_CFG_NO_IDLE_THREAD=TRUE to instruct ChibiOS not to create the idle thread. This isn't likely going to be accepted as a fix; it's more we don't have any MIMXRT1062 boards that we can test with -- adding the define will tell us more about the correct course of action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] keyboards/kinesis/kint41 hangs for 10 seconds or indefinitely
3 participants