summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorQMK Bot <hello@qmk.fm>2025-07-07 19:12:45 +0000
committerQMK Bot <hello@qmk.fm>2025-07-07 19:12:45 +0000
commite4e5bca6bcc0cdb13c645d3a8d2b350e5af4a36e (patch)
tree3a451ad7fcc113c132dcfca7f08b435dd26a3f4b /docs
parent7827f9fbe369bd9ad6c30c88f36ab53dafbb719d (diff)
parent8ff7b1de11dc9c095f3eb37f1ace24af136df144 (diff)
Merge remote-tracking branch 'origin/master' into develop
Diffstat (limited to 'docs')
-rw-r--r--docs/drivers/ws2812.md20
1 files changed, 16 insertions, 4 deletions
diff --git a/docs/drivers/ws2812.md b/docs/drivers/ws2812.md
index 4d1e727928..0c26ec6248 100644
--- a/docs/drivers/ws2812.md
+++ b/docs/drivers/ws2812.md
@@ -144,18 +144,30 @@ The following defines apply only to ARM devices:
144|`WS2812_T1L`|`(WS2812_TIMING - WS2812_T1H)`|The length of a "1" bit's low phase in nanoseconds (bitbang and PIO drivers only)| 144|`WS2812_T1L`|`(WS2812_TIMING - WS2812_T1H)`|The length of a "1" bit's low phase in nanoseconds (bitbang and PIO drivers only)|
145|`WS2812_T0L`|`(WS2812_TIMING - WS2812_T0H)`|The length of a "0" bit's low phase in nanoseconds (bitbang and PIO drivers only)| 145|`WS2812_T0L`|`(WS2812_TIMING - WS2812_T0H)`|The length of a "0" bit's low phase in nanoseconds (bitbang and PIO drivers only)|
146 146
147### Push-Pull and Open Drain {#push-pull-open-drain} 147### Logic Levels {#logic-levels}
148 148
149By default, the GPIO used for data transmission is configured as a *push-pull* output, meaning the pin is effectively always driven either to VCC or to ground. 149WS2812 LEDs usually operate at 5V, but some microcontrollers, particularly ARM-based ones, run on 3.3V. This can pose an issue when driving the LED chain as the logic level voltage is lower than the power supply voltage, leading to unreliable data transmission. There are two main workarounds:
150 150
151For situations where the logic level voltage is lower than the power supply voltage, however, this can pose an issue. The solution is to configure the pin for *open drain* mode instead, and use a pullup resistor between the DI pin and VCC. In this mode, the MCU can only pull the GPIO *low*, or leave it floating. The pullup resistor is then responsible for pulling the line high, when the MCU is not driving the GPIO. 151#### 1. Open Drain Circuit {#open-drain-circuit}
152 152
153To configure the DI pin for open drain configuration, add the following to your `config.h`: 153By default, `WS2812_DI_PIN` is configured as a *push-pull* output, meaning the pin is effectively always driven either to VCC or to ground; however, it can be configured in *open drain* mode instead.
154
155In this mode, the MCU will only pull the GPIO *low*, and leaves it floating otherwise. A pullup resistor (typically around 10kΩ) between DI and 5V is then responsible for pulling the line high when the MCU is not driving the GPIO.
156
157To use the DI pin in open drain configuration, add the following to your `config.h`:
154 158
155```c 159```c
156#define WS2812_EXTERNAL_PULLUP 160#define WS2812_EXTERNAL_PULLUP
157``` 161```
158 162
163::: warning
164Because the GPIO is being pulled to 5V in this situation rather than VCC (3.3V), **it must be a 5V tolerant pin**. Consult your MCU's datasheet first – if there are no eligible pins, you must use a level shifter instead.
165:::
166
167#### 2. Level Shifter {#level-shifter}
168
169A level shifter IC, such as the SN74LV1T34, can be placed between the GPIO and the first LED's DI pin to convert the 3.3V logic to 5V. This requires no additional configuration in the firmware, nor a 5V tolerant GPIO, but may be more expensive and is generally less handwire-friendly.
170
159### SPI Driver {#arm-spi-driver} 171### SPI Driver {#arm-spi-driver}
160 172
161Depending on the ChibiOS board configuration, you may need to enable SPI at the keyboard level. For STM32, this would look like: 173Depending on the ChibiOS board configuration, you may need to enable SPI at the keyboard level. For STM32, this would look like: