Skip to content

MY9221: enforce DDR and latch timing on the direct FastPin path #5066

Closed

Description

@zackees

MY9221Controller directly emits data and clock edges through FastPin. Its DDR data loop and four DI latch pulses rely on incidental GPIO/compiler overhead, so the generic software-SPI timing fix does not cover this controller. Enforce its protocol timing, or explicitly reject configurations whose timing cannot be established.

Evidence at pinned baseline 94dab9c6b720ea277ec9177c93129c7dc646c5c3:

  • writeBit/sendWord writes DI then toggles DCKI without explicit data-phase timing.
  • latch waits 230us before four back-to-back DI high/low pairs, with no pulse-width or final cascade-stop wait.
  • Built-in mapping and legacy channel route select this actual controller.
  • The golden test verifies 208 sampled bits and ordering. Its FastPin observation model records values, without phase timestamps or latch-pulse/setup/hold/stop checks.

The MY-Semi manufacturer datasheet, pp 6–7 and 15 specifies DCKI pulse duration 50–7200ns, DI setup/hold 10ns, latch DI high>70ns and low>230ns, and a cascade stop interval>200ns+N*10ns. The 230us idle delay alone does not establish those intervals. This is a source-confirmed missing timing guarantee; no measured short pulse or universal physical failure is claimed. SPI_SPEED being intentionally unused for DDR is not a separate defect.

Acceptance:

  • Preserve dual-edge operation, command/payload order, RGB mapping, partial-chip zero padding, repeated frames and the documented latch sequence. Do not substitute ordinary single-edge SPI.
  • Bind independent production-path timing tests to both data edges, setup/hold, all four latch pulses, idle/start and cascade-dependent final stop. Cover valid chain sizes and declare unsupported bounds explicitly.
  • Establish supported target/CPU/compiler timing using real vendor pin backends and retained code-generation/cycle evidence; require physical timing evidence for electrical-compliance claims. Do not assume incidental MMIO latency supplies missing waits.
  • Restore the old missing waits and require intended timing-oracle failures; restore the fix and require GREEN. Bit-count/order tests alone must not certify timing.
  • Add this independent implementation to the generated inventory and mandatory completion gate. Parent perf: audit and accelerate software SPI across all platforms #5024 remains open until its complete requirements and final judge review pass.

Raw pinned controller SHA256: efeb5c48141d4a8a5aea2e19ea417bc9008cd852b83b86c8112c279089c356ee (4266 bytes). Independent judge reviewed the complete controller, real selectors, existing observation model and manufacturer contract.

Activity

  1. added
    type: bug
    area: drivers
    on Nov 5, 2026
  2. added
    sanitized
    on Nov 5, 2026
  3. zackees commented on Nov 5, 2026

    @zackees
    MemberAuthor

    The new test-only public-controller regression has an observed runtime RED against unchanged production code.

    UV_NO_SYNC=1 bash test spi_legacy_golden --debug --clean compiled the native target and ran FastLED.addLedsSpiChannel<MY9221,92,93,RGB> followed by FastLED.show(). The oracle reconstructs all 208 DDR bits and 13 expected words before checking the four DI latch pulses. It fails at spi_legacy_golden.cpp:839: REQUIRE 1 > 70.

    The 1 ns value is the explicit GPIO cost in a host scheduling model, not an electrical measurement. Independent judge review verified the runtime failure, retained hashes, and that the retained/current production header equals HEAD. The model observes GPIO and requested waits; it contains no copied writer.

    Evidence is retained in .build/spi-my9221-protocol-red-evidence/record.json with original header, test, and log hashes. The serial production change is now underway: explicit DDR/latch timing, chain-derived stop delay and preparing the full frame before active edges. Upper phase bounds, interrupt state, target codegen and chain/allocation/repeat boundaries remain unresolved; this issue stays open.

  4. added
    sanitized
    and removed
    sanitized
    on Nov 5, 2026
  5. zackees commented on Nov 5, 2026

    @zackees
    MemberAuthor

    The implementation candidate is pushed in #5058 at 0b5ef7ecd5359206a0922ff31e57e3c3065e0a21. It stages the full chain, adds minimum-cycle DDR/latch waits and cascade stop timing, and preserves saved interrupt state.

    Validation passed: 334 native unit tests, 95 examples, and 240 audit Python tests with one opt-in skip. Actual public producers compile for ESP8266 GPIO4/16, UNO and CI1306. Independent review caught two failed template IRAM approaches before the final ESP8266 ELF placed the ordinary kernel, four FastPin callbacks and their literals in IRAM. The same shared serializer drives host and physical paths; no raw-register replacement or copied test writer is used.

    Five omitted-wait controls fail their intended runtime assertions and exact restoration passes. An actual AVR unconditional-sei backend mutant compiles but is independently rejected for enabling interrupts for a disabled caller.

    This issue remains open. Manual controls are feasibility evidence; the managed adapter, remaining vendor/pin/CPU profiles, maximum-phase bounds and IRQ/NMI/cache/caller-stack qualifications remain required. The parent completion gate stays RED.

  6. added
    sanitized
    and removed
    sanitized
    on Nov 5, 2026
  7. zackees commented on Nov 5, 2026

    @zackees
    MemberAuthor

    Pushed 21b9e8196895c036b437e2f117985899a027950b in #5058.

    Actual RP2040 and RP2350 ARM builds exposed an XIP emitter/wait path. The shared serializer now enters an ordinary SDK SRAM kernel through selected FastPin callbacks; actual ELF reviews confirm the kernel, four live callbacks and inlined SDK waits are SRAM-resident, with saved PRIMASK restored after final parking. No hardware SPI substitution was introduced. A Teensy 4.0 build separately places its emitter/literals in ITCM with inline waits and no masked calls.

    Independent negative control: removing the RP RAM-placement wrappers still compiles, but actual ELF review rejects the resulting XIP kernel/callbacks. Restoring the exact header rebuilds an ELF byte-identical to the accepted SRAM build. Artifacts, input hashes, rejection and restoration are retained under .build/spi-my9221-rp-sram-{targets,mutation,restored}/.

    These are manual feasibility/codegen results, not managed completion receipts. Physical maximum-phase timing, MMIO/stack/frame residency, cross-core ownership, RP2350 RISC-V/high-bank paths and remaining configuration evidence are unresolved. All seven MY9221 requirement groups stay open.

    The forced ESP32-C6 probe also exposed #5067: native FastPin specializations override the forced primary, so its native IRAM result was rejected as forced-fallback coverage. The new finding is mandatory in the 41-finding registry; it is not fixed by this MY9221 change.

  8. added
    sanitized
    and removed
    sanitized
    on Nov 5, 2026
  9. moved this from Triage to Done in FastLED Trackeron Nov 21, 2026
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

    area: driverschipsetssanitizedtype: bug

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions