Project: SPI_MSTransfer

Hello all, currently testing the QUEUE implementation originally, its working well!

Code:
  teensy_gpio.events(0);
  delay(100);
  static uint32_t _t = millis();
  if ( millis() - _t > 1000 ) {
    _t = millis();
    uint16_t bufferr[5] = { 1, 2, 3, 4, 5 };
    teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
   teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
   teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
   teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
   teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
   teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
  }

all queues unload after 1 sec to slave, slave doesnt process them until after theyre drained, the library fires the signal to process, and slave starts processing!
im getting all 6 printed on the slave ...

Code:
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
...1 sec ...
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
... 1 sec... 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5 
1 2 3 4 5

Master debug:
Code:
DBG: [S_CS 43] 6/16 DEQUEUE(S) LEFT
DBG: [S_CS 43] 5/16 DEQUEUE(S) LEFT
DBG: [S_CS 43] 4/16 DEQUEUE(S) LEFT
DBG: [S_CS 43] 3/16 DEQUEUE(S) LEFT
DBG: [S_CS 43] 2/16 DEQUEUE(S) LEFT
DBG: [S_CS 43] 1/16 DEQUEUE(S) LEFT
1 0

1 0 is the status code of slave
1 being queues exist, 0 means not busy
can you imagine its soo fast that its not busy anymore next event cycle ? :)
 
Getting ~62 uS for overload 0... Normal ACK
Getting ~52 uS for overload 1... F&F
Getting ~ 5 uS for overload 2... QUEUE

Code:
  static uint32_t _t = millis();
  if ( millis() - _t > 1000 ) {
    _t = millis();
    uint16_t bufferr[48] = { 1, 2, 3, 4, 5 };
    int val = 0;
    uint32_t _m = micros();
   teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
Serial.print(micros() - _m); Serial.println("uS"); 
return;

EDIT, lambda for resets is working perfect for slave/master hot plugging :)
 
Last edited:
Added FULL dequeue capability for slave data retrieval. This unloads the entire slave dataqueue as soon as the data flag is set, ive set the slave at 5ms tight loop transfer16's to master, and master is catching em without crashing!, this is with the help of the atomic flag, if the slave transfer to master was in process, the slave would lie to master to say no queue so master wouldnt dequeue at same time as write, but as soon as the flag gets set when slave is not in process of writing, bam, entire queue offloads to master :)


Heres what I have so far, in case I break it later on :)


Code:
[ATTACH]13631._xfImport[/ATTACH]
 
Last edited:
Nice tonton81. Looks like you got a performance improvement as well. Will give it a shot in a little while. In the middle of something else right now :) Told you, you were a wizard :)


EDIT: Success. I loaded the new library and tried it with the uNAV sketch. Absolutely no problems using overloads 1 or 2. Guess I will have to go back and give the I2C sketches a try :)
 
Last edited:
Just tested the SPI2wayCom examples on GitHub and something strange happened. The test was between a T3.5 and T3.2. When both online would not get any transfers but if I unplugged the master and replugged it back in I would immediately get:
Code:
588.00, #, #, #, #, #, #, #, #, #, #, #,44,11
600.00, #, #, #, #, #, #, #, #, #, #, #,45,11

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> 540.00
72.00,73.00,74.00,75.00,76.00,77.00,78.00,79.00,80.00,81.00,82.00,83.00,46,12

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -36.00
120.00,121.00,122.00,123.00,124.00,125.00,126.00,127.00,128.00,129.00,130.00,131.00,47,13

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -180.00
312.00,313.00,314.00,315.00,316.00,317.00,318.00,319.00,320.00,321.00,322.00,323.00,48,14

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -192.00
516.00,517.00,518.00,519.00,520.00,521.00,522.00,523.00,524.00,525.00,526.00,527.00,49,15

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -156.00
684.00,685.00,686.00,687.00,688.00,689.00,690.00,691.00,692.00,693.00,694.00,695.00,50,16

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> 12.00
684.00,685.00,686.00,687.00,688.00,689.00,690.00,691.00,692.00,693.00,694.00,695.00,51,17

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -360.00
1056.00,1057.00,1058.00,1059.00,1060.00,1061.00,1062.00,1063.00,1064.00,1065.00,1066.00,1067.00,52,18

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -192.00
1260.00,1261.00,1262.00,1263.00,1264.00,1265.00,1266.00,1267.00,1268.00,1269.00,1270.00,1271.00,53,19
1272.00, #, #, #, #, #, #, #, #, #, #, #,54,19
1284.00, #, #, #, #, #, #, #, #, #, #, #,55,19
1296.00, #, #, #, #, #, #, #, #, #, #, #,56,19
1308.00, #, #, #, #, #, #, #, #, #, #, #,57,19
1320.00, #, #, #, #, #, #, #, #, #, #, #,58,19
1332.00, #, #, #, #, #, #, #, #, #, #, #,59,19
1344.00, #, #, #, #, #, #, #, #, #, #, #,60,19
1356.00, #, #, #, #, #, #, #, #, #, #, #,61,19
1368.00, #, #, #, #, #, #, #, #, #, #, #,62,19
1380.00, #, #, #, #, #, #, #, #, #, #, #,63,19
1392.00, #, #, #, #, #, #, #, #, #, #, #,64,19
1404.00, #, #, #, #, #, #, #, #, #, #, #,65,19

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> 192.00
1224.00,1225.00,1226.00,1227.00,1228.00,1229.00,1230.00,1231.00,1232.00,1233.00,1234.00,1235.00,66,20
1236.00, #, #, #, #, #, #, #, #, #, #, #,67,20
1248.00, #, #, #, #, #, #, #, #, #, #, #,68,20

Going to try a different set of sketches.

Ok. Same thing happened with a couple other set of our standard sketches. Again this is for the T3.5/T3.2 combo. T3.5/T3.5 doesn't seem to have that problem. BTW: Tried our I2C example and nothing printed either slave or master. But the slave LED was flashing.

Mike
 
I want you to try my code since it's working, just to check your setup: events() is mandatory I2C will never print without events()
Master:
Code:
#include <SPI.h>
#include <i2c_t3.h>
#include "A_ConfigDefines.h"
#include <SPI_MSTransfer.h>
#include "TeensyThreads.h"
#include <EventResponder.h>
EventResponder  eresp;


//0x99BB, 0x0003, 0x99B8
Threads::Mutex MST_QUEUE;


#include "circular_buffer.h"

//#define SPI_SPEED 30500
#define SPI_SPEED 30000000
#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 W0 = SPI_MSTransfer("Wire", SPI_MST_CS, &SPI_MST_BUS, SPI_SPEED ); // bad with default timeouts
SPI_MSTransfer W1 = SPI_MSTransfer("Wire1", SPI_MST_CS, &SPI_MST_BUS, SPI_SPEED ); // bad with default timeouts
SPI_MSTransfer sSPI1 = SPI_MSTransfer("SPI1", SPI_MST_CS, &SPI_MST_BUS, SPI_SPEED ); // bad with default timeouts




void I2Cscan(SPI_MSTransfer &port) {
  SPI_MSTransfer* thePort;
  thePort = &port;
  // scan for i2c devices
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");
  nDevices = 0;
  for (address = 1; address < 127; address++ ) {
    // The i2c_scanner uses the return value of
    // the Write.endTransmisstion to see if
    // a device did acknowledge to the address.
    thePort->beginTransmission(address);
    error = thePort->endTransmission();

    if (error == 0) {
      Serial.print("I2C device found at address 0x");
      if (address < 16) Serial.print("0");
      Serial.print(address, HEX);
      Serial.println("  !");
      nDevices++;
    }
    else if (error == 4) {
      Serial.print("Unknow error at address 0x");
      if (address < 16) Serial.print("0");
      Serial.println(address, HEX);
    }
  }
  if (nDevices == 0) {
    Serial.println("No I2C devices found\n");
    while (1) {};
  } else {
    Serial.println("done\n");
  }
}



