-
-
Notifications
You must be signed in to change notification settings - Fork 40.4k
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
Add ifndef to WS2812 timing constraints #14678
Conversation
Due to the way that the PrimeKB Meridian PCB was designed, this change is needed in order to properly adjust the LEDs. Testing: * Compiled primekb/meridian:default successfully * Compiled random board (walletburner/neuron:default) successfully
Missed some spacing
Added a new commit to fix the linting errors. |
Spacing on the comments... really?
If these defines are exposed as a public interface, as a minimum, they should be renamed to something like However, did you actually check the resulting timings with an oscilloscope or logical analyzer? Some time ago I measured the timings produced by the bitbang driver on STM32F401, and with the default settings (T0H=350, T1H=900, period=1250) I actually got T0H = 167…177 us, T1H = 719…730 us, period = 948…1385 us with a peak at 990 us (but whatever WS2812-like LEDs I had still worked with those timings). So the real problem is that the bitbang driver may be producing timings that are far off the expected values, and your adjustments just make its behavior closer to the spec without completely fixing the problem. I'm not sure how to fix the bitbang driver completely, however (these things were much simpler on AVR chips, but getting cycle-level precision on various ARM chips may be much more complicated). |
@sigprof Thank you for your thoughts. Your explanation here and in PR#11755 make sense and I think they describe the small issue that was occurring that we were experiencing with the PCBs that utilized actual World Semi WS2812 LEDs. Basically if any of the indicator functions (caps/num/scroll/layer/etc) were spammed then the LEDs would bug out. My assumption is that the driver, and therefore the default timings, were based on the World Semi WS2812 data sheet. And I assume most WS2812 clone LEDs are manufactured to comparable specs. However, with the second and much larger batch of PCBs, the LEDs that the PCB manufacturer substituted in lieu of actual World Semi WS2812 apparently stray a bit too far off from these specifications. They simply do not work with the default timings available in the chibios WS2812 drivers. It's possible that the issue is caused by a combination of this deviation from 'standard' spec and what you outlined here and in the other PR. I spent quite a lot of time trying to trouble shoot these LEDs through countless builds and experimentation. Which included both bit bang and SPI drivers. Unfortunately the alternative timings is the only solution that worked. Specifically it was the T1L and TRST variable that deviated most severely from the 'standard'. Mind you the values I used were based on the hardware datasheet for the actual LED used by the manufacturer. I just wanted to add a bit of history and context as to how this PR came about. Happy to try any other recommendations you guys have. quick edit we did implement and test both of the following suggestions from the other PR
Neither produced any positive results |
There is also another option you could try — the PWM driver: Could you test this on your boards? You can also try changing And yet another workaround you can try is increasing |
As for the SPI driver, the timings from it might really be not ideal, but they are also not adjustable. With the default settings on F072 that driver runs SPI at 3 MHz, and this results in T0H = 333 ns, T1H = 1000 ns, period = 1333 ns. |
Unfortunately the PWM driver was a no go. The SPI driver gave poor results. PWN just didn't give any results at all. Increasing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change the rest of the file to match the defintiions, as well as adding appropriate documentation.
Would be good if the other ws2812 drivers got changed in the same way as well.
Retargeted to |
Thank you for the CR, I'll get a new commit out soon. |
Pulled in changes by @Gondolindrim as requested. |
Ok guys, so a summary of the changes: I incorporated the naming convenstions that @tzarc requested; the new core files were flashed into Meridian PCBs with KTR1010 LEDs, which use different timing parameters than the WS2812 defaults, and work fine. To test if the changes break the SPI or the PWM driver we used:
Both also work splendidly. The changes also encompass a change in the documentation of the WS2812 drivers; basically these macros can be redefined in the keyboard's |
Thank you everyone for helping to get this implemented. Cheers! |
* qmk/develop: More headroom. (qmk#15302) More headroom. (qmk#15301) Documentation typo fix (qmk#15298) New feature: `DYNAMIC_TAPPING_TERM_ENABLE` (qmk#11036) Tidy up adjustable ws2812 timing (qmk#15299) Add ifndef to WS2812 timing constraints (qmk#14678) Add Retro Shift (Auto Shift for Tap Hold via Retro Tapping) and Custom Auto Shifts (qmk#11059)
Description
Due to the way that the PrimeKB Meridian PCB was assembled (LEDs not to spec), this change is needed in order to properly use the LEDs.
Note that this change alone does not fix the LEDs. A follow-up PR with changes to the keyboard firmware will fully solve the issue.
Types of Changes
Issues Fixed or Closed by This PR
Checklist