F&F (OT=1206)micros() _time==99871
F&F (OT=1207)micros() _time==99839
F&F (OT=1208)micros() _time==99798
F&F (OT=1209)micros() _time==99853
F&F (OT=1210)micros() _time==99855
F&F (OT=1211)micros() _time==69
F&F (OT=1211)micros() _time==7228
F&F (OT=1212)micros() _time==99990
F&F (OT=1213)micros() _time==99870
F&F (OT=1214)micros() _time==99278
F&F (OT=1215)micros() _time==99792
F&F (OT=1216)micros() _time==99212
DEBUG: [SLAVE CS 15] [INFO] FAILED SEND ################################
F&F (OT=1217)micros() _time==40217
DEBUG: [SLAVE CS 15] [INFO] FAILED SEND ################################
F&F (OT=1218)micros() _time==99698
DEBUG: [SLAVE CS 15] [INFO] FAILED SEND ################################
F&F (OT=1219)micros() _time==99956
DEBUG: [SLAVE CS 15] [INFO] FAILED SEND ################################
F&F (OT=1220)micros() _time==99957
15192.00, #, #, #, #, #, #, #, #, #, #, #,1267,0
15204.00, #, #, #, #, #, #, #, #, #, #, #,1268,0
15216.00, #, #, #, #, #, #, #, #, #, #, #,1269,0
15228.00, #, #, #, #, #, #, #, #, #, #, #,1270,0
15240.00, #, #, #, #, #, #, #, #, #, #, #,1271,0
15252.00, #, #, #, #, #, #, #, #, #, #, #,1272,0
15264.00, #, #, #, #, #, #, #, #, #, #, #,1273,0
15276.00, #, #, #, #, #, #, #, #, #, #, #,1274,0
15288.00, #, #, #, #, #, #, #, #, #, #, #,1275,0
4896.00,4897.00,4898.00,4899.00,4900.00,4901.00,4902.00,4903.00,4904.00,4905.00,4906.00,4907.00,0
4908.00,4909.00,4910.00,4911.00,4912.00,4913.00,4914.00,4915.00,4916.00,4917.00,4918.00,4919.00,0
4920.00,4921.00,4922.00,4923.00,4924.00,4925.00,4926.00,4927.00,4928.00,4929.00,4930.00,4931.00,0
4932.00,4933.00,4934.00,4935.00,4936.00,4937.00,4938.00,4939.00,4940.00,4941.00,4942.00,4943.00,0
4944.00,4945.00,4946.00,4947.00,4948.00,4949.00,4950.00,4951.00,4952.00,4953.00,4954.00,4955.00,0
4956.00,4957.00,4958.00,4959.00,4960.00,4961.00,4962.00,4963.00,4964.00,4965.00,4966.00,4967.00,0
4968.00,4969.00,4970.00,4971.00,4972.00,4973.00,4974.00,4975.00,4976.00,4977.00,4978.00,4979.00,0
4980.00,4981.00,4982.00,4983.00,4984.00,4985.00,4986.00,4987.00,4988.00,4989.00,4990.00,4991.00,0
4992.00,4993.00,4994.00,4995.00,4996.00,4997.00,4998.00,4999.00,5000.00,5001.00,5002.00,5003.00,0
5004.00,5005.00,5006.00,5007.00,5008.00,5009.00,5010.00,5011.00,5012.00,5013.00,5014.00,5015.00,0
5016.00,5017.00,5018.00,5019.00,5020.00,5021.00,5022.00,5023.00,5024.00,5025.00,5026.00,5027.00,0
5028.00,5029.00,5030.00,5031.00,5032.00,5033.00,5034.00,5035.00,5036.00,5037.00,5038.00,5039.00,0
5040.00,5041.00,5042.00,5043.00,5044.00,5045.00,5046.00,5047.00,5048.00,5049.00,5050.00,5051.00,0
5052.00,5053.00,5054.00,5055.00,5056.00,5057.00,5058.00,5059.00,5060.00,5061.00,5062.00,5063.00,0
5064.00,5065.00,5066.00,5067.00,5068.00,5069.00,5070.00,5071.00,5072.00,5073.00,5074.00,5075.00,0
5076.00,5077.00,5078.00,5079.00,5080.00,5081.00,5082.00,5083.00,5084.00,5085.00,5086.00,5087.00,0
5088.00,5089.00,5090.00,5091.00,5092.00,5093.00,5094.00,5095.00,5096.00,5097.00,5098.00,5099.00,0
5100.00,5101.00,5102.00,5103.00,5104.00,5105.00,5106.00,5107.00,5108.00,5109.00,5110.00,5111.00,0
5112.00,5113.00,5114.00,5115.00,5116.00,5117.00,5118.00,5119.00,5120.00,5121.00,5122.00,5123.00,0
5124.00,5125.00,5126.00,5127.00,5128.00,5129.00,5130.00,5131.00,5132.00,5133.00,5134.00,5135.00,0
5136.00,5137.00,5138.00,5139.00,5140.00,5141.00,5142.00,5143.00,5144.00,5145.00,5146.00,5147.00,0
5148.00,5149.00,5150.00,5151.00,5152.00,5153.00,5154.00,5155.00,5156.00,5157.00,5158.00,5159.00,0
5160.00,5161.00,5162.00,5163.00,5164.00,5165.00,5166.00,5167.00,5168.00,5169.00,5170.00,5171.00,0
5172.00,5173.00,5174.00,5175.00,5176.00,5177.00,5178.00,5179.00,5180.00,5181.00,5182.00,5183.00,0
#include <SPI_MSTransfer.h>
#include "FastCRC.h"
#include "atomic"
#include "TeensyThreads.h"
#define DEBUGHACK 1 // Set this to 1 to run against TEST MASTER EXAMPLE
SPI_MSTransfer slave = SPI_MSTransfer("SLAVE", "STANDALONE");
void setup() {
slave.begin();
// slave.watchdog(10000);
//attachInterrupt(2, spi0_isr, FALLING);
Serial.begin(115200);
while (!Serial && micros() < 5000 )
{ Serial.print( "Teensy Online @ millis=" );
Serial.println( millis() );
delay(10);
}
Serial.print( "Teensy Online @ millis=" );
Serial.println( millis() );
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
slave.onTransfer(myCallback);
// slave.debug(Serial); // SPI_MST Debug error tracking
int val = 0;
// std::lock_guard<std::mutex> lock(g_mutex);
// Serial.print("LOCKED");
// g_mutex.unlock();
}
void led() {
digitalWrite(13, !digitalRead(13));
}
void yield() {}
void loop() {
//if (GPIOD_PDIR & 0x01) SPI0_SR |= SPI_SR_RFDF;
slave.events();
//return;
static uint32_t _timer = millis();
if ( millis() - _timer > 500 ) {
_timer = millis();
uint16_t buf[20];
for ( uint16_t i = 0; i < 20; i++ ) buf[i] = random(0x10,0xFF);
slave.transfer16(buf, 20, random(1,65534));
}
}
double LastVal = 100000;
uint32_t ChkErr = 0;
void myCallback(uint16_t *buffer, uint16_t length, AsyncMST info) {
double DiffMiss=0;
if ( 55 == info.packetID ) {
if ( 48 != length ) {
Serial.print("Bad Length: "); Serial.println(length);
}
else if ( 0 != info.error ) {
Serial.println("\nBad CRC: ");
}
else {
double* MST_PrintVals;
MST_PrintVals = (double *)buffer;
if ( 1 == DEBUGHACK ) {
for ( uint32_t ii = 0; ii < 12; ii++ ) {
LastVal++;
if ( 65536 == LastVal ) LastVal = 0;
if ( 100001 == LastVal ) LastVal = MST_PrintVals[ii];
if ( LastVal != MST_PrintVals[ii] ) {
DiffMiss = LastVal - MST_PrintVals[ii];
ChkErr++;
Serial.print("\nBad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> ");
Serial.println( DiffMiss );
LastVal = MST_PrintVals[ii];
}
Serial.print( MST_PrintVals[ii] );
Serial.print(",");
}
Serial.print( ChkErr );
Serial.println();
}
else
{
//trig conversions
float rad2deg = 180.0f / PI;
float deg2rad = PI / 180.0f;
int textLength = 12 * 31;
char text[textLength];
char utcText[30];
char tsIMUText[30];
char tsGPSText[30];
// KF parameters
char latText[30];
char lonText[30];
char altText[30];
char pk1xText[30];
char pk1yText[30];
char pk1zText[30];
char nuk1xText[30];
char nuk1yText[30];
char nuk1zText[30];
int ii = 0;
dtostrf( MST_PrintVals[ii] , 10, 6, utcText);
ii++;
dtostrf( MST_PrintVals[ii] * 0.000001f, 10, 4, tsIMUText);
ii++;
dtostrf( MST_PrintVals[ii] * 0.000001f, 10, 4, tsGPSText);
ii++;
dtostrf( MST_PrintVals[ii] *rad2deg, 10, 6, latText);
ii++;
dtostrf( MST_PrintVals[ii] *rad2deg, 10, 6, lonText);
ii++;
dtostrf( MST_PrintVals[ii] , 10, 4, altText);
ii++;
dtostrf(sqrt( MST_PrintVals[ii] ), 10, 4, pk1xText);
ii++;
dtostrf(sqrt( MST_PrintVals[ii] ), 10, 4, pk1yText);
ii++;
dtostrf(sqrt( MST_PrintVals[ii] ), 10, 4, pk1zText);
ii++;
dtostrf( MST_PrintVals[ii] , 10, 4, nuk1xText);
ii++;
dtostrf( MST_PrintVals[ii] , 10, 4, nuk1yText);
ii++;
dtostrf( MST_PrintVals[ii] , 10, 4, nuk1zText);
// Create single text parameter and print it
snprintf(text, textLength, "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s",
utcText, tsIMUText, tsGPSText,
latText, lonText, altText,
pk1xText, pk1yText, pk1zText,
nuk1xText, nuk1yText, nuk1zText);
Serial.println(text);
//Serial.send_now();
}
/* for ( uint16_t i = 0; i < (length / 2); i++ ) {
Serial.print(MST_PrintVals[i], HEX); Serial.print(" __ ");
Serial.print(MST_PrintVals[i]); Serial.print(" | ");
}
*/
}
}
else {
Serial.print("PacketID: ");
Serial.println(info.packetID);
}
}
#include <SPI.h>
#include <SPI_MSTransfer.h>
#include "A_ConfigDefines.h"
//SPI_MSTransfer teensy_gpio = SPI_MSTransfer("Serial", SPI_MST_CS, SPI_MST_BUS, 30000000 );
SPI_MSTransfer teensy_gpio = SPI_MSTransfer("Serial", 43, &SPI2, 30000000);
void setup() {
Serial.begin(115200);
while (!Serial && millis() < 2000 ) {}
Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
teensy_gpio.onTransfer(myCallback);
// teensy_gpio.debug(Serial);
SPI2.begin();
}
elapsedMillis ioTest;
void yield() {}
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();
}
void loop() {
// teensy_gpio._detect();
// delay(1000);
// return;
static uint32_t _timer = millis();
if ( !(millis() % 1000) ) {
teensy_gpio.digitalWrite(13, !teensy_gpio.digitalRead(13));
delay(1);
}
if ( millis() - _timer > 10 ) {
_timer = millis();
uint32_t _time = micros();
uint16_t *buf;
double MST_PrintVals[12];
buf = (uint16_t *)MST_PrintVals;
int ii = 0;
static uint16_t __count = 0;
for ( uint32_t i = 0; i < sizeof(MST_PrintVals) / sizeof( MST_PrintVals[0] ); i++ ) MST_PrintVals[i] = __count++;
Serial.print("returned value ");
// teensy_gpio.digitalWrite(13, 1);
_time = micros();
teensy_gpio.transfer16((uint16_t *)MST_PrintVals, sizeof(MST_PrintVals) / 2, 55, 1);
_time = micros() - _time;
Serial.print("micros() _time==");
Serial.println(_time);
}
}
I think that's the same setup as Tim's. Think that seems to be the question - that always worked but with 2T3.5s I always had to run oc'ed to get zero errors. by the way just reflashed and all is well with the world:mine still going at 0 errors with my sketch and current 15 library. stock 3.6master and stock t35 speeds
^LTF&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==62
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==58
F&F (OT=0)micros() _time==59
F&F (OT=0)micros() _time==58
======
14104.00, #, #, #, #, #, #, #, #, #, #, #,12099,0
14116.00, #, #, #, #, #, #, #, #, #, #, #,12100,0
14128.00, #, #, #, #, #, #, #, #, #, #, #,12101,0
14140.00, #, #, #, #, #, #, #, #, #, #, #,12102,0
14152.00, #, #, #, #, #, #, #, #, #, #, #,12103,0
14164.00, #, #, #, #, #, #, #, #, #, #, #,12104,0
14176.00, #, #, #, #, #, #, #, #, #, #, #,12105,0
14188.00, #, #, #, #, #, #, #, #, #, #, #,12106,0
14200.00, #, #, #, #, #, #, #, #, #, #, #,12107,0
14212.00, #, #, #, #, #, #, #, #, #, #, #,12108,0
Using SPI0 on both I have this working as T_3.x Slave :: T_3.y Master > Connections
Code:[U]T_3.x :: T_3.y > Connections[/U] GND :: GND > GND 14 :: 14 > SCK 12 :: 11 > MOSI 11 :: 12 > MISO 02 :: 15 > CS
slave:
Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> 3.00
-1.29,
Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -60.91
60.62,
Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> 60.25
1.36,
Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> 1.00