Repository navigation
Closed
Description
Sub-issue of #3970. Scope: Teensy 3.5 / 3.6 (K64 / K66) only. Depends on #3971 landing the seam.
Situation
Unlike Teensy 4, there is no non-template SPI bus class for K64/K66. teensy36/fastspi_arm_k66.h has the DSPI machinery — CTAR0/CTAR1 programming (update_ctars, update_ctar0), PUSHR/POPR macros, pin config — but it is written write-only for LED output: templated on _DATA_PIN/_CLOCK_PIN, never configures MISO, never reads POPR.
The missing SPISettings::ctar_clock_table / ctar_div_table symbols in the current link failure are exactly this domain: Arduino ships the frequency-to-CTAR mapping as lookup tables.
Live surface required
Same as #3971 (both dead branches identified there apply here too):
begin()/end()beginTransaction(settings)/endTransaction()transfer(u8) -> u8— full duplex, needsPOPRsetTransferWriteFill(u8)transfer(const void* tx, void* rx, fl::size count)- a settings type taking
(hz, MSBFIRST, SPI_MODE0) - a default instance, held behind
fl::Singletonso it elides when unused
Tasks
- Add a non-template
DspiBus(K64/K66) alongside the existing LED-output code, held infl::SingletonlikeLpspiBusStorage - MISO pad mux configuration (the LED path never sets it)
-
POPR-based read for a genuine full-duplex byte exchange - Frequency to CTAR computation. Compute it rather than transcribing Arduino's tables — those live in the GPL/LGPL
SPI.hand FastLED is MIT (see sdfat(teensy): route the vendored SdFat SPI transport onto FastLED's own LPSPI/DSPI instead of Arduino SPIClass #3970) - SD initialisation clock ramp: 400 kHz during card init, then step to the negotiated speed
- Resolve
SpiPort_ttoDspiBuson Teensy 3.x through the seam sdfat(teensy4): route SdFat's SPI transport onto LpspiBus #3971 establishes
Constraints
- Minimise churn, especially tests. Reuse the existing K66 CTAR helpers where possible instead of duplicating register logic. Do not restructure the vendored SdFat tree.
- Do not copy code from Arduino's
SPI.h/SPI.cpp. They are GPLv2/LGPLv2.1 and FastLED is MIT. Work from the K64/K66 reference manual and FastLED's existing register code. - Do not regress Teensy 4 — that path is settled by sdfat(teensy4): route SdFat's SPI transport onto LpspiBus #3971.
Acceptance
-
bash compile teensy35 --examples Fx/FxSdCardlinks, noSPIClass/SPI/ctar_*_tableundefined symbols -
bash compile teensy36 --examples Fx/FxSdCardlinks -
bash test --cpppasses — 283/283 unit and 83/83 examples on host -
bash lintclean - No
SPIClassreferences remain undersrc/platforms/arm/teensy/sdfat/outside comments - Singleton elision preserved
- Hardware validation on a real 3.5 or 3.6 before this is trusted. A green compile proves nothing here — SD init timing is unforgiving. If no board is available, say so plainly in the PR rather than implying it was verified
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fix(lpspi): flush RX/TX FIFOs in beginTransaction, drop the Teensy 4 …
fix(sdfat): route Teensy 4 SdFat SPI transport onto LpspiBus (#3971)
fix(sdfat): route Teensy 3.x/LC SdFat SPI transport onto a FastLED DS…
warn(teensy3): tell users pre-4.0 Teensy boards are EOL and unvalidat…