void myCallback8(uint8_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 myCallback(uint16_t *buffer, uint16_t length, AsyncMST info) {
  //return;
  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();
}
uint32_t OverTime = 0;


void setup() {

  //  SPI_MSTransfer::mtsca._init();
  Serial.begin(115200);
  while (!Serial && millis() < 2000 ) {}
  Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
  teensy_gpio.onTransfer(myCallback);
  teensy_gpio.onTransfer(myCallback8);


  threads.addThread(SPI_MST_Thread);
  Circular_Buffer<float, 16> myFloats;
  Circular_Buffer<float, 16, 10> myFloats2;
  Circular_Buffer<int, 16, 10> int2;
  myFloats.push_back(-3.14159);
  myFloats.push_back(-12.3456);
  myFloats.push_back(-78.91234);
  myFloats.push_back(-7.91234);
  myFloats.push_back(-11.91234);
  myFloats.push_back(-58.91234);
  myFloats.push_back(-18.91234);
  int moo[2] = { 1, 2};
  int2.push_front(moo, 2);
  int2.push_front(moo, 2);
  int2.push_front(moo, 2);
//  int2.read();
//  myFloats.list();
//  Serial.println();
//  int2.list();
Circular_Buffer<uint16_t, 4,10> c;
uint16_t m[] = { 1,2,3,4,5 }; c.push_back(m,5);
uint16_t m1[] = { 6,7,8,9,10 }; c.push_back(m1,5);
uint16_t m2[] = { 11,12,13,14,15 }; c.push_back(m2,5);
uint16_t m3[] = { 16,17,18,19,20 }; c.push_back(m3,5);
uint16_t m4[] = { 21,22,23,24,25 }; c.push_back(m4,5);
uint16_t m5[] = { 26,27,28,29,30 }; c.push_back(m5,5);
uint16_t m6[] = { 31,32,33,34,35 }; c.push_back(m6,5);
uint16_t m7[] = { 36,37,38,39,40 }; c.push_back(m7,5);
uint16_t m8[] = { 41,42,43,44,45,46 }; c.push_back(m8,5);
//c.read();
//c.read();
//c.read();
//c.read();
//c.list();
//
//  while (1);
  Serial.print("SUM: "); Serial.println(myFloats.sum(), 5);
  Serial.print("MIN: "); Serial.println(myFloats.min(), 5);
  Serial.print("MAX: "); Serial.println(myFloats.max(), 5);
  Serial.print("MEDIAN: "); Serial.println(myFloats.median(1), 5);
  Serial.print("AVG: "); Serial.println(myFloats.average(), 5);
  Serial.print("Deviation: "); Serial.println(myFloats.deviation(), 8);
  uint8_t _size = myFloats.size();
  for ( uint8_t i = 0; i < _size; i++ ) {
    Serial.print(myFloats.pop_front(), 5); Serial.print(" ");
  } Serial.println();


  //    while (1);


  //uint16_t v = 1010;
  //
  //v--;
  //v |= v >> 1;
  //v |= v >> 2;
  //v |= v >> 4;
  //v |= v >> 8;
  //v |= v >> 16;
  //v++;
  //
  //Serial.println(v);
  //uint16_t v = 300;





  //  Serial.println(v);

  // Circular_Buffer<uint16_t, 4> cb2;


  //  I2Cscan(W0);
  Serial.println(SPI_MSTransfer::stmca.capacity());
  Serial.println(SPI_MSTransfer::stmca.max_size());
  teensy_gpio.debug(Serial);

  threads.setTimeSlice(0, 5);
  threads.setTimeSlice(1, 0);

  //  W1.begin(I2C_MASTER, 0x00, I2C_PINS_37_38, I2C_PULLUP_EXT, 400000);
  //  W0.begin(I2C_SLAVE, 0x22, I2C_PINS_18_19, I2C_PULLUP_EXT, 100000);
  //  W0.onReceive(hello);
  //
  //  teensy_gpio.onDetect([](AsyncMST info) {
  //    { Threads::Scope scope(MST_QUEUE);
  //      W1.begin(I2C_MASTER, 0x00, I2C_PINS_37_38, I2C_PULLUP_EXT, 400000);
  //      W0.begin(I2C_SLAVE, 0x22, I2C_PINS_18_19, I2C_PULLUP_EXT, 100000);
  //      //  W0.onReceive(hello);
  //    }
  //  }); // end of onDetect callback


  Wire.begin();
  W1.onDetect([](AsyncMST info) {
    Serial.println("Slave was reset!");
    delay(1000);
    //    W1.begin(I2C_SLAVE, 0x22, I2C_PINS_37_38, I2C_PULLUP_INT, 100000);
    //    Wire1.beginTransmission(0x22);
    //    Wire1.write("Hello Master!", 13);
    //    Wire1.endTransmission();
    //    W1.onReceive(hello);
  }); // end of onDetect callback
  //  delay(2000);
  //  W0.begin(I2C_SLAVE, 0x22, I2C_PINS_18_19, I2C_PULLUP_EXT, 100000);
}
void hello(size_t count, AsyncMST info) {
  Serial.print("Size: "); Serial.print(count);
  Serial.print(" Slave: "); Serial.print(info.slave);
  Serial.print(" Port: "); Serial.println(info.port);

  for ( uint16_t i = 0; i < count; i++ ) {
    Serial.print((char)W0.read());
  } Serial.println();
}





void SPI_MST_Thread() {
  while (1) {
    { Threads::Scope scope(MST_QUEUE);
      //      teensy_gpio.events(0);
    }
    threads.yield();
  }
}

void loop() {
  teensy_gpio.events(0);
  delay(100);
  static uint32_t _t = millis();
  if ( millis() - _t > 1000 ) {
    _t = millis();
    uint16_t bufferr[48] = { 1, 2, 3, 4, 5 };
    int val = 0;
    uint32_t _m = micros();
    teensy_gpio.pinToggle(LED_BUILTIN);
    teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
    Serial.print(micros() - _m); Serial.println("uS");
    return;
    teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, val);
    teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 1);
    teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, val);
    teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 2);
    teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, val);
    teensy_gpio.transfer16(bufferr, sizeof(bufferr) / 2, 10750, 1);
  }
  return;
  static uint32_t wire_write_timer = millis();
  static uint32_t _timer = micros();
  static uint32_t led_timer = millis();
  teensy_gpio.events(0);

  if ( millis() - led_timer >= 100 )  {
    led_timer = millis();
    { Threads::Scope scope(MST_QUEUE);
      //      teensy_gpio.pinToggle(LED_BUILTIN);
    }
    //    Serial.println("LED TOGGLE!");
    //    delay(1);
  }
  //  return;
  if ( millis() - _timer >= 2000 ) {
    _timer = millis();

    uint8_t bufff[24];
    for (uint8_t i = 0; i < sizeof(bufff); i++) bufff[i] = i;
    //    teensy_gpio.transfer(bufff, sizeof(bufff), 69, 2);

    //uint16_t notify = 0xAD00;

    //Serial.println(notify |= 1 << 0,HEX);

    // set:  notify |= 1 << 7;
    // unset:  notify &= ~(1 << 7);

    //    Serial.println(millis());

    //    W0.beginTransmission(0x20);
    //    uint8_t ibuffer[3] = { 0x0C, 0xFF, 0xFF };
    //    W0.write(ibuffer, 3); // set pullups
    //    W0.endTransmission();
    //
    //    W0.beginTransmission(0x20);
    //    W0.write(0x12); // set bankA to read
    //    W0.endTransmission();
    //
    //    W0.requestFrom(0x20, 2); // read bankA and bankB
    //    Serial.print(W0.read()); Serial.print(":"); Serial.println(W0.read());



    //    Serial.println( W0.requestFrom(0x48, 1, 1));


    //    uint8_t buffer[48];
    //
    //    for ( uint8_t i = 0; i < sizeof(buffer); i++ ) {
    //      buffer[i] = i;
    //    }
    //    uint32_t ___time = micros();
    //    teensy_gpio.transfer(buffer, sizeof(buffer), 10750,1);
    //    Serial.print("T: "); Serial.println(micros() - ___time);
    uint32_t _time = micros();
    //    SPIClass teensy_gpio;
    //SPI3 = (SPIClass)teensy_gpio;
    uint16_t *buf;
    double MST_PrintVals[12];
    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 ) {
      Serial.println();
      Serial.print("ACK PacketID 60: ");
      uint32_t t1 = micros();
      { Threads::Scope scope(MST_QUEUE);
        teensy_gpio.transfer16((uint16_t *)MST_PrintVals, sizeof(MST_PrintVals) / 2, 60, 1); // DEBUGHACK output
      }
      Serial.print(micros() - t1);
      Serial.println("uS");
    }
    else {
      Serial.println();
      Serial.print("F&F PacketID 55: ");
      uint32_t t2 = micros();
      { Threads::Scope scope(MST_QUEUE);
        teensy_gpio.transfer16((uint16_t *)MST_PrintVals, sizeof(MST_PrintVals) / 2, 55, 1);
      }
      Serial.print(micros() - t2);
      Serial.println("uS");
    }
    //    return;
    _time = micros() - _time;
    Serial.print(" OT_CALC==");
    Serial.print(OT_CALC);
    Serial.print("  micros() _time==");
    Serial.println(_time);
    if ( _time > OT_CALC ) OverTime++;
    //    teensy_gpio.events();
  }
}

