Skip to content

UCS7604 impl #2088

Closed
Closed

Description

@second-string

I'd like to implement the UCS7604 protocol in FastLED. Unfortunately, the manufacturers don't display any protocol info their datasheets. I have UCS2904 and UCS7604 LEDs, and a closed-source driver than can drive both. The UCS2904 can be driven with FastLED using the TM1804 protocol, as they have similar (probably identical timings).

The UCS7604 one has two major differences from the hardware protocol perspective:

  1. There is a two-chunk preamble that sets things like max current per channel, speed of data section (800k vs. 1.6M), etc. First chunk is 8 bytes, second is 7, they are separated from each other and the main color data by ~260uS.
  2. There are 16 bits per R, G, B, and W channel instead of 8 (this should be changeable according to the data sheet, but I have to reverse engineer the proper bits to change in the preamble)

Difference #2 is not a huge deal for me right now, I can scale the incoming 1-byte data into 2-byte data in my firmware. Difference #1 is what I need to patch into FastLED. I'm not sure the best place to do this, however. I don't think I can just shove an extra few bytes into the front of the color data frame before transmitting to act as the config bytes because of the 260uS spacing. I will give it a try though, in case the IC doesn't actually care about the spacing and it's just counting bytes.

The clockless implementation I'm currently using is an ARM chip, which has its output written in the assembly loops. I think I would have to adapt the ASM loop in the m0clockless.h file to add two more loops before the color data, with an appropriate delay in between them. Any other ideas as an easier first way to implement this as a proof of concept?

