Project: SPI_MSTransfer

I kid you not.
Code:
#define SPI_SPEED [COLOR="#FF0000"]4000000[/COLOR]
#define OT_CALC   100*(30000000/SPI_SPEED)

SPI_MSTransfer teensy_gpio = SPI_MSTransfer("Serial", SPI_MST_CS, &SPI_MST_BUS, SPI_SPEED ); // bad with default timeouts
SPI_MSTransfer teensy_gpio2 = SPI_MSTransfer("Serial", SPI_MST_CS, &SPI_MST_BUS, [COLOR="#FF0000"]4000000[/COLOR] );

Teensy 3.5 & LC
 
Wait, i uploaded wrong files inside zip, gimme 2 mins

Code:
[ATTACH]13820._xfImport[/ATTACH]

OK this one good for your LC now

btw 5uS delays between transfers is working on master, don't totally remove the delay, the LC still needs gap time to change register data from read to write mode and back...
5uS SPI transfer gaps at 4MHz working fine here with 3.5 & LC


Code:
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
PacketID: 10487
Length: 20
DA5E 90CF DA7C 6C22 891F 64AC FAFA 1144 E7AD 7A7A 1F9A AF5A F0BC 3730 8D7F C42C A1C0 46A9 55EF 1E4D 
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==503
^LTF&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==502
F&F (OT=0) OT_CALC==700  micros() _time==503
PacketID: 59527
Length: 20
56F9 A3F6 2567 BA6F 2BD8 F2B4 2799 44C8 99DD 8AF1 F6C2 64EF 2B40 2ABE E976 52DB E99D CD6B DF78 A283 
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
^LTF&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==503
PacketID: 13605
Length: 20
26CF 7BE3 23B9 C9C5 52AD 3169 E90E 1E5F D25D 4BB7 EBF0 EBE9 5980 6642 B166 71B8 A2BE 5262 DDF7 C276 
F&F (OT=0) OT_CALC==700  micros() _time==504
F&F (OT=0) OT_CALC==700  micros() _time==505
F&F (OT=0) OT_CALC==700  micros() _time==503
F&F (OT=0) OT_CALC==700  micros() _time==504


Code:
63934.00, #, #, #, #, #, #, #, #, #,12431,1 [95 ,0
63944.00, #, #, #, #, #, #, #, #, #,12432,1 [95 ,0
63954.00  63955.00  63956.00  63957.00  63958.00  63959.00  63960.00  63961.00  63962.00  63963.00  
63964.00, #, #, #, #, #, #, #, #, #,12433,1 [95 ,0
63974.00, #, #, #, #, #, #, #, #, #,12434,1 [95 ,0
63984.00, #, #, #, #, #, #, #, #, #,12435,1 [95 ,0
63994.00, #, #, #, #, #, #, #, #, #,12436,1 [95 ,0
64004.00, #, #, #, #, #, #, #, #, #,12437,1 [95 ,0
64014.00, #, #, #, #, #, #, #, #, #,12438,1 [95 ,0
64024.00, #, #, #, #, #, #, #, #, #,12439,1 [95 ,0
64034.00, #, #, #, #, #, #, #, #, #,12440,1 [95 ,0
64044.00, #, #, #, #, #, #, #, #, #,12441,1 [95 ,0
64054.00, #, #, #, #, #, #, #, #, #,12442,1 [95 ,0
64064.00, #, #, #, #, #, #, #, #, #,12443,1 [95 ,0
64074.00, #, #, #, #, #, #, #, #, #,12444,1 [95 ,0
64084.00, #, #, #, #, #, #, #, #, #,12445,1 [95 ,0
64094.00, #, #, #, #, #, #, #, #, #,12446,1 [95 ,0
64104.00, #, #, #, #, #, #, #, #, #,12447,1 [95 ,0
64114.00, #, #, #, #, #, #, #, #, #,12448,1 [95 ,0
64124.00, #, #, #, #, #, #, #, #, #,12449,1 [95 ,0
64134.00, #, #, #, #, #, #, #, #, #,12450,1 [95 ,0
64144.00, #, #, #, #, #, #, #, #, #,12451,1 [95 ,0
64154.00, #, #, #, #, #, #, #, #, #,12452,1 [95 ,0
64164.00, #, #, #, #, #, #, #, #, #,12453,1 [95 ,0
64174.00, #, #, #, #, #, #, #, #, #,12454,1 [95 ,0
64184.00, #, #, #, #, #, #, #, #, #,12455,1 [95 ,0
64194.00, #, #, #, #, #, #, #, #, #,12456,1 [95 ,0
64204.00  64205.00  64206.00  64207.00  64208.00  64209.00  64210.00  64211.00  64212.00  64213.00  
64214.00, #, #, #, #, #, #, #, #, #,12457,1 [95 ,0
64224.00, #, #, #, #, #, #, #, #, #,12458,1 [95 ,0
64234.00, #, #, #, #, #, #, #, #, #,12459,1 [95 ,0
64244.00, #, #, #, #, #, #, #, #, #,12460,1 [95 ,0
64254.00, #, #, #, #, #, #, #, #, #,12461,1 [95 ,0
64264.00, #, #, #, #, #, #, #, #, #,12462,1 [95 ,0
64274.00, #, #, #, #, #, #, #, #, #,12463,1 [95 ,0
64284.00, #, #, #, #, #, #, #, #, #,12464,1 [95 ,0
64294.00, #, #, #, #, #, #, #, #, #,12465,1 [95 ,0
64304.00, #, #, #, #, #, #, #, #, #,12466,1 [95 ,0
64314.00, #, #, #, #, #, #, #, #, #,12467,1 [95 ,0
64324.00, #, #, #, #, #, #, #, #, #,12468,1 [95 ,0
64334.00, #, #, #, #, #, #, #, #, #,12469,1 [95 ,0
64344.00, #, #, #, #, #, #, #, #, #,12470,1 [95 ,0
64354.00, #, #, #, #, #, #, #, #, #,12471,1 [95 ,0
64364.00, #, #, #, #, #, #, #, #, #,12472,1 [95 ,0
64374.00, #, #, #, #, #, #, #, #, #,12473,1 [95 ,0
64384.00, #, #, #, #, #, #, #, #, #,12474,1 [95 ,0
64394.00, #, #, #, #, #, #, #, #, #,12475,1 [95 ,0
64404.00, #, #, #, #, #, #, #, #, #,12476,1 [95 ,0
64414.00, #, #, #, #, #, #, #, #, #,12477,1 [95 ,0
64424.00, #, #, #, #, #, #, #, #, #,12478,1 [95 ,0
64434.00, #, #, #, #, #, #, #, #, #,12479,1 [95 ,0
64444.00, #, #, #, #, #, #, #, #, #,12480,1 [95 ,0
64454.00  64455.00  64456.00  64457.00  64458.00  64459.00  64460.00  64461.00  64462.00  64463.00  
64464.00, #, #, #, #, #, #, #, #, #,12481,1 [95 ,0
64474.00, #, #, #, #, #, #, #, #, #,12482,1 [96 ,0
64484.00, #, #, #, #, #, #, #, #, #,12483,1 [96 ,0
64494.00, #, #, #, #, #, #, #, #, #,12484,1 [96 ,0
64504.00, #, #, #, #, #, #, #, #, #,12485,1 [96 ,0
64514.00, #, #, #, #, #, #, #, #, #,12486,1 [96 ,0
64524.00, #, #, #, #, #, #, #, #, #,12487,1 [96 ,0
64534.00, #, #, #, #, #, #, #, #, #,12488,1 [96 ,0
64544.00, #, #, #, #, #, #, #, #, #,12489,1 [96 ,0
64554.00, #, #, #, #, #, #, #, #, #,12490,1 [96 ,0
64564.00, #, #, #, #, #, #, #, #, #,12491,1 [96 ,0
64574.00, #, #, #, #, #, #, #, #, #,12492,1 [96 ,0
64584.00, #, #, #, #, #, #, #, #, #,12493,1 [96 ,0
64594.00, #, #, #, #, #, #, #, #, #,12494,1 [96 ,0
64604.00, #, #, #, #, #, #, #, #, #,12495,1 [96 ,0
64614.00, #, #, #, #, #, #, #, #, #,12496,1 [96 ,0
64624.00, #, #, #, #, #, #, #, #, #,12497,1 [96 ,0
64634.00, #, #, #, #, #, #, #, #, #,12498,1 [96 ,0
64644.00, #, #, #, #, #, #, #, #, #,12499,1 [96 ,0
64654.00, #, #, #, #, #, #, #, #, #,12500,1 [96 ,0
64664.00, #, #, #, #, #, #, #, #, #,12501,1 [96 ,0
64674.00, #, #, #, #, #, #, #, #, #,12502,1 [96 ,0
64684.00, #, #, #, #, #, #, #, #, #,12503,1 [96 ,0
64694.00, #, #, #, #, #, #, #, #, #,12504,1 [96 ,0
64704.00  64705.00  64706.00  64707.00  64708.00  64709.00  64710.00  64711.00  64712.00  64713.00  
64714.00, #, #, #, #, #, #, #, #, #,12505,1 [96 ,0
64724.00, #, #, #, #, #, #, #, #, #,12506,1 [96 ,0
64734.00, #, #, #, #, #, #, #, #, #,12507,1 [96 ,0
64744.00, #, #, #, #, #, #, #, #, #,12508,1 [96 ,0
64754.00, #, #, #, #, #, #, #, #, #,12509,1 [96 ,0
64764.00, #, #, #, #, #, #, #, #, #,12510,1 [96 ,0
64774.00, #, #, #, #, #, #, #, #, #,12511,1 [96 ,0
64784.00, #, #, #, #, #, #, #, #, #,12512,1 [96 ,0
64794.00, #, #, #, #, #, #, #, #, #,12513,1 [96 ,0
64804.00, #, #, #, #, #, #, #, #, #,12514,1 [96 ,0
64814.00, #, #, #, #, #, #, #, #, #,12515,1 [96 ,0
64824.00, #, #, #, #, #, #, #, #, #,12516,1 [96 ,0
64834.00, #, #, #, #, #, #, #, #, #,12517,1 [96 ,0
64844.00, #, #, #, #, #, #, #, #, #,12518,1 [96 ,0
64854.00, #, #, #, #, #, #, #, #, #,12519,1 [96 ,0
64864.00, #, #, #, #, #, #, #, #, #,12520,1 [96 ,0
64874.00, #, #, #, #, #, #, #, #, #,12521,1 [96 ,0
64884.00, #, #, #, #, #, #, #, #, #,12522,1 [96 ,0
64894.00, #, #, #, #, #, #, #, #, #,12523,1 [96 ,0
64904.00, #, #, #, #, #, #, #, #, #,12524,1 [96 ,0
64914.00, #, #, #, #, #, #, #, #, #,12525,1 [96 ,0
64924.00, #, #, #, #, #, #, #, #, #,12526,1 [96 ,0
64934.00, #, #, #, #, #, #, #, #, #,12527,1 [96 ,0
64944.00, #, #, #, #, #, #, #, #, #,12528,1 [96 ,0
64954.00  64955.00  64956.00  64957.00  64958.00  64959.00  64960.00  64961.00  64962.00  64963.00  
64964.00, #, #, #, #, #, #, #, #, #,12529,1 [96 ,0
64974.00, #, #, #, #, #, #, #, #, #,12530,1 [96 ,0
64984.00, #, #, #, #, #, #, #, #, #,12531,1 [96 ,0
64994.00, #, #, #, #, #, #, #, #, #,12532,1 [96 ,0
65004.00, #, #, #, #, #, #, #, #, #,12533,1 [96 ,0
65014.00, #, #, #, #, #, #, #, #, #,12534,1 [96 ,0
65024.00, #, #, #, #, #, #, #, #, #,12535,1 [96 ,0
65034.00, #, #, #, #, #, #, #, #, #,12536,1 [96 ,0
65044.00, #, #, #, #, #, #, #, #, #,12537,1 [96 ,0
65054.00, #, #, #, #, #, #, #, #, #,12538,1 [96 ,0
65064.00, #, #, #, #, #, #, #, #, #,12539,1 [96 ,0
65074.00, #, #, #, #, #, #, #, #, #,12540,1 [96 ,0
65084.00, #, #, #, #, #, #, #, #, #,12541,1 [96 ,0
65094.00, #, #, #, #, #, #, #, #, #,12542,1 [96 ,0
65104.00, #, #, #, #, #, #, #, #, #,12543,1 [96 ,0
65114.00, #, #, #, #, #, #, #, #, #,12544,1 [96 ,0
65124.00, #, #, #, #, #, #, #, #, #,12545,1 [96 ,0
65134.00, #, #, #, #, #, #, #, #, #,12546,1 [96 ,0
65144.00, #, #, #, #, #, #, #, #, #,12547,1 [96 ,0
65154.00, #, #, #, #, #, #, #, #, #,12548,1 [96 ,0
65164.00, #, #, #, #, #, #, #, #, #,12549,1 [96 ,0
65174.00, #, #, #, #, #, #, #, #, #,12550,1 [96 ,0
65184.00, #, #, #, #, #, #, #, #, #,12551,1 [96 ,0
65194.00, #, #, #, #, #, #, #, #, #,12552,1 [96 ,0
65204.00  65205.00  65206.00  65207.00  65208.00  65209.00  65210.00  65211.00  65212.00  65213.00  
65214.00, #, #, #, #, #, #, #, #, #,12553,1 [96 ,0
65224.00, #, #, #, #, #, #, #, #, #,12554,1 [96 ,0
65234.00, #, #, #, #, #, #, #, #, #,12555,1 [96 ,0
65244.00, #, #, #, #, #, #, #, #, #,12556,1 [96 ,0
65254.00, #, #, #, #, #, #, #, #, #,12557,1 [96 ,0
65264.00, #, #, #, #, #, #, #, #, #,12558,1 [96 ,0
65274.00, #, #, #, #, #, #, #, #, #,12559,1 [96 ,0
65284.00, #, #, #, #, #, #, #, #, #,12560,1 [96 ,0
65294.00, #, #, #, #, #, #, #, #, #,12561,1 [96 ,0
65304.00, #, #, #, #, #, #, #, #, #,12562,1 [96 ,0
65314.00, #, #, #, #, #, #, #, #, #,12563,1 [96 ,0
65324.00, #, #, #, #, #, #, #, #, #,12564,1 [96 ,0
65334.00, #, #, #, #, #, #, #, #, #,12565,1 [96 ,0
65344.00, #, #, #, #, #, #, #, #, #,12566,1 [96 ,0
65354.00, #, #, #, #, #, #, #, #, #,12567,1 [96 ,0
65364.00, #, #, #, #, #, #, #, #, #,12568,1 [96 ,0
65374.00, #, #, #, #, #, #, #, #, #,12569,1 [96 ,0
65384.00, #, #, #, #, #, #, #, #, #,12570,1 [96 ,0
65394.00, #, #, #, #, #, #, #, #, #,12571,1 [96 ,0
65404.00, #, #, #, #, #, #, #, #, #,12572,1 [96 ,0
65414.00, #, #, #, #, #, #, #, #, #,12573,1 [96 ,0
65424.00, #, #, #, #, #, #, #, #, #,12574,1 [96 ,0
65434.00, #, #, #, #, #, #, #, #, #,12575,1 [96 ,0
65444.00, #, #, #, #, #, #, #, #, #,12576,1 [96 ,0
65454.00  65455.00  65456.00  65457.00  65458.00  65459.00  65460.00  65461.00  65462.00  65463.00  
65464.00, #, #, #, #, #, #, #, #, #,12577,1 [96 ,0
65474.00, #, #, #, #, #, #, #, #, #,12578,1 [96 ,0
65484.00, #, #, #, #, #, #, #, #, #,12579,1 [96 ,0
65494.00, #, #, #, #, #, #, #, #, #,12580,1 [96 ,0
65504.00, #, #, #, #, #, #, #, #, #,12581,1 [96 ,0
65514.00, #, #, #, #, #, #, #, #, #,12582,1 [96 ,0
65524.00, #, #, #, #, #, #, #, #, #,12583,1 [96 ,0
65534.00, #, #, #, #, #, #, #, #, #,12584,1 [96 ,0
8.00, #, #, #, #, #, #, #, #, #,12585,1 [96 ,0
18.00, #, #, #, #, #, #, #, #, #,12586,1 [96 ,0
28.00, #, #, #, #, #, #, #, #, #,12587,1 [96 ,0
38.00, #, #, #, #, #, #, #, #, #,12588,1 [96 ,0
48.00, #, #, #, #, #, #, #, #, #,12589,1 [96 ,0
58.00, #, #, #, #, #, #, #, #, #,12590,1 [96 ,0
68.00, #, #, #, #, #, #, #, #, #,12591,1 [96 ,0
78.00, #, #, #, #, #, #, #, #, #,12592,1 [96 ,0
88.00, #, #, #, #, #, #, #, #, #,12593,1 [96 ,0
98.00, #, #, #, #, #, #, #, #, #,12594,1 [96 ,0
108.00, #, #, #, #, #, #, #, #, #,12595,1 [96 ,0
118.00, #, #, #, #, #, #, #, #, #,12596,1 [96 ,0
128.00, #, #, #, #, #, #, #, #, #,12597,1 [96 ,0
138.00, #, #, #, #, #, #, #, #, #,12598,1 [96 ,0
148.00, #, #, #, #, #, #, #, #, #,12599,1 [96 ,0
158.00, #, #, #, #, #, #, #, #, #,12600,1 [96 ,0
168.00  169.00  170.00  171.00  172.00  173.00  174.00  175.00  176.00  177.00  
178.00, #, #, #, #, #, #, #, #, #,12601,1 [96 ,0
 