Slave:
Code:
#include <SPI_MSTransfer.h>
#include <i2c_t3.h>
SPI_MSTransfer slave = SPI_MSTransfer("SLAVE", "STANDALONE");

void myCallback8(uint8_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 setup() {
  Serial.begin(115200);
  while (!Serial && millis() < 5000 )
  { Serial.print( "Teensy NOT Online @ millis=" );
    Serial.println( millis() );
    delay(30);
  }
  Serial.print( "Teensy Online @ millis=" );
  Serial.println( millis() );
  Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);

  if ( ARM_DWT_CYCCNT == ARM_DWT_CYCCNT ) {
    Serial.print( "Cycle Counter Not Enabled :" );
    Serial.println( ARM_DWT_CYCCNT );
  }
  if ( ARM_DWT_CYCCNT == ARM_DWT_CYCCNT ) {
    // Enable CPU Cycle Count
    ARM_DEMCR |= ARM_DEMCR_TRCENA;
    ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
  }
  if ( ARM_DWT_CYCCNT != ARM_DWT_CYCCNT ) {
    Serial.print( "Cycle Counter Enabled! :" );
    Serial.println( ARM_DWT_CYCCNT );
  }
  SPI1.begin();
  SPI2.begin();
  SPI1.setSCK(20); SPI1.setMOSI(21); SPI1.setMISO(5); SPI1.begin();
  SPI2.setSCK(46); SPI2.setMOSI(44); SPI2.setMISO(45); SPI2.begin();
  SPI1.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); // default speed
  SPI2.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE0)); // default speed

  slave.begin( );
  slave.onTransfer(myCallback);
  slave.onTransfer(myCallback8);
  slave.debug(Serial); // SPI_MST Debug error tracking
  //  Wire.begin(I2C_SLAVE, 0x22, I2C_PINS_18_19, I2C_PULLUP_EXT, 100000);
}


void led() {
  digitalWrite(13, !digitalRead(13));
}

void loop() {
  slave.events(0);
//  delay(100);
  //      return;
  static uint32_t retry = millis();
  if ( millis() - retry > 5 ) {
    retry = millis();
    uint16_t buf[96];
    for (uint16_t i = 0; i < sizeof(buf) / 2; i++) buf[i] = i;
    slave.transfer16(buf, sizeof(buf) / 2, 69);
  }
}

static uint16_t last_packetID = 0;
elapsedMillis TogClk;
uint32_t TogCnt = 0;
uint32_t FaFCnt = 0;
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();
  return;
  if ( 55 == info.packetID ) {
    if ( 48 != length ) {
      Serial.print("Bad Length: "); Serial.println(length); // If this shows then the SPI Passed array size is nor wrong
    }
    else if ( 0 != info.error ) {
      Serial.println("\nBad CRC: ");
    }
    else {
      double* MST_PrintVals;
      MST_PrintVals = (double *)buffer;

      {
        //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();
      }
    }
  }
  else if ( 60 == info.packetID ) {
    if ( 48 != length ) {
      Serial.print("Bad Length: "); Serial.println(length); // If this shows then the SPI Passed array size is nor wrong
    }
    else if ( 0 != info.error ) {
      Serial.println("\nBad CRC: ");
    }
    else {
      double* MST_PrintVals;
      MST_PrintVals = (double *)buffer;

      // This provides a terse output with error checked based on MASTER output to the 12 DOUBLE value Array
      {
        static uint16_t TogLast = 0;
        static uint16_t TogHz = 0;
        static uint16_t FaFHz = 0;
        static double LastVal = 100000;
        static uint32_t ChkErr = 0;
        static uint32_t CBcount = 0;
        if ( digitalReadFast( LED_BUILTIN) != TogLast ) {
          TogLast = !TogLast;
          TogCnt++;
        }
        if ( TogClk >= 1000 ) {
          TogClk -= 1000;
          TogHz = TogCnt;
          TogCnt = 0;
          FaFHz = FaFCnt;
          FaFCnt = 0;
        }
        if ( last_packetID != info.packetID ) {
          LastVal += 12;
          if ( LastVal > 65536 && LastVal < 100000 ) LastVal -= 65536;
        }
        elapsedMillis LastCB;
        double DiffMiss = 0;
        uint32_t ErrSeen = 0;
        CBcount++;
        FaFCnt++;
        for ( uint32_t ii = 0; ii < 12; ii++ ) {
          LastVal++;
          if ( 65536 == LastVal ) LastVal = 0;
          if ( LastCB > 10 || 100001 == LastVal || 100013 == 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];
            ErrSeen++;
          }
          if ( 0 != ErrSeen || 1 > ii ) {
            Serial.print( MST_PrintVals[ii] );
            Serial.print(",");
          }
          else {
            Serial.print(" #,");
          }
        }
        Serial.print( CBcount );
        Serial.print(",");
        Serial.print( ChkErr );
        Serial.print(" [");
        Serial.print( FaFHz );
        Serial.print(" ,");
        Serial.print( TogHz );
        Serial.println();
        LastCB = 0;
      }
    }
  }
  else {
    Serial.print("PacketID: ");
    Serial.println(info.packetID);
  }
  last_packetID = info.packetID;
}
 
Last edited:
Tim, I'm working on Circular_Buffer, I added list() support for ring buffer:
It outputs:

Code:
Queue Size: 7

Queue entries:
-3.14 -12.35 -78.91 -7.91 -11.91 -58.91 -18.91

Is this okay or you want other info posted there?
 
Code:
64784.00, #, #, #, #, #, #, #, #, #, #, #,49499,0 [952 ,10
64796.00, #, #, #, #, #, #, #, #, #, #, #,49500,0 [952 ,10
64808.00, #, #, #, #, #, #, #, #, #, #, #,49501,0 [952 ,10
64820.00, #, #, #, #, #, #, #, #, #, #, #,49502,0 [952 ,10
64832.00, #, #, #, #, #, #, #, #, #, #, #,49503,0 [952 ,10
64844.00, #, #, #, #, #, #, #, #, #, #, #,49504,0 [952 ,10
64856.00, #, #, #, #, #, #, #, #, #, #, #,49505,0 [952 ,10
64868.00, #, #, #, #, #, #, #, #, #, #, #,49506,0 [952 ,10
64880.00, #, #, #, #, #, #, #, #, #, #, #,49507,0 [952 ,10
64892.00, #, #, #, #, #, #, #, #, #, #, #,49508,0 [952 ,10
64904.00, #, #, #, #, #, #, #, #, #, #, #,49509,0 [952 ,10
64916.00, #, #, #, #, #, #, #, #, #, #, #,49510,0 [952 ,10
64928.00, #, #, #, #, #, #, #, #, #, #, #,49511,0 [952 ,10
64940.00, #, #, #, #, #, #, #, #, #, #, #,49512,0 [952 ,10
64952.00, #, #, #, #, #, #, #, #, #, #, #,49513,0 [952 ,10
64964.00, #, #, #, #, #, #, #, #, #, #, #,49514,0 [952 ,10
64976.00, #, #, #, #, #, #, #, #, #, #, #,49515,0 [952 ,10
64988.00, #, #, #, #, #, #, #, #, #, #, #,49516,0 [952 ,10
65000.00, #, #, #, #, #, #, #, #, #, #, #,49517,0 [952 ,10
65012.00, #, #, #, #, #, #, #, #, #, #, #,49518,0 [952 ,10
65024.00, #, #, #, #, #, #, #, #, #, #, #,49519,0 [952 ,10
65036.000000,    0.0650,    0.0650,3726460.000000,3726517.250000,65041.0000,  255.0333,  255.0353,  255.0372,65045.0000,65046.0000,65047.0000
65048.00, #, #, #, #, #, #, #, #, #, #, #,49520,0 [952 ,10
65060.00, #, #, #, #, #, #, #, #, #, #, #,49521,0 [952 ,10
65072.00, #, #, #, #, #, #, #, #, #, #, #,49522,0 [952 ,10
65084.00, #, #, #, #, #, #, #, #, #, #, #,49523,0 [952 ,10
65096.00, #, #, #, #, #, #, #, #, #, #, #,49524,0 [952 ,10
65108.00, #, #, #, #, #, #, #, #, #, #, #,49525,0 [952 ,10
65120.00, #, #, #, #, #, #, #, #, #, #, #,49526,0 [952 ,10
65132.00, #, #, #, #, #, #, #, #, #, #, #,49527,0 [952 ,10
65144.00, #, #, #, #, #, #, #, #, #, #, #,49528,0 [952 ,10
65156.00, #, #, #, #, #, #, #, #, #, #, #,49529,0 [952 ,10
65168.00, #, #, #, #, #, #, #, #, #, #, #,49530,0 [952 ,10
65180.00, #, #, #, #, #, #, #, #, #, #, #,49531,0 [952 ,10
65192.00, #, #, #, #, #, #, #, #, #, #, #,49532,0 [952 ,10
65204.00, #, #, #, #, #, #, #, #, #, #, #,49533,0 [952 ,10
65216.00, #, #, #, #, #, #, #, #, #, #, #,49534,0 [952 ,10
65228.00, #, #, #, #, #, #, #, #, #, #, #,49535,0 [952 ,10
65240.00, #, #, #, #, #, #, #, #, #, #, #,49536,0 [952 ,10
65252.00, #, #, #, #, #, #, #, #, #, #, #,49537,0 [952 ,10
65264.00, #, #, #, #, #, #, #, #, #, #, #,49538,0 [952 ,10
65276.00, #, #, #, #, #, #, #, #, #, #, #,49539,0 [952 ,10
65288.00, #, #, #, #, #, #, #, #, #, #, #,49540,0 [952 ,10
65300.00, #, #, #, #, #, #, #, #, #, #, #,49541,0 [952 ,10
65312.00, #, #, #, #, #, #, #, #, #, #, #,49542,0 [952 ,10
65324.00, #, #, #, #, #, #, #, #, #, #, #,49543,0 [952 ,10
65336.000000,    0.0653,    0.0653,3743648.750000,3743706.000000,65341.0000,  255.6208,  255.6228,  255.6247,65345.0000,65346.0000,65347.0000
65348.00, #, #, #, #, #, #, #, #, #, #, #,49544,0 [952 ,10
65360.00, #, #, #, #, #, #, #, #, #, #, #,49545,0 [952 ,10
65372.00, #, #, #, #, #, #, #, #, #, #, #,49546,0 [952 ,10
65384.00, #, #, #, #, #, #, #, #, #, #, #,49547,0 [952 ,10
65396.00, #, #, #, #, #, #, #, #, #, #, #,49548,0 [952 ,10
65408.00, #, #, #, #, #, #, #, #, #, #, #,49549,0 [952 ,10
65420.00, #, #, #, #, #, #, #, #, #, #, #,49550,0 [952 ,10
65432.00, #, #, #, #, #, #, #, #, #, #, #,49551,0 [952 ,10
65444.00, #, #, #, #, #, #, #, #, #, #, #,49552,0 [952 ,10
65456.00, #, #, #, #, #, #, #, #, #, #, #,49553,0 [952 ,10
65468.00, #, #, #, #, #, #, #, #, #, #, #,49554,0 [952 ,10
65480.00, #, #, #, #, #, #, #, #, #, #, #,49555,0 [952 ,10
65492.00, #, #, #, #, #, #, #, #, #, #, #,49556,0 [952 ,10
65504.00, #, #, #, #, #, #, #, #, #, #, #,49557,0 [952 ,10
65516.00, #, #, #, #, #, #, #, #, #, #, #,49558,0 [952 ,10
65528.00, #, #, #, #, #, #, #, #, #, #, #,49559,0 [952 ,10
4.00, #, #, #, #, #, #, #, #, #, #, #,49560,0 [952 ,10
16.00, #, #, #, #, #, #, #, #, #, #, #,49561,0 [952 ,10
28.00, #, #, #, #, #, #, #, #, #, #, #,49562,0 [952 ,10
40.00, #, #, #, #, #, #, #, #, #, #, #,49563,0 [952 ,10
52.00, #, #, #, #, #, #, #, #, #, #, #,49564,0 [952 ,10
64.00, #, #, #, #, #, #, #, #, #, #, #,49565,0 [952 ,10
76.00, #, #, #, #, #, #, #, #, #, #, #,49566,0 [952 ,10
88.00, #, #, #, #, #, #, #, #, #, #, #,49567,0 [952 ,10
100.000000,    0.0001,    0.0001,5901.464844,5958.760742,  105.0000,   10.2956,   10.3441,   10.3923,  109.0000,  110.0000,  111.0000
112.00, #, #, #, #, #, #, #, #, #, #, #,49568,0 [952 ,10
124.00, #, #, #, #, #, #, #, #, #, #, #,49569,0 [952 ,10
136.00, #, #, #, #, #, #, #, #, #, #, #,49570,0 [952 ,10
148.00, #, #, #, #, #, #, #, #, #, #, #,49571,0 [952 ,10
160.00, #, #, #, #, #, #, #, #, #, #, #,49572,0 [952 ,10
172.00, #, #, #, #, #, #, #, #, #, #, #,49573,0 [952 ,10
184.00, #, #, #, #, #, #, #, #, #, #, #,49574,0 [952 ,10
196.00, #, #, #, #, #, #, #, #, #, #, #,49575,0 [952 ,10
208.00, #, #, #, #, #, #, #, #, #, #, #,49576,0 [952 ,10
220.00, #, #, #, #, #, #, #, #, #, #, #,49577,0 [952 ,10
232.00, #, #, #, #, #, #, #, #, #, #, #,49578,0 [952 ,10
244.00, #, #, #, #, #, #, #, #, #, #, #,49579,0 [952 ,10
256.00, #, #, #, #, #, #, #, #, #, #, #,49580,0 [952 ,10
268.00, #, #, #, #, #, #, #, #, #, #, #,49581,0 [952 ,10
280.00, #, #, #, #, #, #, #, #, #, #, #,49582,0 [952 ,10
292.00, #, #, #, #, #, #, #, #, #, #, #,49583,0 [952 ,10
304.00, #, #, #, #, #, #, #, #, #, #, #,49584,0 [952 ,10
316.00, #, #, #, #, #, #, #, #, #, #, #,49585,0 [952 ,10
328.00, #, #, #, #, #, #, #, #, #, #, #,49586,0 [952 ,10
340.00, #, #, #, #, #, #, #, #, #, #, #,49587,0 [952 ,10
352.00, #, #, #, #, #, #, #, #, #, #, #,49588,0 [952 ,10
364.00, #, #, #, #, #, #, #, #, #, #, #,49589,0 [952 ,10
376.00, #, #, #, #, #, #, #, #, #, #, #,49590,0 [952 ,10
388.00, #, #, #, #, #, #, #, #, #, #, #,49591,0 [952 ,10
400.000000,    0.0004,    0.0004,23090.197266,23147.494141,  405.0000,   20.1494,   20.1742,   20.1990,  409.0000,  410.0000,  411.0000
412.00, #, #, #, #, #, #, #, #, #, #, #,49592,0 [952 ,10
424.00, #, #, #, #, #, #, #, #, #, #, #,49593,0 [952 ,10
436.00, #, #, #, #, #, #, #, #, #, #, #,49594,0 [952 ,10
448.00, #, #, #, #, #, #, #, #, #, #, #,49595,0 [952 ,10
460.00, #, #, #, #, #, #, #, #, #, #, #,49596,0 [952 ,10
472.00, #, #, #, #, #, #, #, #, #, #, #,49597,0 [952 ,10
484.00, #, #, #, #, #, #, #, #, #, #, #,49598,0 [952 ,10
496.00, #, #, #, #, #, #, #, #, #, #, #,49599,0 [952 ,10
508.00, #, #, #, #, #, #, #, #, #, #, #,49600,0 [952 ,10
520.00, #, #, #, #, #, #, #, #, #, #, #,49601,0 [952 ,10
532.00, #, #, #, #, #, #, #, #, #, #, #,49602,0 [952 ,10
544.00, #, #, #, #, #, #, #, #, #, #, #,49603,0 [952 ,10
556.00, #, #, #, #, #, #, #, #, #, #, #,49604,0 [952 ,10