Here are some labelled screenshots of the output for UCS7604, also with the Saleae capture file attached (Saleae's Logic app is free to download if you want to look through it). I've been able to figure out a couple of the config bits by toggling my driver's settings, but it doesn't have a setting for data width. My guess is that it's in the first two nibbles of the second preamble chunk, but I can't test it until I have a base implementation working from FastLED.

Not looking for anyone to do the work for me, just looking for guidance on the best architecture/implementation by those more familiar with the repo

Image Image Image

UCS7604 Red RGBW.sal.zip

Activity

  1. zackees commented on Sep 22, 2025

    @zackees
    Member

    This one is hard. You need a pause in the middle of your transmission, therefore the generic clockless controller won't work out of the box.

    My suggestion is to create a wrapper that takes in a clockless controller type so you can bit bang, wait, bit bang.

    This type of wrapper has been implemented via the RGBWEmulated controller. My suggestion is look how that class is implemented and adapt for your own use.

    Good luck!

  2. second-string commented on Sep 22, 2025

    @second-string
    Author

    RGBW was one that I was poking around it, I'll go a little deeper and check it out.

    The bitbang wrapper solution you've mentioned was one of the first things I was thinking of, but I wasn't sure if I could bitbang fast enough and tight enough to adhere to the timing requirements. The RGBWEmulated controller just has to do pre-processing on the data, then can shove it in the normal implementation-specific show function to blast it out as efficiently as possible.

    Do you know off the top of your head if that's possible (or if it has been done in the repo already) for port/pin register-based control? I'll give it a try regardless if the non-spaced hackier version doesn't work, but will take any prior knowledge I can get.

  3. zackees commented on Sep 22, 2025

    @zackees
    Member

    FastLED has fast pin manipulation at it's heart. That's what this library was original designed around and the name before "FastLED" was "FastSPI" because it implemented fast software spi.

    One thing I'm now unclear about is whether that preamble chunk + reset is just once for the whole strip or before one each pixel?

    If you need a reset time before every pixel then you're in trouble and will have to do manual software bit banging on everything.

  4. second-string commented on Sep 23, 2025

    @second-string
    Author

    Ah yes okay I've already worked a bit in the fastpin implementation when I ported a chip so hopefully that shouldn't be too much trouble, thanks.

    Just once for the whole strip, thankfully. The color data section is identical timing to UCS2904 (which can be driven by the FastLED-supported TM1804). So once I get the preamble sorted, I just need to figure out which bit to flip to switch from 16-bit to 8-bit data

  5. zackees commented on Sep 27, 2025

    @zackees
    Member

    Checking in: how's it going?

  6. second-string commented on Sep 29, 2025

    @second-string
    Author

    On holiday at the moment but luckily enough the ICs do not need the spacing pre-data - I was able to get it working by just shoving the 13 bytes at the front of the data payload and driving it all out of the pin with the normal showPixels code.

    I'm still working on getting all the bits figured out for changing the parameters (RGB vs RGBW, 800k vs. 1.6M, etc), but will ideally continue that work a bit late next week

  7. second-string commented on Oct 6, 2025

    @second-string
    Author

    Here's what I have figured out and successfully demonstrated on my LEDs

    Chunk 1

    This seems more of a framing header or clock sync so I don't think there's anything to tweak there. I tried changing the last byte between 0x02, 0x03, and 0x00 but the LEDs didn't respond to anything besides 0x02. I've left this at the default values shown in the screenshots above.

    Chunk 2

    5 out of the 8 bits here control parameters. Not sure what the other 3 do (if anything) but they had no reaction no matter what combination they were changed in. As listed in the first post, the next 4 bytes are current control for each channel. Bits listed most significant to least significant (i.e. bit 7 is first on the wire), this is different from how the screenshots are labelled above (sorry).

    Byte 0
    Bit 7: Bit depth per IC (works with bit 3, see Bit Depth note below)
    Bit 6: Unknown but causes no visible changes
    Bit 5: Unknown but causes no visible changes
    Bit 4: High speed (1, 1.6MHz) or standard speed (0, 800kHz) (note this is for the data bytes only, preamble chunks always 800k)
    Bit 3: Bit depth per IC (works with bit 7, see Bit Depth note below)
    Bit 2: Unknown but causes no visible changes
    Bit 1: Field mode high bit (see Field Mode note below)
    Bit 0: Field mode low bit (see Field Mode note below)

    Bytes 1-4
    Software current control per-channel. The driver I have only output up to 0x0F for each of these bytes, I don't know if that's the max or not. I also don't know how this works together with the hardware ILIM resistor, data sheet is unclear.

    Bytes 5-6
    Unknown, I didn't touch them, all zeroes works.

    Data

    Standard data output, RGBW ordering

    Notes

    Bit depth

    This one was a pain to figure. The data sheet says there are 4 modes, 8, 12, 14, and 16 bit. For 16 bit depth (i.e. you send two full bytes for red, two full bytes for blue, and so on) both of these bits must be set to 1. For 8 bit depth, both of these bits must be set to 0.

    When they are set to different values, the behaviour didn't seem correct for 12 or 14 bit depth. The very first byte of data would control the first pixel red, but then it would revert to what seemed like full 16 bit depth for every remaining channel. For example, second byte of data would control the high values of green brightness, third byte the low values, fourth byte high values of blue, and so on. I don't care about anything other than 8 and 16 bit though, so I didn't dive any deeper into this.

    Field mode
    The data sheet lists this fairly clearly: you can address each IC as 4 channels of color (R, G, B, and W), 3 channels (R, G, B, and W is never used), 2 channels (first channel is RG, then BW), or 1 channel (each 1 or 2 byte channel depending on bit depth controls all 4 channels of one IC simultaneously). There are two bits for this in the packet, so values 0-3, but the datasheet lists them as 1-4. An actual bit value of 3 corresponds to the standard mode 4: R, G, B, and W individual control. They decrease in the same order of the datasheet.

    So as an example, if you wanted 8-bit RGBW data instead of 16-bit, the first byte of chunk 2 would be 0x03 or 0x07 (doesn't matter) instead of the 0x8B shown in the screenshot above.

    I do not have the time right now to fully build this out into a mergeable PR (i.e. with the generic wrapper controller to prefix the necessary bits/bytes), I was doing my testing by adding code directly into the showRGBInternal function specifically for m0 chipsets. You can see a diff here (disregard most of the changes it's just auto-formatting).

  8. zackees commented on Oct 7, 2025

    @zackees
    Member

    Implement UCS7604 Protocol for FastLED

    Overview

    The UCS7604 is a 4-channel LED driver IC with 16-bit color resolution, configurable bit depth (8/12/14/16-bit), dual data rates (800kHz/1.6MHz), and RGBW support. This task implements FastLED controller support for UCS7604 chipsets using a generic preamble wrapper architecture.

    Datasheets & References

    Technical Specifications

    Hardware

    • Resolution: 16-bit (65,536 levels per channel)
    • Bit Depths: 8/12/14/16-bit configurable
    • Data Rates: 800 kbps or 1.6 Mbps
    • PWM Frequency: 16,000 KHz (~500fps camera compatible)
    • Color Modes: RGB or RGBW (digitally configurable)
    • Voltage: DC24V (5V regulator integrated)
    • Current Control: 4-bit per channel (0-60mA)
    • Features: Built-in gamma 2.2, redundant data line

    Protocol Structure

    [Chunk 1: 8 bytes] → [260µs delay] → [Chunk 2: 7 bytes] → [260µs delay] → [Pixel Data]
    

    Chunk 1 - Framing Header (8 bytes, always 800kHz)

    0xFF 0xFF 0xFF 0xFF 0xFF 0xFF 0x00 0x02
    

    Fixed values for clock sync. Last byte must be 0x02.

    Chunk 2 - Configuration (7 bytes, always 800kHz)

    [Config] [R Current] [G Current] [B Current] [W Current] [Reserved] [Reserved]
    

    Configuration Byte (bits 7-0):

    • Bits 7 & 3: Bit depth (00=8-bit, 11=16-bit)
    • Bit 4: Speed (1=1.6MHz, 0=800kHz) - applies to pixel data only
    • Bits 1 & 0: Field mode (11=RGBW, 10=RGB, 01=RG+BW, 00=all channels together)
    • Bits 6, 5, 2: Unknown/unused

    Current Control (bytes 1-4): Per-channel current limit 0x00-0x0F (interacts with hardware ILIM resistor)

    Examples:

    • 0x8B = 16-bit, 800kHz, RGBW
    • 0x9B = 16-bit, 1.6MHz, RGBW
    • 0x03 = 8-bit, 800kHz, RGBW

    Pixel Data

    • RGBW byte ordering
    • 8 bytes/pixel (16-bit mode) or 4 bytes/pixel (8-bit mode)
    • Transmitted at configured speed (800kHz or 1.6MHz)

    Implementation Architecture: Generic Preamble Wrapper

    Key Insight

    UCS7604 requires three transmissions with delays, which conflicts with FastLED's single-transmission model. Solution: Create a platform-agnostic wrapper that sends preambles, then delegates to existing clockless controllers.

    Architecture

    // Generic base (platform-agnostic)
    PreambleClocklessController<BASE_CONTROLLER, RGB_ORDER>
      ├── sendPreamble() [abstract, platform-specific]
      └── showPixels() [calls sendPreamble() then delegates to BASE_CONTROLLER]
    
    // Platform implementations
    PreambleClocklessController_ARM_M0    // Uses showLedData<>()
    PreambleClocklessController_ESP32_RMT // Uses RMT driver
    
    // User-facing controller
    UCS7604Controller<DATA_PIN, RGB_ORDER, MODE>
      └── Wraps base controller with UCS7604 preambles

    Advantages

    • ✅ Reuses existing controllers - no duplication of timing code
    • ✅ Platform-agnostic base - only sendPreamble() is platform-specific
    • ✅ Minimal code - ~100 lines vs ~500+ for monolithic approach
    • ✅ Extensible - easy to support future preamble-based protocols
    • ✅ Clean separation - preamble logic separate from pixel transmission

    Implementation Plan

    Phase 1: ARM M0 Reference Implementation (WORKING PROTOTYPE EXISTS)

    1. Formalize prototype code from ARM D21/D51 working implementation
    2. Create src/platforms/arm/common/preamble_m0clockless.h
      • Implements sendPreamble() using ARM's showLedData<>() function
      • Reuses same assembly routine for preambles and pixels
    3. Hardware validation on actual UCS7604 LEDs
      • Verify 8-bit, 16-bit, 800kHz, 1.6MHz modes
      • Confirm current control and timing tolerances

    Phase 2: Generic Wrapper Infrastructure

    1. Create src/chipsets/preamble_controller.h
      • Base template class for any preamble-based protocol
      • Abstract sendPreamble() method
      • Handles delays and delegation to base controller
    2. Create src/chipsets/ucs7604.h
      • UCS7604-specific configuration (chunks, modes)
      • Wraps preamble controller with UCS7604 settings
      • Exposes current control API

    Phase 3: ESP32 RMT Implementation

    1. Create src/platforms/esp/32/rmt_5/preamble_rmt_esp32.h
      • Implements sendPreamble() using RMT symbols
      • Builds unified buffer: [chunk1][gap][chunk2][gap][pixels]
      • Single RMT transmission with preambles included
    2. Test on ESP32 hardware

    Phase 4: Additional Platforms (As Needed)

    • ESP32 I2S/Parallel drivers
    • STM32 (similar to ARM M0)
    • Teensy 4.x
    • Document AVR as unsupported (timing constraints)

    Phase 5: Testing & Documentation

    • Unit tests for configuration byte generation
    • Example sketches (basic usage, RGBW, current control)
    • Update chipsets documentation
    • Add to supported chipsets list

    File Structure

    src/
    ├── chipsets.h                                # User-facing typedefs
    ├── chipsets/
    │   ├── preamble_controller.h                 # Generic wrapper base (NEW)
    │   └── ucs7604.h                             # UCS7604 configuration (NEW)
    ├── platforms/
    │   ├── arm/common/
    │   │   └── preamble_m0clockless.h            # ARM M0 impl (NEW)
    │   └── esp/32/rmt_5/
    │       └── preamble_rmt_esp32.h              # ESP32 RMT impl (NEW)
    examples/
    └── UCS7604_Basic/
        └── UCS7604_Basic.ino                     # Usage example (NEW)
    

    Usage Example

    #include <FastLED.h>
    
    #define DATA_PIN 6
    #define NUM_LEDS 100
    
    CRGB leds[NUM_LEDS];
    
    void setup() {
      // 16-bit RGBW mode (default)
      FastLED.addLeds<UCS7604, DATA_PIN, GRB>(leds, NUM_LEDS);
    
      // Or 8-bit mode:
      // FastLED.addLeds<UCS7604Controller8Bit, DATA_PIN, GRB>(leds, NUM_LEDS);
    }
    
    void loop() {
      leds[0] = CRGB::Red;
      FastLED.show();
    }

    Next Steps

    1. ✅ Start with ARM M0 - working prototype exists, fastest validation path
    2. Formalize ARM code into production-ready wrapper
    3. Test on hardware to validate protocol details
    4. Extract patterns from ARM for ESP32 port
    5. Create generic wrapper based on validated implementation
    6. Port to ESP32 using lessons learned
    7. Document platform support and limitations

    Open Questions

    1. 12-bit and 14-bit modes: How do mixed bit-depth settings actually work?
    2. Current control: Is 0x0F truly the maximum? Can higher values be used?
    3. Timing tolerances: How strict are the 260µs delays? Is there acceptable range?
    4. 1.6MHz reliability: Does high-speed mode work with long cable runs?
    5. Reset/latch time: What minimum delay is required after pixel data?
    6. Exact timing values: Precise T0H/T0L/T1H/T1L for both speeds?

    Design Decisions

    Why ARM M0 First?

    1. Working code exists - prototype drives actual UCS7604 hardware
    2. User has hardware - can validate immediately
    3. Simplest platform - direct GPIO, no driver complexity
    4. Fastest iteration - modify, flash, test cycle
    5. Protocol validation - confirms timing before tackling complex platforms

    Why Wrapper Pattern?

    1. Avoids code duplication - reuses existing showLedData<>() assembly
    2. Platform flexibility - each platform uses native transmission method
    3. Maintainability - preamble logic in one place
    4. Future-proof - other protocols can use same pattern (e.g., future UCS/TM chips)

    Platform-Specific Reality

    Different platforms have fundamentally different transmission models:

    • ARM: Direct bit-banging via showLedData<>() assembly
    • ESP32: Hardware peripherals (RMT, I2S, DMA-based)
    • Teensy 4: FlexIO DMA
    • AVR: May not support (timing too tight)

    The wrapper pattern provides unified API while allowing platform-appropriate implementations.


    Reference: Working ARM M0 Prototype

    This prototype code successfully drives UCS7604 LEDs on ARM D21/D51 platforms. It demonstrates the key pattern: calling showLedData<>() three times (chunk1, chunk2, pixels) with 260µs delays.

    // Based on src/platforms/arm/d21/clockless_arm_d21.h
    #ifndef __INC_CLOCKLESS_ARM_D21
    #define __INC_CLOCKLESS_ARM_D21
    
    #include "../common/m0clockless.h"
    #include "eorder.h"
    #include "fl/namespace.h"
    
    FASTLED_NAMESPACE_BEGIN
    #define FASTLED_HAS_CLOCKLESS 1
    
    template <uint8_t DATA_PIN, int T1, int T2, int T3, EOrder RGB_ORDER = RGB,
              int XTRA0 = 0, bool FLIP = false, int WAIT_TIME = 280>
    class ClocklessController : public CPixelLEDController<RGB_ORDER> {
        typedef typename FastPinBB<DATA_PIN>::port_ptr_t data_ptr_t;
        typedef typename FastPinBB<DATA_PIN>::port_t data_t;
    
        data_t mPinMask;
        data_ptr_t mPort;
        CMinWait<WAIT_TIME> mWait;
    
      public:
        virtual void init() {
            FastPinBB<DATA_PIN>::setOutput();
            mPinMask = FastPinBB<DATA_PIN>::mask();
            mPort = FastPinBB<DATA_PIN>::port();
        }
    
        virtual uint16_t getMaxRefreshRate() const { return 400; }
    
        virtual void showPixels(PixelController<RGB_ORDER> &pixels) {
            mWait.wait();
            cli();
            if (!showRGBInternal(pixels)) {
                sei();
                delayMicroseconds(WAIT_TIME);
                cli();
                showRGBInternal(pixels);
            }
            sei();
            mWait.mark();
        }
    
        // Key modification: Send preambles before pixel data
        static uint32_t showRGBInternal(PixelController<RGB_ORDER> pixels) {
            if (pixels.size() == 0) {
                return 1;
            }
    
            struct M0ClocklessData data;
            data.d[0] = 0; data.d[1] = 0; data.d[2] = 0;
            data.s[0] = 0; data.s[1] = 0; data.s[2] = 0;
            data.e[0] = 0; data.e[1] = 0; data.e[2] = 0;
            data.adj = pixels.mAdvance;
    
            // UCS7604 preambles
            uint8_t chunk1[] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x02};
            uint8_t chunk1Len = sizeof(chunk1);
            uint8_t chunk2[] = {0x8B, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00};  // 16-bit RGBW, max current
            uint8_t chunk2Len = sizeof(chunk2);
    
            typename FastPin<DATA_PIN>::port_ptr_t portBase = FastPin<DATA_PIN>::port();
    
            // Send chunk1 (always 800kHz timing)
            int retVal = showLedData<8, 4, T1, T2, T3, RGB_ORDER, WAIT_TIME>(
                portBase, FastPin<DATA_PIN>::mask(), chunk1, chunk1Len, &data);
    
            delayMicroseconds(260);  // Delay between chunks
    
            // Send chunk2 (always 800kHz timing)
            retVal = showLedData<8, 4, T1, T2, T3, RGB_ORDER, WAIT_TIME>(
                portBase, FastPin<DATA_PIN>::mask(), chunk2, chunk2Len, &data);
            (void)retVal;
    
            delayMicroseconds(260);  // Delay before pixel data
    
            // Setup for pixel data
            data.d[0] = pixels.d[0];
            data.d[1] = pixels.d[1];
            data.d[2] = pixels.d[2];
            data.s[0] = pixels.mColorAdjustment.premixed[0];
            data.s[1] = pixels.mColorAdjustment.premixed[1];
            data.s[2] = pixels.mColorAdjustment.premixed[2];
            data.e[0] = pixels.e[0];
            data.e[1] = pixels.e[1];
            data.e[2] = pixels.e[2];
            data.adj = pixels.mAdvance;
    
            // Send pixel data (800kHz or 1.6MHz based on chunk2[0] config)
            return showLedData<8, 4, T1, T2, T3, RGB_ORDER, WAIT_TIME>(
                portBase, FastPin<DATA_PIN>::mask(), pixels.mData, pixels.mLen, &data);
        }
    };
    
    FASTLED_NAMESPACE_END
    
    #endif // __INC_CLOCKLESS_ARM_D21

    Key Insights from Prototype

    1. Reuses showLedData<>() function - Same ARM assembly routine for preambles and pixels
    2. Three sequential calls - chunk1 → delay → chunk2 → delay → pixels
    3. Zeroed M0ClocklessData for preambles - No color adjustment needed for config bytes
    4. Fixed 260µs delays - Critical timing between transmissions
    5. Template parameters unchanged - Uses same T1/T2/T3 timing as base controller
    6. Config byte 0x8B - 16-bit mode, 800kHz, RGBW, max current on all channels

    This pattern must be abstracted into the generic wrapper while maintaining platform-specific transmission methods.

  9. zackees commented on Oct 7, 2025

    @zackees
    Member

    See the readme for instructions on how to run this chipset. Let me know if i got it wrong as literally can't test this.

  10. second-string commented on Oct 7, 2025

    @second-string
    Author

    Left a few comments even though you didn't ask for them. I'll test the merged implementation with the delays in the next couple of weeks

  11. zackees commented on Oct 8, 2025

    @zackees
    Member

    where did you leave the comments?

  12. second-string commented on Oct 8, 2025

    @second-string
    Author

    I thought it was a PR since it let me leave comments but it looks like GitHub lets you comment right on the commit now

  13. zackees commented on Oct 9, 2025

    @zackees
    Member

    Can you help me out here?

    I got the scaffolding but your the chip expert here.

    git clone https://github.com/fastled/fastled

    cd fastled

    <open in vscode + platformio>

    edit platformio.ini

    Set to due

    compile and upload

    If you want to change the sketch, the target is dev/dev.ino

  14. reopened this on Oct 9, 2025
  15. zackees commented on Oct 18, 2025

    @zackees
    Member

    This was improved with delayNanos(), now the preample (probably wrong) uses a cpu spinnning generic clockless controller to bit bang out the preample.

    This means the general framework to carry out the signal is in, please review and see what the actual bits and wait time are necessary to push this out. Should be pretty simple at this point.

  16. second-string commented on Oct 29, 2025

    @second-string
    Author

    I've tried a couple times to integrate the FastLED code into our repo but it has become unmanageable in the last ~year since we first integrated it. Previously, I simply dropped the contents of the src/ file into it's own CMake directory in our repo and did a bit of work stubbing or wrapping a couple things. Now with the whole overriding of the C std library files, etc, it's much more complicated. Also, everything is chaotic and in different places (see all the random files in the top level of the repo alone).

    It seems the AI use is too heavy, as all of these tens (hundreds?!) of daily commits have different changes with zero explanation in the commit message. Maybe someone else will pick this up to test it in the future but I am not able to.

  17. zackees commented on Oct 30, 2025

    @zackees
    Member

    Sketches from a decode ago still compile. That's enforced via machines.

    If you are having problems it's because you are riding the master branch, raw dog style. Do don't this... Pin your dependencies.

    The only guarantee of stability is on the releases. If you ride master branch, you are one of our alpha testers. It's not for everyone.

    A lot of these recent changes are to get this driver into this codebase, including delayNanos() which requires using delayCycles<>, which needed to be implemented on every platform.

    Don't worry, I got it from here.

  18. changed the title [-]How to add standalone prefix to each output of pixel data[/-] [+]UCS7604 impl[/+] on Oct 30, 2025
  19. added a commit that references this issue on Nov 3, 2025
  20. uzlonewolf commented on Nov 9, 2025

    @uzlonewolf

    Chunk 1

    ... I tried changing the last byte between 0x02, 0x03, and 0x00 but the LEDs didn't respond to anything besides 0x02. I've left this at the default values shown in the screenshots above.

    Are you sure about that? I've been playing around with some of these chips and it seems to me they only look at the pulse width and completely ignore the space, which would make that last byte 0x03.

    Setting that last byte to anything 0xF0-0xFF causes them to run the diagnostics where they flash the red LED if the 'data in' pin is working, the green if 'backup in' is working, and both if both are (lighting up yellow).

    Chunk 2

    Bytes 1-4 Software current control per-channel. The driver I have only output up to 0x0F for each of these bytes, I don't know if that's the max or not.

    I believe 0x0F is the max for the 7604, however the nearly identical 7804 has a 6-bit current control and uses a max value of 0x3F. My 7604's seem to accept 0x3F just fine and simply ignore that high nibble.

    Bytes 5-6 Unknown, I didn't touch them, all zeroes works.

    I suspect these are reserved for a future 6-channel version of this chip. Same with bit 2 in byte 0 (which would allow selecting 6 channels).

    Bit depth
    When they are set to different values, the behaviour didn't seem correct for 12 or 14 bit depth. The very first byte of data would control the first pixel red, but then it would revert to what seemed like full 16 bit depth for every remaining channel.

    These chips operate on bits, not bytes. They extract num_channels * bit_depth bits from the stream and pass the rest onto the next chip. I.e. if you set it to 1 channel and 14-bit, it will extract the first 14 bits out of the stream and pass bits 15+ on to the next chip. You can see this if you hook the logic analyzer up to both data in and data out:
    Screenshot_2025-11-09_10-47-50 14-bit

  21. uzlonewolf commented on Nov 9, 2025

    @uzlonewolf

    Open Questions

    1. 12-bit and 14-bit modes: How do mixed bit-depth settings actually work?
    2. Current control: Is 0x0F truly the maximum? Can higher values be used?
    3. Timing tolerances: How strict are the 260µs delays? Is there acceptable range?
    4. 1.6MHz reliability: Does high-speed mode work with long cable runs?
    5. Reset/latch time: What minimum delay is required after pixel data?
    6. Exact timing values: Precise T0H/T0L/T1H/T1L for both speeds?
    1. These chips operate on bits, not bytes. They extract num_channels * bit_depth bits from the stream and pass the rest onto the next chip. I.e. if you set it to 1 channel and 14-bit, it will extract the first 14 bits out of the stream and pass bits 15+ on to the next chip.
    2. 0x0F is the max for 7604, 0x3F is the max for 7804. Passing higher values is okay, the chip will just ignore any extra bits.
    3. They're not. I removed them completely and my strips are working fine. I think they were a quirk of the controller and not something the chips require. The controller I bought to test with (WT-SPI) only has a 7us delay after chunk1 and no delay after chunk2.
    4. TBD
    5. ~125us

    Low Speed:

    • T0H: 420ns +/-100
    • T0L: 580ns -0/+110000ns
    • T1H: 840ns +/-100
    • T1L: 160ns -0/+110000ns
    • H+L must be >= 1000ns

    High Speed:

    • T0H: 210ns +/-100
    • T0L: 380ns -0/+110000ns
    • T1H: 420ns +/-100
    • T1L: 160ns -0/+110000ns
  22. uzlonewolf commented on Nov 11, 2025

    @uzlonewolf

    Thinking about it a bit more, to increase reliability we should probably increase the low times a bit to make sure they are not being run right at the edge. Adjusting them so they run at the spec'd 800 kbps would be:

    Low Speed:

    • T0H: 420ns
    • T0L: 830ns
    • T1H: 840ns
    • T1L: 410ns

    High Speed:

    • T0H: 210ns
    • T0L: 415ns
    • T1H: 420ns
    • T1L: 205ns
  23. added a commit that references this issue on Nov 11, 2025
  24. zackees commented on Nov 11, 2025

    @zackees
    Member

    All modes now supported. Give it a whirl and let me know if it works for you or if there are any problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions