F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
LED STATE: 0
^LTF&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
LED STATE: 1
^LTF&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11782
F&F (OT=0)micros() _time==11783
0.000000, 0.0342, 0.0342,1961463.625000,1961520.875000,34236.0000, 185.0324, 185.0351, 185.0378,34240.0000,34241.0000,34242.0000
0.000000, 0.0343, 0.0343,1964213.750000,1964271.125000,34284.0000, 185.1621, 185.1648, 185.1675,34288.0000,34289.0000,34290.0000
0.000000, 0.0343, 0.0343,1966964.000000,1967021.250000,34332.0000, 185.2917, 185.2944, 185.2971,34336.0000,34337.0000,34338.0000
0.000000, 0.0344, 0.0344,1969714.250000,1969771.500000,34380.0000, 185.4211, 185.4238, 185.4265,34384.0000,34385.0000,34386.0000
0.000000, 0.0344, 0.0344,1972464.375000,1972521.750000,34428.0000, 185.5505, 185.5532, 185.5559,34432.0000,34433.0000,34434.0000
0.000000, 0.0345, 0.0345,1975214.625000,1975271.875000,34476.0000, 185.6798, 185.6825, 185.6852,34480.0000,34481.0000,34482.0000
0.000000, 0.0345, 0.0345,1977964.750000,1978022.125000,34524.0000, 185.8090, 185.8117, 185.8144,34528.0000,34529.0000,34530.0000
0.000000, 0.0346, 0.0346,1980715.000000,1980772.250000,34572.0000, 185.9382, 185.9409, 185.9435,34576.0000,34577.0000,34578.0000
0.000000, 0.0346, 0.0346,1983465.125000,1983522.500000,34620.0000, 186.0672, 186.0699, 186.0726,34624.0000,34625.0000,34626.0000
0.000000, 0.0347, 0.0347,1986215.375000,1986272.625000,34668.0000, 186.1961, 186.1988, 186.2015,34672.0000,34673.0000,34674.0000
0.000000, 0.0347, 0.0347,1988965.625000,1989022.875000,34716.0000, 186.3250, 186.3277, 186.3304,34720.0000,34721.0000,34722.0000
0.000000, 0.0348, 0.0348,1992403.375000,1992460.625000,34776.0000, 186.4859, 186.4886, 186.4913,34780.0000,34781.0000,34782.0000
0.000000, 0.0348, 0.0348,1995153.500000,1995210.875000,34824.0000, 186.6146, 186.6172, 186.6199,34828.0000,34829.0000,34830.0000
0.000000, 0.0349, 0.0349,1997903.750000,1997961.000000,34872.0000, 186.7431, 186.7458, 186.7485,34876.0000,34877.0000,34878.0000
0.000000, 0.0349, 0.0349,2000653.875000,2000711.250000,34920.0000, 186.8716, 186.8743, 186.8770,34924.0000,34925.0000,34926.0000
0.000000, 0.0350, 0.0350,2003404.125000,2003461.375000,34968.0000, 187.0000, 187.0027, 187.0053,34972.0000,34973.0000,34974.0000
0.000000, 0.0350, 0.0350,2006154.375000,2006211.625000,35016.0000, 187.1283, 187.1310, 187.1336,35020.0000,35021.0000,35022.0000
0.000000, 0.0351, 0.0351,2008904.500000,2008961.750000,35064.0000, 187.2565, 187.2592, 187.2619,35068.0000,35069.0000,35070.0000
0.000000, 0.0351, 0.0351,2009592.000000,2009649.375000,35076.0000, 187.2885, 187.2912, 187.2939,35080.0000,35081.0000,35082.0000
0.000000, 0.0351, 0.0351,2010279.625000,2010336.875000,35088.0000, 187.3206, 187.3233, 187.3259,35092.0000,35093.0000,35094.0000
0.000000, 0.0351, 0.0351,2013029.750000,2013087.125000,35136.0000, 187.4487, 187.4513, 187.4540,35140.0000,35141.0000,35142.0000
0.000000, 0.0352, 0.0352,2015780.000000,2015837.250000,35184.0000, 187.5766, 187.5793, 187.5820,35188.0000,35189.0000,35190.0000
0.000000, 0.0352, 0.0352,2018530.250000,2018587.500000,35232.0000, 187.7046, 187.7072, 187.7099,35236.0000,35237.0000,35238.0000
0.000000, 0.0353, 0.0353,2021280.375000,2021337.750000,35280.0000, 187.8324, 187.8350, 187.8377,35284.0000,35285.0000,35286.0000
0.000000, 0.0353, 0.0353,2024030.625000,2024087.875000,35328.0000, 187.9601, 187.9628, 187.9654,35332.0000,35333.0000,35334.0000
0.000000, 0.0354, 0.0354,2026780.750000,2026838.125000,35376.0000, 188.0877, 188.0904, 188.0931,35380.0000,35381.0000,35382.0000
0.000000, 0.0354, 0.0354,2029531.000000,2029588.250000,35424.0000, 188.2153, 188.2180, 188.2206,35428.0000,35429.0000,35430.0000
0.000000, 0.0355, 0.0355,2032281.250000,2032338.500000,35472.0000, 188.3428, 188.3454, 188.3481,35476.0000,35477.0000,35478.0000
0.000000, 0.0355, 0.0355,2035031.375000,2035088.625000,35520.0000, 188.4702, 188.4728, 188.4755,35524.0000,35525.0000,35526.0000
0.000000, 0.0356, 0.0356,2037781.625000,2037838.875000,35568.0000, 188.5975, 188.6001, 188.6028,35572.0000,35573.0000,35574.0000
0.000000, 0.0356, 0.0356,2040531.750000,2040589.125000,35616.0000, 188.7247, 188.7273, 188.7300,35620.0000,35621.0000,35622.0000
0.000000, 0.0357, 0.0357,2043282.000000,2043339.250000,35664.0000, 188.8518, 188.8544, 188.8571,35668.0000,35669.0000,35670.0000
0.000000, 0.0357, 0.0357,2046032.125000,2046089.500000,35712.0000, 188.9788, 188.9815, 188.9841,35716.0000,35717.0000,35718.0000
0.000000, 0.0358, 0.0358,2048782.375000,2048839.625000,35760.0000, 189.1058, 189.1084, 189.1111,35764.0000,35765.0000,35766.0000
0.000000, 0.0358, 0.0358,2051532.625000,2051589.875000,35808.0000, 189.2327, 189.2353, 189.2379,35812.0000,35813.0000,35814.0000
0.000000, 0.0359, 0.0359,2054282.750000,2054340.000000,35856.0000, 189.3595, 189.3621, 189.3647,35860.0000,35861.0000,35862.0000
0.000000, 0.0359, 0.0359,2057033.000000,2057090.250000,35904.0000, 189.4861, 189.4888, 189.4914,35908.0000,35909.0000,35910.0000
0.000000, 0.0359, 0.0359,2059783.125000,2059840.500000,35952.0000, 189.6128, 189.6154, 189.6180,35956.0000,35957.0000,35958.0000
0.000000, 0.0360, 0.0360,2062533.375000,2062590.625000,36000.0000, 189.7393, 189.7419, 189.7446,36004.0000,36005.0000,36006.0000
0.000000, 0.0360, 0.0360,2065283.500000,2065340.875000,36048.0000, 189.8657, 189.8684, 189.8710,36052.0000,36053.0000,36054.0000
0.000000, 0.0361, 0.0361,2067346.250000,2067403.500000,36084.0000, 189.9605, 189.9632, 189.9658,36088.0000,36089.0000,36090.0000
0.000000, 0.0361, 0.0361,2068033.750000,2068091.000000,36096.0000, 189.9921, 189.9947, 189.9974,36100.0000,36101.0000,36102.0000
0.000000, 0.0361, 0.0361,2068721.250000,2068778.625000,36108.0000, 190.0237, 190.0263, 190.0289,36112.0000,36113.0000,36114.0000
0.000000, 0.0362, 0.0362,2071471.500000,2071528.750000,36156.0000, 190.1499, 190.1526, 190.1552,36160.0000,36161.0000,36162.0000
0.000000, 0.0362, 0.0362,2074221.750000,2074279.000000,36204.0000, 190.2761, 190.2787, 190.2814,36208.0000,36209.0000,36210.0000
0.000000, 0.0362, 0.0362,2076971.875000,2077029.250000,36252.0000, 190.4022, 190.4048, 190.4075,36256.0000,36257.0000,36258.0000
0.000000, 0.0363, 0.0363,2079722.125000,2079779.375000,36300.0000, 190.5282, 190.5308, 190.5335,36304.0000,36305.0000,36306.0000
0.000000, 0.0363, 0.0363,2081784.750000,2081842.000000,36336.0000, 190.6227, 190.6253, 190.6279,36340.0000,36341.0000,36342.0000
0.000000, 0.0364, 0.0364,2085222.500000,2085279.750000,36396.0000, 190.7800, 190.7826, 190.7852,36400.0000,36401.0000,36402.0000
0.000000, 0.0364, 0.0364,2087972.625000,2088030.000000,36444.0000, 190.9057, 190.9084, 190.9110,36448.0000,36449.0000,36450.0000
0.000000, 0.0365, 0.0365,2090722.875000,2090780.125000,36492.0000, 191.0314, 191.0340, 191.0367,36496.0000,36497.0000,36498.0000
0.000000, 0.0365, 0.0365,2093473.125000,2093530.375000,36540.0000, 191.1570, 191.1596, 191.1622,36544.0000,36545.0000,36546.0000
0.000000, 0.0366, 0.0366,2096223.250000,2096280.625000,36588.0000, 191.2825, 191.2851, 191.2877,36592.0000,36593.0000,36594.0000
0.000000, 0.0366, 0.0366,2098973.500000,2099030.750000,36636.0000, 191.4079, 191.4106, 191.4132,36640.0000,36641.0000,36642.0000
0.000000, 0.0367, 0.0367,2101723.750000,2101781.000000,36684.0000, 191.5333, 191.5359, 191.5385,36688.0000,36689.0000,36690.0000
0.000000, 0.0367, 0.0367,2104473.750000,2104531.250000,36732.0000, 191.6586, 191.6612, 191.6638,36736.0000,36737.0000,36738.0000
0.000000, 0.0368, 0.0368,2107224.000000,2107281.250000,36780.0000, 191.7837, 191.7863, 191.7889,36784.0000,36785.0000,36786.0000
0.000000, 0.0368, 0.0368,2109974.250000,2110031.500000,36828.0000, 191.9088, 191.9114, 191.9140,36832.0000,36833.0000,36834.0000
0.000000, 0.0369, 0.0369,2112724.500000,2112781.750000,36876.0000, 192.0338, 192.0365, 192.0391,36880.0000,36881.0000,36882.0000
0.000000, 0.0369, 0.0369,2115474.750000,2115532.000000,36924.0000, 192.1588, 192.1614, 192.1640,36928.0000,36929.0000,36930.0000
0.000000, 0.0370, 0.0370,2118224.750000,2118282.250000,36972.0000, 192.2836, 192.2862, 192.2888,36976.0000,36977.0000,36978.0000
0.000000, 0.0370, 0.0370,2120975.000000,2121032.250000,37020.0000, 192.4084, 192.4110, 192.4136,37024.0000,37025.0000,37026.0000
0.000000, 0.0371, 0.0371,2123725.250000,2123782.500000,37068.0000, 192.5331, 192.5357, 192.5383,37072.0000,37073.0000,37074.0000
0.000000, 0.0371, 0.0371,2125788.000000,2125845.250000,37104.0000, 192.6266, 192.6292, 192.6318,37108.0000,37109.0000,37110.0000
0.000000, 0.0371, 0.0371,2126475.500000,2126532.750000,37116.0000, 192.6577, 192.6603, 192.6629,37120.0000,37121.0000,37122.0000
0.000000, 0.0371, 0.0371,2127850.500000,2127907.750000,37140.0000, 192.7200, 192.7226, 192.7252,37144.0000,37145.0000,37146.0000
0.000000, 0.0372, 0.0372,2130600.750000,2130658.000000,37188.0000, 192.8445, 192.8471, 192.8497,37192.0000,37193.0000,37194.0000
0.000000, 0.0372, 0.0372,2133351.000000,2133408.250000,37236.0000, 192.9689, 192.9715, 192.9741,37240.0000,37241.0000,37242.0000
0.000000, 0.0373, 0.0373,2136101.250000,2136158.500000,37284.0000, 193.0932, 193.0958, 193.0984,37288.0000,37289.0000,37290.0000
0.000000, 0.0373, 0.0373,2138851.250000,2138908.750000,37332.0000, 193.2175, 193.2201, 193.2227,37336.0000,37337.0000,37338.0000
0.000000, 0.0374, 0.0374,2141601.500000,2141658.750000,37380.0000, 193.3417, 193.3443, 193.3468,37384.0000,37385.0000,37386.0000
[ATTACH]13368._xfImport[/ATTACH]
#define _transfer_slowdown_while_reading 0
#define _delay_before_deassertion 25
F&F (OT=1998)micros() _time==12625
F&F (OT=1999)micros() _time==12625
F&F (OT=2000)micros() _time==12625
PacketID: 55
Length: 48
Got message......
F&F (OT=2001)micros() _time==12625
F&F (OT=2002)micros() _time==12625
PacketID: 55
bool SPI_MSTransfer::command_ack_response(uint16_t *data, uint32_t len) {
uint8_t resend_count = 0; uint32_t timeout = micros(); uint16_t _crc = 0;
while ( 1 ) {
_crc = spi_port->transfer16(0xFFFF);
if ( _crc == 0xF00D ) {
spi_port->transfer16(0xBEEF); break;
}
else if ( _crc == 0xBAAD ) {
spi_port->transfer16(0xBEEF); SPI_deassert(); return 0;
}
if ( micros() - timeout > 1000 ) {
resend_count++;
if ( resend_count > 3 ) {
if ( debugSerial != nullptr ) {
Serial.print("DBG: [S_CS "); Serial.print(chip_select);
Serial.print("] FAIL_RES #"); Serial.print(resend_count);
Serial.print(" Tx ABORT. "); delay(1000);
}
break;
}
if ( debugSerial != nullptr ) {
Serial.print("FAIL_Res #"); Serial.print(resend_count);
Serial.print(" RETRY..."); delay(1000);
}
timeout = micros();
}
}
return 1;
}
// { remove [B]_delay_before_deassertion[/B] #define from the header }
uint32_t _delay_before_deassertion = 25;
// ...
SPI_MSTransfer::SPI_MSTransfer(const char *data, uint8_t cs, SPIClass *SPIWire, uint32_t spi_bus_speed) {
chip_select = cs; spi_port = SPIWire; _master_access = 1; _spi_bus_speed = spi_bus_speed;
::pinMode(cs, OUTPUT); // make sure CS is OUTPUT before deassertion.
::digitalWriteFast(cs, HIGH); // deassert the CS way before SPI initializes :)
[B]if ( spi_bus_speed > 8000000 ) _delay_before_deassertion = 0;[/B]
F&F (OT=0) OT_CALC==3000000 micros() _time==12625
F&F (OT=0) OT_CALC==3000000 micros() _time==12626
F&F (OT=0) OT_CALC==3000000 micros() _time==12626
F&F (OT=0) OT_CALC==3000000 micros() _time==12626
^LTF&F (OT=0) OT_CALC==3000000 micros() _time==12625
F&F (OT=0) OT_CALC==3000000 micros() _time==12625
F&F (OT=0) OT_CALC==3000000 micros() _time==12625
F&F (OT=0) OT_CALC==3000000 micros() _time==12625
F&F (OT=0) OT_CALC==3000000 micros() _time==12625
F&F (OT=0) OT_CALC==3000000 micros() _time==12625
54456.00, #, #, #, #, #, #, #, #, #, #, #,20085,0
54468.00, #, #, #, #, #, #, #, #, #, #, #,20086,0
54480.000000, 0.0545, 0.0545,3121645.750000,3121703.000000,54485.0000, 233.4224, 233.4245, 233.4267,54489.0000,54490.0000,54491.0000
54492.00, #, #, #, #, #, #, #, #, #, #, #,20087,0
54504.00, #, #, #, #, #, #, #, #, #, #, #,20088,0
F&F (OT=0) OT_CALC==3000000 micros() _time==11788
F&F (OT=0) OT_CALC==3000000 micros() _time==11788
F&F (OT=0) OT_CALC==3000000 micros() _time==11789
F&F (OT=0) OT_CALC==3000000 micros() _time==11789
F&F (OT=0) OT_CALC==3000000 micros() _time==11788
Mike, the OT is because you have a > 1000 counter, for sure slower speeds are triggering it and are not failing, so its still counted
thats why i said before change OT _timer to > 12000 instead of > 1000 for 1khz, otherwise OT will count +1 every loop
yeah tim, that works too, although, im afraid of "picky" setups due to the SPI issue, what can work for us doesnt necessarily work for mike, as an example, and the library will be controlling it, not the user
Should we just do a method rather than keep overloading the constructor? its getting pretty big
SPI_MSTransfer::SPI_MSTransfer(const char *data, uint8_t cs, SPIClass *SPIWire, uint32_t spi_bus_speed, uint32_t _DBD=0xffff) {
// ...
if ( _DBD != 0xffff ) _delay_before_deassertion = _DBD;
else if ( spi_bus_speed > 8000000 ) _delay_before_deassertion = 0;
// else if ( spi_bus_speed > 4000000 ) _delay_before_deassertion = 15;
else _delay_before_deassertion = 25;