Code:
ALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==53
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
^LTF&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==51
F&F (OT=24) OT_CALC==100  micros() _time==52
F&F (OT=24) OT_CALC==100  micros() _time==51

ignore the OT, I was flashing different things to slave, i rebooted the master, OT is stable at 0
 
I think its a problem with the T3.5/T3.2 combo again, or I have a bad T3.5 or T3.2. On the t3.5/3.5 combo able to transfer no problem as demonstrated by the uNav sketch which it could do before. I am going to load up your sketches just to be sure.
 
Holy crap
tim!!
Code:
58300.00, #, #, #, #, #, #, #, #, #, #, #,94627,35295 [2115 ,9
58312.00, #, #, #, #, #, #, #, #, #, #, #,94628,35295 [[color="#ff0000"][b]2115[/b][/color] ,9
58324.00, #, #, #, #, #, #, #, #, #, #, #,94629,35295 [2115 ,9
58336.00, #, #, #, #, #, #, #, #, #, #, #,94630,35295 [2115 ,9
58348.00, #, #, #, #, #, #, #, #, #, #, #,94631,35295 [2115 ,9
58360.00, #, #, #, #, #, #, #, #, #, #, #,94632,35295 [2115 ,9
58372.00, #, #, #, #, #, #, #, #, #, #, #,94633,35295 [2115 ,9
58384.00, #, #, #, #, #, #, #, #, #, #, #,94634,35295 [2115 ,9
58396.00, #, #, #, #, #, #, #, #, #, #, #,94635,35295 [2115 ,9
58408.00, #, #, #, #, #, #, #, #, #, #, #,94636,35295 [2115 ,9
58420.00, #, #, #, #, #, #, #, #, #, #, #,94637,35295 [2115 ,9
58432.00, #, #, #, #, #, #, #, #, #, #, #,94638,35295 [2115 ,9
58444.00, #, #, #, #, #, #, #, #, #, #, #,94639,35295 [2115 ,9
58456.00, #, #, #, #, #, #, #, #, #, #, #,94640,35295 [2115 ,9
58468.00, #, #, #, #, #, #, #, #, #, #, #,94641,35295 [2115 ,9
58480.00, #, #, #, #, #, #, #, #, #, #, #,94642,35295 [2115 ,9
58492.00, #, #, #, #, #, #, #, #, #, #, #,94643,35295 [2115 ,9
58504.00, #, #, #, #, #, #, #, #, #, #, #,94644,35295 [2115 ,9
58516.000000,    0.0585,    0.0585,3352891.500000,3352948.750000,58521.0000,  241.9132,  241.9153,  241.9173,58525.0000,58526.0000,58527.0000
58528.00, #, #, #, #, #, #, #, #, #, #, #,94645,35295 [2115 ,9
58540.00, #, #, #, #, #, #, #, #, #, #, #,94646,35295 [2115 ,9
58552.00, #, #, #, #, #, #, #, #, #, #, #,94647,35295 [2115 ,9
58564.00, #, #, #, #, #, #, #, #, #, #, #,94648,35295 [2115 ,9
58576.00, #, #, #, #, #, #, #, #, #, #, #,94649,35295 [2115 ,9
58588.00, #, #, #, #, #, #, #, #, #, #, #,94650,35295 [2115 ,9
58600.00, #, #, #, #, #, #, #, #, #, #, #,94651,35295 [2115 ,9
58612.00, #, #, #, #, #, #, #, #, #, #, #,94652,35295 [2115 ,9
58624.00, #, #, #, #, #, #, #, #, #, #, #,94653,35295 [2115 ,9
58636.00, #, #, #, #, #, #, #, #, #, #, #,94654,35295 [2115 ,9
58648.00, #, #, #, #, #, #, #, #, #, #, #,94655,35295 [2115 ,9
58660.00, #, #, #, #, #, #, #, #, #, #, #,94656,35295 [2115 ,9
58672.00, #, #, #, #, #, #, #, #, #, #, #,94657,35295 [2115 ,9
58684.00, #, #, #, #, #, #, #, #, #, #, #,94658,35295 [2115 ,9
58696.00, #, #, #, #, #, #, #, #, #, #, #,94659,35295 [2115 ,9
58708.00, #, #, #, #, #, #, #, #, #, #, #,94660,35295 [2115 ,9
58720.00, #, #, #, #, #, #, #, #, #, #, #,94661,35295 [2115 ,9
58732.00, #, #, #, #, #, #, #, #, #, #, #,94662,35295 [2115 ,9
58744.00, #, #, #, #, #, #, #, #, #, #, #,94663,35295 [2115 ,9
58756.00, #, #, #, #, #, #, #, #, #, #, #,94664,35295 [2115 ,9
58768.00, #, #, #, #, #, #, #, #, #, #, #,94665,35295 [2115 ,9
58780.00, #, #, #, #, #, #, #, #, #, #, #,94666,35295 [2115 ,9
58792.00, #, #, #, #, #, #, #, #, #, #, #,94667,35295 [2115 ,9
58804.00, #, #, #, #, #, #, #, #, #, #, #,94668,35295 [2115 ,9
58816.000000,    0.0588,    0.0588,3370080.250000,3370137.500000,58821.0000,  242.5325,  242.5345,  242.5366,58825.0000,58826.0000,58827.0000
58828.00, #, #, #, #, #, #, #, #, #, #, #,94669,35295 [2115 ,9
58840.00, #, #, #, #, #, #, #, #, #, #, #,94670,35295 [2115 ,9
58852.00, #, #, #, #, #, #, #, #, #, #, #,94671,35295 [2115 ,9
58864.00, #, #, #, #, #, #, #, #, #, #, #,94672,35295 [2115 ,9
58876.00, #, #, #, #, #, #, #, #, #, #, #,94673,35295 [2115 ,9
58888.00, #, #, #, #, #, #, #, #, #, #, #,94674,35295 [2115 ,9
58900.00, #, #, #, #, #, #, #, #, #, #, #,94675,35295 [2115 ,9
58912.00, #, #, #, #, #, #, #, #, #, #, #,94676,35295 [2115 ,9
58924.00, #, #, #, #, #, #, #, #, #, #, #,94677,35295 [2115 ,9
58936.00, #, #, #, #, #, #, #, #, #, #, #,94678,35295 [2115 ,9
58948.00, #, #, #, #, #, #, #, #, #, #, #,94679,35295 [2115 ,9
58960.00, #, #, #, #, #, #, #, #, #, #, #,94680,35295 [2115 ,9
58972.00, #, #, #, #, #, #, #, #, #, #, #,94681,35295 [2115 ,9
58984.00, #, #, #, #, #, #, #, #, #, #, #,94682,35295 [2115 ,9
58996.00, #, #, #, #, #, #, #, #, #, #, #,94683,35295 [2115 ,9
59008.00, #, #, #, #, #, #, #, #, #, #, #,94684,35295 [2115 ,9
59020.00, #, #, #, #, #, #, #, #, #, #, #,94685,35295 [2115 ,9
59032.00, #, #, #, #, #, #, #, #, #, #, #,94686,35295 [2115 ,9
59044.00, #, #, #, #, #, #, #, #, #, #, #,94687,35295 [2115 ,9
59056.00, #, #, #, #, #, #, #, #, #, #, #,94688,35295 [2115 ,9
59068.00, #, #, #, #, #, #, #, #, #, #, #,94689,35295 [2115 ,9
59080.00, #, #, #, #, #, #, #, #, #, #, #,94690,35295 [2115 ,9
59092.00, #, #, #, #, #, #, #, #, #, #, #,94691,35295 [2115 ,9
59104.00, #, #, #, #, #, #, #, #, #, #, #,94692,35295 [2115 ,9
59116.000000,    0.0591,    0.0591,3387269.000000,3387326.250000,59121.