5! 3 will eventually fail and lockup spi (the slave actually will lock up because the register glitches),

The way the MKL26 chip is designed is, as soon as the SPTEF flag is triggered, you have only a tiny window to read back both 8 byte registers (DH & DL) and write back to them whatever you want to send, x.DH = 0x55, etc;
If you don't finish within that window before the next dword shifts in, your screwed basically, your dword gets corrupt, and who knows what else happens :)
 
nope, only tested at 4, maybe 8 will work now, havnt checked, well, it was and probably still work, its the OTs stability need to check

EDIT, nope! it seems now only 4 mhz works! hehe lol :)
 
8 an issue - keeps resetting - didn't change gpio2 though - would making them both 8 work or limited to 4.

EDIT:6MHz works with no OTs :)
 
Win some, loose some, weird chip!! lol

changing the delay above 5 doesnt seem to affect it, it seems now were stuck at 4MHz at least, better than crashing before and 300khz modes
 
So now that you got LC done what your next challenge - SPI_MSTransfer SD logger :) Think Tim was trying to get you to do that.....
 
Oh man - you are a gluten for punishment - what are friends for right. On a serious note go take a break and clear your head from this stuff. Yes ii know this fun but... sometimes frustrating.
 
Good for you. So are you done now with SPI_MSTransfer or are more changes on the horizon. Seriously we really need to come up with a good project demo the power of SPI_MSTransfer.

