Repository navigation
Description
Context
Two independent MXRT1062 native SPI bodies buffer individual bits but never finish a partial group. writeBit transfers only on every eighth call. waitFully and finalizeTransmission are no-ops; release only calls the selectable and LpspiBus::endTransaction, which is also a no-op. A direct public select(); writeBit<0>(1); endTransaction(); therefore emits no requested bit and leaves pending state for the next operation. A later writeByte combines the old prefix, while writeBytesValueRaw bypasses pending state.
Both unchanged pinned-baseline implementations require separate validation (shared include guard does not make either a forwarding alias):
- — blob e12b9cc723583732564b827ba608251f9c4793da
// write a single bit out, which bit from the passed in byte is determined by template parameter - — blob 406ac51a17f8f04862050d230c118e5592662468
// write a single bit out, which bit from the passed in byte is determined by template parameter inline void LpspiBus::endTransaction() {}
The classes are public/callable. Current hardware selection uses SPIDeviceProxy, which does not expose writeBit, so no active SM16716 producer is claimed through that proxy. SM16716's two-bit/six-byte/two-bit header is a relevant protocol case only with explicit real backend instantiation. Absence of that current producer does not make the callable transaction API correct.
Proposal
Complete pending-bit transmission with the actual supported LPSPI frame width, drain, ownership and transaction semantics, or explicitly reject an unsupported operation. Preserve mixed-operation order and prevent pending state from crossing a completed frame. Keep the independent legacy body covered.
Acceptance criteria
- First show focused RED on each actual production class using a real Teensy vendor SDK, then GREEN after the fix. No copied writer or fabricated peripheral struct.
- Cover every selected bit position and zero/one payload, partial counts1–7,8,9 and larger tails, plus bit-byte-bit, bit-word, repeat/raw bulk, pixel start bits where directly supported, waitFully/finalize/end/release and repeated select/reselect. Verify exact emitted bit count/order and completion before select release.
- Assert no pending data leaks into a later transaction, no byte-only regression, and preservation of unrelated peripheral/pin state. Exercise all supported LPSPI indices or explicitly reject unsupported ones.
- Compile both independent bodies through real compatible target/header routes. Host observations establish logic only; no electrical timing or throughput claim without measurements.
- Restore the old no-flush and pending-state-bypass paths independently; each must fail its focused signal and return GREEN after restoration. Bind method, selector/proxy, caller, SDK and configuration inputs to test: gate software SPI changes on exhaustive production-path and mutation evidence #5031.
Decisions
One child groups pending-bit completion/order across both independent bodies, with separate evidence required. This is distinct from Teensy generic pin policy #5026 and fractional delay #5027, and from other targets' missing/native bit implementations. Purely hardware transfers are not converted to software SPI; this is a callable bit-protocol correctness gap discovered during the complete SPI inventory.
Part of #5024.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Nov 7, 2026
#5147 covers part of this issue. Pending writeBit bits now go out at release, waitFully, finalizeTransmission and endTransaction, and before writeBytesValueRaw. Bits ahead of a byte still ride in one 9-15 bit LPSPI frame. A 1-7 bit remainder, below the LPSPI minimum frame of 8 bits, goes by GPIO with both pads saved and restored. Bus indices outside 0-2 are a compile error. The legacy mxrt1062 copy is now a shim to the live header (the two shared one include guard).
Still open here:
fix(teensy4): send pending writeBit bits at transaction boundaries (F…
zackees commentedon Nov 22, 2026
Closing with an accepted limitation, following the #5061 precedent (no in-tree production caller).
Fix: #5147 (e3ee4b9). Pending
writeBitbits are flushed atrelease()(src/platforms/arm/teensy/teensy4_common/fastspi_arm_mxrt1062.h:118-120),waitFully()(:132) andfinalizeTransmission()(:213), and before raw byte writes (:152-154), throughflushBits()(:81). Bits ahead of a byte ride in one 9-15 bit LPSPI frame, and a 1-7 bit remainder goes by GPIO with both pads saved and restored. Bus indices outside 0-2 are a compile error. The legacy mxrt1062 header is now a shim to this one.Proven by:
tests/platforms/arm/teensy/teensy4_common/fastspi_arm_mxrt1062.cpp, a host LPSPI/GPIO model.Accepted limitations:
SPIDeviceProxy(src/platforms/arm/mxrt1062/spi_device_proxy.h) exposes nowriteBit, so SM16716 cannot reach this class through the Teensy 4SPIOutputdispatch.The #5031 binding is replaced by a rescoped host-side gate, tracked in #5031.