thats modifying TVmaster timer to micros instead of millis, this:

Code:
  if ( micros() - _timer >= 400 ) {
    _timer = micros();
and move events to main loop()
 
THIS at 30mhz stock CPUs
Code:
38440.00, #, #, #, #, #, #, #, #, #, #, #,544494,39051 [[COLOR="#FF0000"][B]2376[/B][/COLOR] ,10
38452.00, #, #, #, #, #, #, #, #, #, #, #,544495,39051 [2376 ,10
38464.00, #, #, #, #, #, #, #, #, #, #, #,544496,39051 [2376 ,10
38476.00, #, #, #, #, #, #, #, #, #, #, #,544497,39051 [2376 ,10
38488.00, #, #, #, #, #, #, #, #, #, #, #,544498,39051 [2376 ,10
38500.00, #, #, #, #, #, #, #, #, #, #, #,544499,39051 [2376 ,10
38512.00, #, #, #, #, #, #, #, #, #, #, #,544500,39051 [2376 ,10
38524.00, #, #, #, #, #, #, #, #, #, #, #,544501,39051 [2376 ,10
38536.00, #, #, #, #, #, #, #, #, #, #, #,544502,39051 [2376 ,10
38548.00, #, #, #, #, #, #, #, #, #, #, #,544503,39051 [2376 ,10
38560.00, #, #, #, #, #, #, #, #, #, #, #,544504,39051 [2376 ,10
38572.00, #, #, #, #, #, #, #, #, #, #, #,544505,39051 [2376 ,10
38584.00, #, #, #, #, #, #, #, #, #, #, #,544506,39051 [2376 ,10
38596.00, #, #, #, #, #, #, #, #, #, #, #,544507,39051 [2376 ,10
38608.000000,    0.0386,    0.0386,2212247.250000,2212304.500000,38613.0000,  196.5045,  196.5070,  196.5095,38617.0000,38618.0000,38619.0000
38620.00, #, #, #, #, #, #, #, #, #, #, #,544508,39051 [2376 ,10
38632.00, #, #, #, #, #, #, #, #, #, #, #,544509,39051 [2376 ,10
38644.00, #, #, #, #, #, #, #, #, #, #, #,544510,39051 [2376 ,10
38656.00, #, #, #, #, #, #, #, #, #, #, #,544511,39051 [2376 ,10
38668.00, #, #, #, #, #, #, #, #, #, #, #,544512,39051 [2376 ,10
38680.00, #, #, #, #, #, #, #, #, #, #, #,544513,39051 [2376 ,10
38692.00, #, #, #, #, #, #, #, #, #, #, #,544514,39051 [2376 ,10
38704.00, #, #, #, #, #, #, #, #, #, #, #,544515,39051 [2376 ,10
38716.00, #, #, #, #, #, #, #, #, #, #, #,544516,39051 [2376 ,10
38728.00, #, #, #, #, #, #, #

Code:
void loop() {
  static uint32_t _timer = millis();
  teensy_gpio.events(700);
  if ( !(millis() % 100) )  {
    teensy_gpio.pinToggle(LED_BUILTIN);
    Serial.print("^LT");
    delay(1);
  }
  if ( micros() - _timer >= 400 ) {
    _timer = micros();
    uint32_t _time = micros();
 
No lags at that rate at all, using 700 micros for events() and 400micros timer!
its always within 2376 -> 2378 no jumping, no lag, STABLE!

results!!

above is with OVERLOAD 1

with OVERLOAD 2, to stop "jittering" (overflow?) INCREASE 400 to 700 for timer! You get a steady stream of 1364s!!!!!

you need 800uS for OVERLOAD 0, which results at 1190 !

overload 1 is the winner!? :)

im sure Tim could beat those results! Timing is everything!
 
WITH THE T3.5 OC @ 168MHZ SLAVE::::::

0 == 4745 @ 200 uS !!!!!!!!!
1 == 4745 @ 200 uS !!!!!!!!!!!!!
2 == 2367 @ 400 uS

Tim????????????????????????????????????????????????

:)

EDIT: https://www.youtube.com/watch?v=WtBAZK9M5ts

from testing, you need at least 400-500ms MINIMUM, so I suggest we default that in the library to 400-500uS for events()
anything faster and you'll start getting bad values


4747 is the highest I can get running aparently *stable* :)
 