You ever going back to Teensquitto ?
 
I think if all tests are good it can be released as well. SPI_MST still needs the master to be stripped out of slave code so they can co-exist in the same folder, spent alot of time and customization with Teensquitto, I think it's pretty capable as it is currently :p ( with those timeouts fixed and whatnot found during testing)

You could use Teensquitto to probably broadcast uNAV reports from SPI_MST over MQTT to be viewed remotely hehehe
 
Since the 3.5 seems to be the long pole and finds the most problems I will test tomorrow with the 3.2 and then with the two 3.5's again. If they work - then I think all is good. After that will think about teensquitto and uNav once that is working :).
 
Finally got back to the debug_t3 lib - testing the fail I found in b4 Tsermon … and it failed to fail - but T_LC was online when I was going to push up debug_t3 - the faults are not trapping there like on the T_3.6 … so will look soon. ASSERT works - which calls my debug_fault() code and that works …

Both work to catch this extreme fault, but T_LC not my simple faults? This one goes recursive where the others ping once and safely return::
uint32_t *test;
test = (uint32_t *)0x0;
DebSet( 9, __LINE__ );
DebSet( 2, 666 );
*test += 666;


With the Speed limits on various T_?'s - it might be handy to DOC that in the PIN # PRINT notes? Depending on how combined after wiring that might be the next biggest issue that could be solved with that? Of course that can depend on CPU speed too. Of course that text eats FLASH code space.

