Skip to content

Commit 9c7816d

Browse files
More doc cleanup
1 parent c66e7e3 commit 9c7816d

File tree

4 files changed

+134
-188
lines changed

4 files changed

+134
-188
lines changed

README.md

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# ESP32 HUB75 DMA Driver
22

3+
[![ESP Component Registry](https://components.espressif.com/components/stuartparmenter/esp-hub75/badge.svg)](https://components.espressif.com/components/stuartparmenter/esp-hub75)
4+
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/stuartparmenter/library/esp-hub75.svg)](https://registry.platformio.org/libraries/stuartparmenter/esp-hub75)
5+
36
High-performance DMA-based driver for HUB75 RGB LED matrix panels, supporting ESP32, ESP32-S2, ESP32-S3, ESP32-C6, and ESP32-P4.
47

58
## Features
@@ -24,7 +27,19 @@ High-performance DMA-based driver for HUB75 RGB LED matrix panels, supporting ES
2427

2528
## Installation
2629

27-
Add to your project via Component Manager (`idf_component.yml`):
30+
### ESP-IDF Component Manager
31+
32+
Add to your project's `idf_component.yml`:
33+
34+
```yaml
35+
dependencies:
36+
hub75:
37+
version: "^0.1.0"
38+
```
39+
40+
Browse on the [ESP Component Registry](https://components.espressif.com/components/stuartparmenter/esp-hub75).
41+
42+
Or install from git:
2843
2944
```yaml
3045
dependencies:
@@ -33,13 +48,57 @@ dependencies:
3348
path: components/hub75 # Important: point to the component subdirectory!
3449
```
3550
51+
### PlatformIO
52+
53+
Add to `platformio.ini`:
54+
55+
```ini
56+
lib_deps =
57+
stuartparmenter/esp-hub75@^0.1.0
58+
```
59+
60+
Browse on the [PlatformIO Registry](https://registry.platformio.org/libraries/stuartparmenter/esp-hub75).
61+
62+
### Manual Installation
63+
3664
See [Component Documentation](components/hub75/README.md) for manual installation options.
3765

3866
## Quick Start
3967

40-
Configure your panel hardware, set GPIO pins, call `begin()`, and start drawing pixels. The driver handles continuous DMA refresh automatically - no CPU intervention needed after initialization. Supports single pixels (`set_pixel`), bulk writes (`draw_pixels`), and double buffering for tear-free animation.
68+
```cpp
69+
#include "hub75.h"
70+
71+
void app_main() {
72+
// Configure your panel
73+
Hub75Config config{};
74+
config.panel_width = 64;
75+
config.panel_height = 64;
76+
config.scan_pattern = Hub75ScanPattern::SCAN_1_32;
77+
config.shift_driver = ShiftDriver::FM6126A; // Try this if GENERIC doesn't work
78+
79+
// Set GPIO pins (example for ESP32-S3)
80+
config.pins.r1 = 42; config.pins.g1 = 41; config.pins.b1 = 40;
81+
config.pins.r2 = 38; config.pins.g2 = 39; config.pins.b2 = 37;
82+
config.pins.a = 45; config.pins.b = 36; config.pins.c = 48;
83+
config.pins.d = 35; config.pins.e = 21;
84+
config.pins.lat = 47; config.pins.oe = 14; config.pins.clk = 2;
85+
86+
// Initialize and draw
87+
Hub75Driver driver(config);
88+
driver.begin();
89+
driver.set_pixel(10, 10, 255, 0, 0); // Red pixel at (10,10)
90+
}
91+
```
92+
93+
See [examples/01_basic/simple_colors](examples/01_basic/simple_colors) for complete working example and [examples/common/](examples/common/) for board-specific pin configurations.
94+
95+
## Getting Started Paths
4196

42-
See [examples/](examples/) for working code and [Component Documentation](components/hub75/README.md) for complete API reference.
97+
- **First time with HUB75 panels?** → See [Quick Start](#quick-start) above, then try [examples/01_basic/](examples/)
98+
- **Setting up multiple panels?** → See [Multi-Panel Guide](docs/MULTI_PANEL.md)
99+
- **Display not working?** → See [Troubleshooting Guide](docs/TROUBLESHOOTING.md)
100+
- **Want to understand the internals?** → See [Architecture Overview](docs/ARCHITECTURE.md)
101+
- **Need complete API reference?** → See [Component Documentation](components/hub75/README.md)
43102

44103
## Building & Testing Standalone
45104

components/hub75/README.md

Lines changed: 47 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,17 @@ ESP-IDF component for driving HUB75 RGB LED matrix panels via DMA. Supports ESP3
1717

1818
### Option 1: Component Manager (Recommended)
1919

20-
In your project's `idf_component.yml`:
20+
**From ESP Component Registry:**
21+
22+
```yaml
23+
dependencies:
24+
hub75:
25+
version: "^1.0.0"
26+
```
27+
28+
Browse versions on the [ESP Component Registry](https://components.espressif.com/components/stuartparmenter/esp-hub75).
29+
30+
**From Git:**
2131
2232
```yaml
2333
dependencies:
@@ -26,7 +36,7 @@ dependencies:
2636
path: components/hub75 # Important: point to subdirectory!
2737
```
2838
29-
For local development:
39+
**For local development:**
3040
3141
```yaml
3242
dependencies:
@@ -149,197 +159,69 @@ Double buffering doubles memory usage but enables tear-free animation. PARLIO us
149159

150160
## Configuration Options
151161

152-
### Hardware Specifications
153-
154-
```cpp
155-
Hub75Config config{}; // Start with defaults
156-
157-
// Single Panel Hardware
158-
config.panel_width = 64; // Single panel width in pixels
159-
config.panel_height = 64; // Single panel height in pixels
160-
config.scan_pattern = Hub75ScanPattern::SCAN_1_32; // Hardware scan pattern
161-
config.scan_wiring = ScanPattern::STANDARD_TWO_SCAN; // Coordinate remapping
162-
config.shift_driver = ShiftDriver::GENERIC; // LED driver chip type
163-
```
164-
165-
**Scan Pattern Options:**
166-
- `SCAN_1_2` - 2-row pairs (4px high panels)
167-
- `SCAN_1_4` - 4-row pairs (8px high panels)
168-
- `SCAN_1_8` - 8-row pairs (16px high panels)
169-
- `SCAN_1_16` - 16-row pairs (32px high panels)
170-
- `SCAN_1_32` - 32-row pairs (64px high panels)
171-
172-
Must match panel hardware. Formula: `num_rows = height / scan_pattern_value`
173-
174-
**Scan Wiring Options:**
175-
- `STANDARD_TWO_SCAN` - Most panels (default, no coordinate remapping)
176-
- `FOUR_SCAN_16PX_HIGH` - Four-scan 1/4 scan, 16-pixel high panels
177-
- `FOUR_SCAN_32PX_HIGH` - Four-scan 1/8 scan, 32-pixel high panels
178-
- `FOUR_SCAN_64PX_HIGH` - Four-scan 1/8 scan, 64-pixel high panels
179-
180-
For panels with non-standard internal wiring that require coordinate remapping.
181-
182-
**Shift Driver Options:**
183-
- `GENERIC` - Standard panels with no special initialization (default)
184-
- `FM6126A` - Very common in modern panels (also works for ICN2038S)
185-
- `ICN2038S` - Alias for FM6126A (same initialization sequence)
186-
- `FM6124` - FM6124 family panels
187-
- `MBI5124` - MBI5124 panels (requires `clk_phase_inverted = true`)
188-
- `DP3246` - DP3246 panels (special timing requirements)
189-
190-
**Tip:** If panel shows incorrect colors or doesn't light up with `GENERIC`, try `FM6126A` first - it's the most common driver chip in modern panels.
191-
192-
### Multi-Panel Physical Layout
162+
### Quick Examples
193163

164+
**Single 64×64 panel:**
194165
```cpp
195-
// Multi-panel configuration (optional, defaults to single panel)
196-
config.layout_rows = 1; // Number of panels vertically
197-
config.layout_cols = 1; // Number of panels horizontally
198-
config.layout = PanelLayout::HORIZONTAL; // Chaining pattern
166+
Hub75Config config{};
167+
config.panel_width = 64;
168+
config.panel_height = 64;
169+
config.scan_pattern = Hub75ScanPattern::SCAN_1_32;
170+
config.shift_driver = ShiftDriver::FM6126A; // Try this if GENERIC doesn't work
199171
```
200172

201-
**Layout Options:**
202-
- `HORIZONTAL` - Simple left-to-right chain (single row only)
203-
- `TOP_LEFT_DOWN` - Serpentine, start top-left corner
204-
- `TOP_RIGHT_DOWN` - Serpentine, start top-right corner
205-
- `BOTTOM_LEFT_UP` - Serpentine, start bottom-left corner
206-
- `BOTTOM_RIGHT_UP` - Serpentine, start bottom-right corner
207-
- `TOP_LEFT_DOWN_ZIGZAG` - Zigzag, start top-left (all panels upright)
208-
- `TOP_RIGHT_DOWN_ZIGZAG` - Zigzag, start top-right (all panels upright)
209-
- `BOTTOM_LEFT_UP_ZIGZAG` - Zigzag, start bottom-left (all panels upright)
210-
- `BOTTOM_RIGHT_UP_ZIGZAG` - Zigzag, start bottom-right (all panels upright)
211-
212-
**Serpentine vs Zigzag:**
213-
- **Serpentine**: Alternate rows are physically mounted upside down (saves cable length)
214-
- **Zigzag**: All panels mounted upright, cables route back between rows (longer cables)
215-
216-
**Row-Major Chaining:** Panels chain HORIZONTALLY across rows (not vertically down columns). This matches the ESP32-HUB75-MatrixPanel-DMA reference library.
217-
218-
### Performance & Timing
219-
173+
**Two panels side-by-side:**
220174
```cpp
221-
// Performance
222-
config.output_clock_speed = Hub75ClockSpeed::HZ_20M; // Clock speed
223-
config.bit_depth = 8; // BCM bit depth: 6-12
224-
config.min_refresh_rate = 60; // Minimum refresh rate in Hz
225-
226-
// Timing
227-
config.latch_blanking = 1; // OE blanking cycles during LAT
228-
config.clk_phase_inverted = false; // Invert clock phase (MBI5124)
229-
230-
// Features
231-
config.double_buffer = false; // Enable double buffering
232-
config.temporal_dither = false; // Enable temporal dithering (NYI)
233-
234-
// Color
235-
config.gamma_mode = Hub75GammaMode::CIE1931; // Gamma correction mode
236-
config.brightness = 128; // Initial brightness (0-255)
175+
config.layout_cols = 2; // Two panels horizontally
176+
config.layout = PanelLayout::HORIZONTAL;
177+
// Virtual display: 128×64
237178
```
238179

239-
**Clock Speed Options:**
240-
- `HZ_8M` - 8 MHz (most compatible)
241-
- `HZ_10M` - 10 MHz
242-
- `HZ_16M` - 16 MHz
243-
- `HZ_20M` - 20 MHz (default, works with most panels)
244-
245-
Higher speeds may cause signal integrity issues with long cables or poor-quality panels.
246-
247-
**Bit Depth:**
248-
- 6-bit: Fast refresh, basic color depth
249-
- 8-bit: Good balance (default)
250-
- 10-bit: Better gradients, recommended for smooth animations
251-
- 12-bit: Best quality, slower refresh
252-
253-
Higher bit depth = more descriptors + slower refresh rate.
254-
255-
### Pin Configuration
256-
180+
**Higher quality display:**
257181
```cpp
258-
// GPIO pin assignments (example for ESP32-S3)
259-
config.pins.r1 = 25; // Red data (top half)
260-
config.pins.g1 = 26; // Green data (top half)
261-
config.pins.b1 = 27; // Blue data (top half)
262-
config.pins.r2 = 14; // Red data (bottom half)
263-
config.pins.g2 = 12; // Green data (bottom half)
264-
config.pins.b2 = 13; // Blue data (bottom half)
265-
config.pins.a = 23; // Row address bit A
266-
config.pins.b = 19; // Row address bit B
267-
config.pins.c = 5; // Row address bit C
268-
config.pins.d = 17; // Row address bit D
269-
config.pins.e = -1; // Row address bit E (-1 if unused)
270-
config.pins.lat = 4; // Latch
271-
config.pins.oe = 15; // Output enable
272-
config.pins.clk = 16; // Clock
182+
config.bit_depth = 10; // Better gradients
183+
config.double_buffer = true; // Tear-free updates
184+
config.min_refresh_rate = 90; // Smoother for cameras
273185
```
274186

275-
**GPIO Restrictions:**
276-
- Avoid strapping pins (GPIO0, GPIO46, etc.)
277-
- ESP32-S3: GPIO19/20 unavailable if USB CDC enabled
278-
- Check ESP32 variant datasheets for input-only pins
279-
- Some platforms have restrictions on which peripherals can use which pins
280-
281-
**Pre-configured Examples:** See repository [examples/common/pins_example.h](https://github.com/stuartparmenter/esp-hub75/blob/main/examples/common/pins_example.h) for tested pin configurations for different boards.
187+
**For complete configuration reference** (all scan patterns, layouts, clock speeds, bit depth options, pin configuration, etc.), see **[MENUCONFIG.md](../../docs/MENUCONFIG.md)**.
282188

283189
## Multi-Panel Layouts
284190

285-
Chain multiple panels for larger displays. Panels connect **horizontally across rows** (row-major traversal).
191+
Chain multiple panels for larger displays:
286192

287-
**Simple Example** (2 panels side-by-side):
288193
```cpp
289194
config.panel_width = 64;
290195
config.panel_height = 64;
291-
config.layout_rows = 1; // Single row
292-
config.layout_cols = 2; // Two panels
293-
config.layout = PanelLayout::HORIZONTAL;
294-
// Virtual display: 128×64 pixels
196+
config.layout_rows = 2; // Two rows vertically
197+
config.layout_cols = 3; // Three panels per row
198+
config.layout = PanelLayout::TOP_LEFT_DOWN; // Serpentine wiring
199+
// Virtual display: 192×128 pixels
295200
```
296201

297-
**Layout Types:**
298-
- `HORIZONTAL` - Simple left-to-right chain (single row)
299-
- `TOP_LEFT_DOWN` - Serpentine wiring (alternate rows upside down, saves cable)
300-
- `TOP_LEFT_DOWN_ZIGZAG` - Zigzag wiring (all panels upright, longer cables)
202+
Panels chain **horizontally across rows** (row-major). Serpentine layouts have alternate rows mounted upside down to save cable length.
301203

302-
**For complete guide** including layout patterns, wiring diagrams, serpentine vs zigzag, coordinate remapping, and troubleshooting, see **[Multi-Panel Guide](../../docs/MULTI_PANEL.md)**.
204+
**For complete multi-panel guide** (layout patterns, wiring diagrams, coordinate remapping), see **[Multi-Panel Guide](../../docs/MULTI_PANEL.md)**.
303205

304-
## Platform-Specific Notes
206+
## Platform Support
305207

306-
| Platform | Status | Memory Pool | BCM Method | 64×64 Buffer |
307-
|----------|--------|-------------|------------|--------------|
308-
| **ESP32-S3** (GDMA) | ✅ Tested | Internal SRAM | Descriptor duplication | ~57 KB |
309-
| **ESP32/S2** (I2S) | ⏳ Not tested | Internal SRAM | Descriptor duplication | ~57 KB |
310-
| **ESP32-P4** (PARLIO) | ✅ Tested | **PSRAM** | Buffer padding + clock gating | ~284 KB |
311-
| **ESP32-C6** (PARLIO) | ⏳ Not tested | PSRAM | Buffer padding (no clock gating) | ~284 KB |
208+
Supports ESP32, ESP32-S2, ESP32-S3, and ESP32-P4 with platform-specific optimizations:
312209

313-
**Key Differences:**
314-
- **GDMA/I2S**: Fast internal SRAM, uses descriptor chains for BCM timing
315-
- **PARLIO (P4/C6)**: Uses PSRAM (frees ~500 KB internal SRAM for your app), buffer padding for BCM timing
316-
- **ESP32-P4 specific**: Hardware clock gating via MSB for precise display timing
210+
- **ESP32/ESP32-S2** (I2S): ~57 KB SRAM, proven stability
211+
- **ESP32-S3** (GDMA): ~57 KB SRAM, faster clock (40 MHz), ghosting fix
212+
- **ESP32-P4** (PARLIO): ~284 KB PSRAM + ~16 KB SRAM, frees internal memory for apps
213+
- **ESP32-C6** (PARLIO): Planned, same as P4 but no clock gating
317214

318-
**For detailed platform comparison**, implementation specifics, memory calculations, and when to choose each platform, see **[Platform Details](../../docs/PLATFORMS.md)** and **[Memory Usage](../../docs/MEMORY_USAGE.md)**.
215+
**For detailed platform comparison, memory calculations, and implementation specifics**, see **[Platform Details](../../docs/PLATFORMS.md)**.
319216

320217
## Troubleshooting
321218

322-
### Common Issues
323-
324-
**Black Screen:**
325-
- Try `shift_driver = ShiftDriver::FM6126A` (most modern panels)
326-
- Verify power supply adequate (3-5A per 64×64 panel)
327-
- Check pin mapping matches board layout
328-
329-
**Wrong Colors:**
330-
- Try `FM6126A` shift driver
331-
- Verify R1/G1/B1/R2/G2/B2 pin connections
332-
- Check scan pattern matches panel height
333-
334-
**Scrambled Display:**
335-
- Verify `scan_pattern` matches panel height (64px = SCAN_1_32)
336-
- Try `FOUR_SCAN_*` scan wiring variants for non-standard panels
337-
338-
**MBI5124 Panels:**
339-
- Must set `shift_driver = ShiftDriver::MBI5124`
340-
- Must set `clk_phase_inverted = true`
219+
**Common quick fixes:**
220+
- **Black screen** → Try `shift_driver = ShiftDriver::FM6126A` (most modern panels)
221+
- **Wrong colors** → Check R1/G1/B1/R2/G2/B2 pin mapping
222+
- **Scrambled display** → Verify `scan_pattern` matches panel height (64px = SCAN_1_32)
341223

342-
**For complete debugging guide** including ghosting, flickering, multi-panel issues, platform-specific problems, and error messages, see **[Troubleshooting Guide](../../docs/TROUBLESHOOTING.md)**.
224+
**For complete debugging guide** (ghosting, flickering, multi-panel issues, platform-specific problems, error messages), see **[Troubleshooting Guide](../../docs/TROUBLESHOOTING.md)**.
343225

344226
## Advanced Documentation
345227

docs/MULTI_PANEL.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,22 @@ Applications draw in virtual coordinates (0,0) to (width-1, height-1):
108108
- ✅ Cleaner physical installation
109109
- ⚠️ Must physically rotate alternate rows
110110

111+
### Serpentine vs Zigzag Comparison
112+
113+
| Factor | Serpentine | Zigzag |
114+
|--------|-----------|--------|
115+
| **Cable length** | ✅ Shorter (~50% savings) | ⚠️ Longer cables needed |
116+
| **Physical install** | ⚠️ Must rotate alternate rows 180° | ✅ All panels same orientation |
117+
| **Troubleshooting** | ⚠️ Harder (mixed orientations) | ✅ Easier (uniform) |
118+
| **Visual confirmation** | ⚠️ Text on alternate panels upside down | ✅ All labels readable |
119+
| **Best for** | Permanent installations, wall mounts | Prototyping, testing, temporary setups |
120+
121+
**Choose Serpentine when:** Cable management and clean install matter more than convenience
122+
123+
**Choose Zigzag when:** Ease of assembly/troubleshooting matters more than cable length
124+
125+
---
126+
111127
#### TOP_LEFT_DOWN (Serpentine)
112128

113129
**Start**: Top-left corner

0 commit comments

Comments
 (0)