Last edited:
on the t3.5/T3.2 combo - master on T3.5 at 168 and slave on T3.2 at 120 - nothing: all I got on the master was:
Code:
C:\Users\CyberPalin\Documents\Arduino\tontons_i2c_master\tontons_i2c_master.ino Apr 19 2018 16:32:24
SUM: -192.04887
MIN: -78.91234
MAX: 0.00000
MEDIAN: -12.34560
AVG: -27.43555
Deviation: 27.13280106
-78.91234 -58.91234 -18.91234 -12.34560 -11.91234 -7.91234 -3.14159 
16
400
DBG: [S_CS 15] CB Capacity: 16 Length: 400
Slave was reset!
FAIL_Res #1 RETRY...
FAIL_Res #2 RETRY...
FAIL_Res #3 RETRY...
DBG: [S_CS 15] FAIL_RES #4 Tx ABORT. 
4040221uS
DBG: [S_CS 15] 1/16 DEQUEUE(S) LEFT
FAIL_Res #1 RETRY...
FAIL_Res #2 RETRY...
FAIL_Res #3 RETRY...
DBG: [S_CS 15] FAIL_RES #4 Tx ABORT. 
4040214uS
DBG: [S_CS 15] 1/16 DEQUEUE(S) LEFT
FAIL_Res #1 RETRY...
FAIL_Res #2 RETRY...
FAIL_Res #3 RETRY...
DBG: [S_CS 15] FAIL_RES #4 Tx ABORT. 
4040216uS

Going to try the TVmaster/slave combo again. BTW - Thought I fixed that to take the events out of the timer. Hmm

UPDATE: Loaded up master and slave. Results same as described previously with master/slave transfers only. Every message sent from master to slave resulted in OTs and nothing sent back from the slave. When I unplug and plug the master back with the slave still plugged in the slave dumps what it has its buffer, I guess, as I described in the original post. And yes I moved the events out of the timer loop.

UPDATE1: Same thing happens with slave at 96MHz but when I reset the master I don't get the bad blocks but nice clean data:
Code:
0.00, #, #, #, #, #, #, #, #, #, #, #,1,0 [0 ,0
12.00, #, #, #, #, #, #, #, #, #, #, #,2,0 [1 ,0
24.00, #, #, #, #, #, #, #, #, #, #, #,3,0 [1 ,0
36.00, #, #, #, #, #, #, #, #, #, #, #,4,0 [1 ,0
48.00, #, #, #, #, #, #, #, #, #, #, #,5,0 [1 ,0
60.00, #, #, #, #, #, #, #, #, #, #, #,6,0 [1 ,0
72.00, #, #, #, #, #, #, #, #, #, #, #,7,0 [1 ,0
84.00, #, #, #, #, #, #, #, #, #, #, #,8,0 [1 ,0
96.00, #, #, #, #, #, #, #, #, #, #, #,9,0 [1 ,0
108.00, #, #, #, #, #, #, #, #, #, #, #,10,0 [1 ,0
120.00, #, #, #, #, #, #, #, #, #, #, #,11,0 [1 ,0
132.00, #, #, #, #, #, #, #, #, #, #, #,12,0 [1 ,0
144.00, #, #, #, #, #, #, #, #, #, #, #,13,0 [1 ,0
156.00, #, #, #, #, #, #, #, #, #, #, #,14,0 [1 ,0
168.00, #, #, #, #, #, #, #, #, #, #, #,15,0 [1 ,0
180.00, #, #, #, #, #, #, #, #, #, #, #,16,0 [1 ,0
192.00, #, #, #, #, #, #, #, #, #, #, #,17,0 [1 ,0
204.00, #, #, #, #, #, #, #, #, #, #, #,18,0 [1 ,0

I know this may sound strange but did you do anything changing the defines for the different boards that would affect this?
 
uggest we default that in the library to 400-500uS for events()

I agree, avoids having to play around with timing - just defaults to the minimum. - regardless of the config issues I am having with the 3.5/3.2 combo.
 