Don't forget you have to test the multi-slave case :) That could make a cool example.
 
Ok. Started testing and hit a snag.

T3.6/T3.2 at 180/120MHz with 30MHz SPI still doesn't work. If you change the SPI Speed to 27MHz it works

UPDATE:
T3.6/LC at 180/48MHz with 4/4 MHz SPI working no problems.

UPDATE2:
T3.5/T3.2 works no issues at 27Mhz but OT's keep climbing

UPDATE3:
T3.5/T3.5 168/168MHz, 30MHz SPI. Works but OT's keep climbing. At 168/120 same thing

UPDATE4:
T3.6/T3.5 240/168, 30MHz. Works but OT's keep climbing

UPDATE5:
If I change the delayMicroseconds(5) to delayMicroseconds(1) OTs go away (tested for 3.6/3.5 combo) probably need an ifdef around them:
Code:
uint16_t SPI_MSTransfer::_transfer16_write(uint16_t data) {
  (*(KINETISK_SPI_t *)_spi_port_memorymap).SR = SPI_SR_TCF;
  (*(KINETISK_SPI_t *)_spi_port_memorymap).PUSHR = data | SPI_PUSHR_CTAS(1);
  while (!((*(KINETISK_SPI_t *)_spi_port_memorymap).SR & SPI_SR_TCF)) ; // wait
  #if defined(__MK20DX128__)
    delayMicroseconds(5);
  #else
    delayMicroseconds(1);
  #endif
  return (*(KINETISK_SPI_t *)_spi_port_memorymap).POPR;
}
uint16_t SPI_MSTransfer::_transfer16_writeread(uint16_t data) {
  (*(KINETISK_SPI_t *)_spi_port_memorymap).SR = SPI_SR_TCF;
  (*(KINETISK_SPI_t *)_spi_port_memorymap).PUSHR = data | SPI_PUSHR_CTAS(1);
  while (!((*(KINETISK_SPI_t *)_spi_port_memorymap).SR & SPI_SR_TCF)) ; // wait
  #if defined(__MK20DX128__)
    delayMicroseconds(5);
  #else
    delayMicroseconds(1);
  #endif 
  return (*(KINETISK_SPI_t *)_spi_port_memorymap).POPR;
}
 
Last edited:
Updated Master for testing

I updated the master so I didn't have to keep redoing gpio2 for the lc:
Code:
#include <SPI.h>
#include <SPI_MSTransfer.h>
#include "A_ConfigDefines.h"

//comment out for T3.x slave devices
#define TLC 1

#if defined(TLC)
#define SPI_SPEED 4000000
#else
#define SPI_SPEED 30000000     //27MHz SPI Max for T3.2 Slave
#endif
#define OT_CALC   100*(30000000/SPI_SPEED)

SPI_MSTransfer teensy_gpio = SPI_MSTransfer("Serial", SPI_MST_CS, &SPI_MST_BUS, SPI_SPEED ); // bad with default timeouts
#if defined(TLC)
  SPI_MSTransfer teensy_gpio2 = SPI_MSTransfer("Serial", SPI_MST_CS, &SPI_MST_BUS, 4000000);
#endif

void yield() {}

void setup() {
  
  Serial.begin(115200);
  while (!Serial && millis() < 2000 ) {}
  Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
  teensy_gpio.debug(Serial);

#if defined(TLC)
  teensy_gpio2.onTransfer(myCallback);
#else
  teensy_gpio.onTransfer(myCallback);
#endif

#ifdef SPI_MST_SCK
  SPI_MST_BUS.setSCK( SPI_MST_SCK );
#endif
  SPI_MST_BUS.begin();
  //delay(5000);
}