Here is a new update for you. Decided to let it sit for about 10-15 minutes and finally got some data over to the slave:
Code:
0.00, #, #, #, #, #, #, #, #, #, #, #,1,0 [0 ,0
12.00, #, #, #, #, #, #, #, #, #, #, #,2,0 [0 ,0
24.00, #, #, #, #, #, #, #, #, #, #, #,3,0 [0 ,0
36.00, #, #, #, #, #, #, #, #, #, #, #,4,0 [0 ,0
48.00, #, #, #, #, #, #, #, #, #, #, #,5,0 [0 ,0
60.00, #, #, #, #, #, #, #, #, #, #, #,6,0 [0 ,0
72.00, #, #, #, #, #, #, #, #, #, #, #,7,0 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -48.00
132.00,133.00,134.00,135.00,136.00,137.00,138.00,139.00,140.00,141.00,142.00,143.00,8,1 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -360.00
504.00,505.00,506.00,507.00,508.00,509.00,510.00,511.00,512.00,513.00,514.00,515.00,9,2 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -192.00
708.00,709.00,710.00,711.00,712.00,713.00,714.00,715.00,716.00,717.00,718.00,719.00,10,3 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -204.00
924.00,925.00,926.00,927.00,928.00,929.00,930.00,931.00,932.00,933.00,934.00,935.00,11,4 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -168.00
1104.00,1105.00,1106.00,1107.00,1108.00,1109.00,1110.00,1111.00,1112.00,1113.00,1114.00,1115.00,12,5 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -180.00
1296.00,1297.00,1298.00,1299.00,1300.00,1301.00,1302.00,1303.00,1304.00,1305.00,1306.00,1307.00,13,6 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -192.00
1500.00,1501.00,1502.00,1503.00,1504.00,1505.00,1506.00,1507.00,1508.00,1509.00,1510.00,1511.00,14,7 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -204.00
1716.00,1717.00,1718.00,1719.00,1720.00,1721.00,1722.00,1723.00,1724.00,1725.00,1726.00,1727.00,15,8 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -168.00
1896.00,1897.00,1898.00,1899.00,1900.00,1901.00,1902.00,1903.00,1904.00,1905.00,1906.00,1907.00,16,9 [0 ,0

Bad CRC: 

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -192.00
2112.00,2113.00,2114.00,2115.00,2116.00,2117.00,2118.00,2119.00,2120.00,2121.00,2122.00,2123.00,17,10 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -204.00
2328.00,2329.00,2330.00,2331.00,2332.00,2333.00,2334.00,2335.00,2336.00,2337.00,2338.00,2339.00,18,11 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -156.00
2496.00,2497.00,2498.00,2499.00,2500.00,2501.00,2502.00,2503.00,2504.00,2505.00,2506.00,2507.00,19,12 [0 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -192.00
2700.00,2701.00,2702.00,2703.00,2704.00,2705.00,2706.00,2707.00,2708.00,2709.00,2710.00,2711.00,20,13 [19 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -204.00
2916.00,2917.00,2918.00,2919.00,2920.00,2921.00,2922.00,2923.00,2924.00,2925.00,2926.00,2927.00,21,14 [19 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -168.00
3096.00,3097.00,3098.00,3099.00,3100.00,3101.00,3102.00,3103.00,3104.00,3105.00,3106.00,3107.00,22,15 [19 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -192.00
3300.00,3301.00,3302.00,3303.00,3304.00,3305.00,3306.00,3307.00,3308.00,3309.00,3310.00,3311.00,23,16 [19 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -204.00
3516.00,3517.00,3518.00,3519.00,3520.00,3521.00,3522.00,3523.00,3524.00,3525.00,3526.00,3527.00,24,17 [19 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -168.00
3696.00,3697.00,3698.00,3699.00,3700.00,3701.00,3702.00,3703.00,3704.00,3705.00,3706.00,3707.00,25,18 [19 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -372.00
4080.00,4081.00,4082.00,4083.00,4084.00,4085.00,4086.00,4087.00,4088.00,4089.00,4090.00,4091.00,26,19 [19 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -24.00
4116.00,4117.00,4118.00,4119.00,4120.00,4121.00,4122.00,4123.00,4124.00,4125.00,4126.00,4127.00,27,20 [19 ,0

Bad LASTVAL TEST INCREMENT <<<<<<<<<<<<<<<<<<<< DIFF OF> -168.00
4296.00,4297.00,4298.00,4299.00,4300.00,4301.00,4302.00,4303.00,4304.00,4305.00,4306.00,4307.00,28,21 [19 ,0
 
did you specify events(value)??? specifically 500 or higher?
the 3.2 might need higher value
keep slave at events(0)

only change master
 
this is the one im running ATM non stop, OT still 0, 4746 Hz F&F's

Master:
Code:
#include <SPI.h>
#include <SPI_MSTransfer.h>
#include "A_ConfigDefines.h"

//#define SPI_SPEED 30500
#define SPI_SPEED 30000000
#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

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

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

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();
}

uint32_t OverTime = 0;
void loop() {
  static uint32_t _timer = millis();
  teensy_gpio.events(300);
  if ( !(millis() % 100) )  {
    teensy_gpio.pinToggle(LED_BUILTIN);
    Serial.print("^LT");
    delay(1);
  }
  if ( micros() - _timer >= 200 ) {
    _timer = micros();
    uint32_t _time = micros();

    uint16_t *buf;
    double MST_PrintVals[12];
    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++;
  }
}

Slave
Code:
#include <SPI_MSTransfer.h>

SPI_MSTransfer slave = SPI_MSTransfer("SLAVE", "STANDALONE");


void setup() {
  Serial.begin(115200);
  while (!Serial && millis() < 5000 )
  { Serial.print( "Teensy NOT Online @ millis=" );
    Serial.println( millis() );
    delay(30);
  }
  Serial.print( "Teensy Online @ millis=" );
  Serial.println( millis() );
  Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);

  if ( ARM_DWT_CYCCNT == ARM_DWT_CYCCNT ) {
    Serial.print( "Cycle Counter Not Enabled :" );
    Serial.println( ARM_DWT_CYCCNT );
  }
  if ( ARM_DWT_CYCCNT == ARM_DWT_CYCCNT ) {
    // Enable CPU Cycle Count
    ARM_DEMCR |= ARM_DEMCR_TRCENA;
    ARM_DWT_CTRL |= ARM_DWT_CTRL_CYCCNTENA;
  }
  if ( ARM_DWT_CYCCNT != ARM_DWT_CYCCNT ) {
    Serial.print( "Cycle Counter Enabled! :" );
    Serial.println( ARM_DWT_CYCCNT );
  }
  slave.begin( );
  slave.onTransfer(myCallback);
  // slave.debug(Serial); // SPI_MST Debug error tracking

}
void led() {
  digitalWrite(13, !digitalRead(13));
}

void loop() {
  slave.events(0);
}

static uint16_t last_packetID = 0;
elapsedMillis TogClk;
uint32_t TogCnt = 0;
uint32_t FaFCnt = 0;
void myCallback(uint16_t *buffer, uint16_t length, AsyncMST info) {
  if ( 55 == info.packetID ) {
    if ( 48 != length ) {
      Serial.print("Bad Length: "); Serial.println(length); // If this shows then the SPI Passed array size is nor wrong
    }
    else if ( 0 != info.error ) {
      Serial.println("\nBad CRC: ");
    }
    else {
      double* MST_PrintVals;
      MST_PrintVals = (double *)buffer;

      {
        //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();
      }
    }
  }
  else if ( 60 == info.packetID ) {
    if ( 48 != length ) {
      Serial.print("Bad Length: "); Serial.println(length); // If this shows then the SPI Passed array size is nor wrong
    }
    else if ( 0 != info.error ) {
      Serial.println("\nBad CRC: ");
    }
    else {
      double* MST_PrintVals;
      MST_PrintVals = (double *)buffer;

// This provides a terse output with error checked based on MASTER output to the 12 DOUBLE value Array
      {
        static uint16_t TogLast = 0;
        static uint16_t TogHz =0;
        static uint16_t FaFHz =0;
        static double LastVal = 100000;
        static uint32_t ChkErr = 0;
        static uint32_t CBcount = 0;
        if ( digitalReadFast( LED_BUILTIN) != TogLast ) { 
          TogLast = !TogLast; 
          TogCnt++; 
        }
        if ( TogClk >=1000 ) {
          TogClk -= 1000;
          TogHz = TogCnt;
          TogCnt = 0;
          FaFHz = FaFCnt;
          FaFCnt = 0;
        }
        if ( last_packetID != info.packetID ) {
          LastVal += 12;
          if ( LastVal > 65536 && LastVal < 100000 ) LastVal -= 65536;
        }
        elapsedMillis LastCB;
        double DiffMiss = 0;
        uint32_t ErrSeen = 0;
        CBcount++;
        FaFCnt++;
        for ( uint32_t ii = 0; ii < 12; ii++ ) {
          LastVal++;
          if ( 65536 == LastVal ) LastVal = 0;
          if ( LastCB > 10 || 100001 == LastVal || 100013 == 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];
            ErrSeen++;
          }
          if ( 0 != ErrSeen || 1 > ii ) {
            Serial.print( MST_PrintVals[ii] );
            Serial.print(",");
          }
          else {
            Serial.print(" #,");
          }
        }
        Serial.print( CBcount );
        Serial.print(",");
        Serial.print( ChkErr );
        Serial.print(" [");
        Serial.print( FaFHz );
        Serial.print(" ,");
        Serial.print( TogHz );
        Serial.println();
        LastCB = 0;
      }
    }
  }
  else {
    Serial.print("PacketID: ");
    Serial.println(info.packetID);
  }
  last_packetID = info.packetID;
}
 
No didn't change the events just used what you had for settings - will update and let you know. Stay tuned.
 
#1368 will happen if you DON'T specify the value
Find your sweet spot so we can update it as default :)

default is 100 (uS) , 400 or higher is working on my t3.5 slave
 
Last edited:
Just not working. Tried 300, 500, 800 and 100 on the master at 168 and the slave at 120. Same thing keeps happening. I also tried different combos of CPU speed on the master and slave, same thing.

EDIT> Need a break and then will try again.
 
go higher, exagerate if you have to, its micros() so try like 33333, maybe ur 3.2 cant handle a faster micros? if i go 300 or below i get what you got on #1368, when i go over 400 no issues, even works when i put 10000

try also slowing down your timer, start off slow then increase till it “fails”
also only use overload 1 till u get it working, its stable here slave must be events(0)!
only value the master events(500+)
 
Back
Top