uint32_t OverTime = 0;
void loop() {
  static uint32_t _timer = millis();
  //static uint32_t _timer1 = micros();
  if ( !(millis() % 100) )  {
#if defined(TLC)
    teensy_gpio2.pinToggle(LED_BUILTIN);
#else      
    teensy_gpio.pinToggle(LED_BUILTIN);
#endif 
    Serial.print("^LT"); 
    delay(1); 
}
  if ( millis() - _timer >= 10) {
    _timer = millis();
    //_timer1 = micros();
    uint32_t _time = micros();
    
    uint16_t *buf;
    double MST_PrintVals[10];
    buf = (uint16_t *)MST_PrintVals;
    int ii = 0;
    static uint16_t __count = 0;
    static uint16_t __countB = 0;
    for ( uint32_t i = 0; i < sizeof(MST_PrintVals) / sizeof( MST_PrintVals[0]  ); i++ ) MST_PrintVals[i] = __count++;

    Serial.print("F&F (OT=");
    Serial.print( OverTime );
    Serial.print(")");
    _time = micros();

    __countB++;
    if ( __countB % 25 )
      teensy_gpio.transfer16((uint16_t *)MST_PrintVals, sizeof(MST_PrintVals) / 2, 60, 1); // DEBUGHACK output
    else
      teensy_gpio.transfer16((uint16_t *)MST_PrintVals, sizeof(MST_PrintVals) / 2, 55, 1);

    _time = micros() - _time;
    Serial.print(" OT_CALC==");
    Serial.print(OT_CALC);
    Serial.print("  micros() _time==");
    Serial.println(_time);
    if ( _time > OT_CALC ) OverTime++;
  }

#if defined(TLC)
  teensy_gpio2.events();
#else
  teensy_gpio.events();
#endif
}

void myCallback(uint16_t *buffer, uint16_t length, AsyncMST info) {
  Serial.print("PacketID: "); Serial.println(info.packetID);
  Serial.print("Length: "); Serial.println(length);
  for ( uint16_t i = 0; i < length; i++ ) {
    Serial.print(buffer[i], HEX); Serial.print(" ");
  }
  Serial.println();
}
 
Last edited:
for the OTs climbing make sure the calculations for OT_CALC are higher than _time
chances are theyre climbing because of the delayMicroseconds(5) in the new ::_transfer16 routines like I mentioned in earlier

for the T3.x series you can remove the 5uS delays, but LC needs them
The delays push the _time over OT_CALC

Master now will need a new method .. LCmode() ? which assigns the delay to the object itself

Tim, I had dual teensies setup and even had a video on yourtube with SPI_MST
2x 3.5 slaves and 1x master
 
Think you missed update5 in post 1719. Just need one change, don't need the 1 us delay anymore :)

Oh, I made a couple of changes to the sketches so I can get better configurations dumped out.
 

Attachments

  • LCMaste-Slave Sketches.zip
    3 KB · Views: 80
Master now will need a new method .. LCmode() ? when assigns the delay to the object itself

In the master .cpp I changed the ifdef to this:
Code:
  #if defined(__MK20DX128__)
    delayMicroseconds(5);
  #endif

For my master test sketch, to avoid having to keep changing GPIO2 I just added a ifdef if I was using a TLC. and yes the LC needs a lot of TLC to get it work right :)
 
the if defined though is not for the slave, its for the master, which you cannot enable from sketch, have to define it in the cpp for it to enable, if you run LC as slave, that define is useless as it only affects master?

ahh never mind, you put a manual define in the H file

yeah if we do a method we could do it on a per object basis rather than globally
ex, teensy_gpio.LCmode(1);

this would enable delays only for that object, teensy_gpio2 is a different object amd unaffected

or better yet, it will be the value
LCmode(5); (uS)
or we could do double overload
LCmode(x,x);, where first value affects writes and second value affects reads
 
yeah if we do a method we could do it on a per object basis rather than globally
Yeah that would make more sense. Once that is done that would fix the last of the nits standing in the way of updating the master :)

Now go have your coffee :)
 
Back
Top