T4.x support for Raw HID 512? wonder if it makes sense to add to system?

As I mentioned I probably have some bugs in the code, I have found some.

Right now I am using T3.6 plugged into Micromod as to force it to use full speed instead of High speed... With High speed they won't even talk if I have Logic Analyzer hooked up. Probably some of the handshake stuff between the two for Full speed...
 
Seems this is the current work in progress? github.com/KurtE/RawHid

For prior tests it was done with the current Release code but the new sketch and was working - except network buffer limits in the extended test showed missing message anomalies - that were due to use of ethernet code without enough buffers for the test at hand, not USB or RawHID. Going back to USB Serial for testing and the issues are resolved with even more buffer abuse.

Will see about putting USBHost w/RawHid echo Teensy back in place - too much spew to watch - but simple text transfer some couple hundred thousand a day.
 
A RawHid 512 option is something I personally would like to have available, especially for my use case of real-time video streaming from PC to Teensy4.1. I have a custom headless video player based off of libvlc, that requires a low latency video output device (DDRAW, hi-speed USB, etc..) . This is where RawHid with a packet size of 512 would be beneficial.
 
I started playing again with maybe file transfers and the like as I know that it stresses out the system.

I have resolved some of the issues, and found that the T3.6 and T4.1 act differently as being plugged into the Micromod.

I pushed up a few merging in of the earlier larger RAWHID stuff into my USBSerial branch of USBHost_t36. Was not sure if maybe I had
fixed some of these issues 1.5 years ago, by doing things like allowing for more active transfers, plus the ability to set buffers...

The upload code was failing, but in the code I put in a 1ms delay between packets being sent over USBHost to RAWHID and the transfer completed. Not sure yet if everythin properly closed each command down... But it looked more promising.

Not sure yet if USBHost side or core USB type RAWHID issue, where I was for the most part sending a rawhid packet every iteration, and it either did not allow the response packet to be processed. Still probably need to debug that.
 
Afternoon @KurtE (at least in NY)

Anyways I downloaded the latest and greatest changes you made and tried transferring a 4.8mb jpg.

The sketch says it transferred the file successfully:
Code:
 bytes:#################### Exit Download main Loop ##########################
lsrhid: 8 0x20057e64 4 1000
.(4810864)

Remote Send File Completed

Completed, total byte: 4810864 elapsed millis: 223547

and when I did a LD it shows correctly:
Code:
JWST-SideView.jpg * * * * * * * * * *C: 05/08/2023 14:21 M: 01/01/2022 08:51 *4810864
but when put back in the directory shows only 4.7 MB and if I open the file you can see that it missed transferring some the image.
oh and after the transfer I tried to do a 'd' remote directory and that didn't work.

Here is scaled down version of the transferred image - think its clear there were transfer issues:
JWST-SideView.jpg

NOTE: For host I am using a Teensy Micromod with a Teensy 4.1 via the USBHost connector.
 
Thanks @mjs513, as I mentioned just got that one to limp along... Will need to debug why they are not syncing fully back up to expecting command...

Should also put in more checking of stuff. But as they say I mainly doing this for playing.
 
Thanks @mjs513, as I mentioned just got that one to limp along... Will need to debug why they are not syncing fully back up to expecting command...

Should also put in more checking of stuff. But as they say I mainly doing this for playing.

Ditto - me too (playing for fun). Just wanted to let you know.
 
Not sure if I have everything setup correctly? Arduino 1.8.19 TD1.59B2 latest USBHost_t36-USBSerial and RawHID-main.zip. Compiled remote T4.1 with RawHID setting and host T4.1 with Serial+MTP.

It's trying to work but as stated it's erratic. I just need to know if I have all the correct pieces I need and if I am setup correctly...
 
Not sure if I have everything setup correctly? Arduino 1.8.19 TD1.59B2 latest USBHost_t36-USBSerial and RawHID-main.zip. Compiled remote T4.1 with RawHID setting and host T4.1 with Serial+MTP.

It's trying to work but as stated it's erratic. I just need to know if I have all the correct pieces I need and if I am setup correctly...

Thats pretty much it. One change you need to make the host sketch
Code:
void loop() {
  mtp_loop;
  myusb.Task();

  uint8_t filename[256];

  int cmd = check_Serial_for_command(filename);
  if (cmd != CMD_NONE) {
    Serial.printf("CMD:%d Filename:%s\n", cmd, filename);
    switch (cmd) {
      case CMD_DIR: remote_dir(filename); break;
      case CMD_CD: remote_cd(filename); break;
      case CMD_DOWNLOAD: download(filename); break;
      case CMD_UPLOAD: upload(filename); break;
      case CMD_LOCAL_DIR: print_local_dir(filename); break;
      case CMD_LOCAL_CD: local_cd(filename); break;
      case CMD_RESET: remote_reset(); break;
    }    
[COLOR="#FF0000"]    rawhid1.attachReceive(OnReceiveHIDData);
[/COLOR]  }

  // check if any data has arrived on the USBHost serial port
  forward_remote_serial();

  #ifdef PRINT_DEVICE_INFO
  // Optional. 
  UpdateActiveDeviceInfo();
  #endif
}

Add that line in red. Oh and dont be like me forgetting to reload the remote sketch as well as the host. :)
 
Thats pretty much it. One change you need to make the host sketch
Code:
void loop() {
  mtp_loop;
  myusb.Task();

  uint8_t filename[256];

  int cmd = check_Serial_for_command(filename);
  if (cmd != CMD_NONE) {
    Serial.printf("CMD:%d Filename:%s\n", cmd, filename);
    switch (cmd) {
      case CMD_DIR: remote_dir(filename); break;
      case CMD_CD: remote_cd(filename); break;
      case CMD_DOWNLOAD: download(filename); break;
      case CMD_UPLOAD: upload(filename); break;
      case CMD_LOCAL_DIR: print_local_dir(filename); break;
      case CMD_LOCAL_CD: local_cd(filename); break;
      case CMD_RESET: remote_reset(); break;
    }    
[COLOR="#FF0000"]    rawhid1.attachReceive(OnReceiveHIDData);
[/COLOR]  }

  // check if any data has arrived on the USBHost serial port
  forward_remote_serial();

  #ifdef PRINT_DEVICE_INFO
  // Optional. 
  UpdateActiveDeviceInfo();
  #endif
}

Add that line in red. Oh and dont be like me forgetting to reload the remote sketch as well as the host. :)

Thanks:) Just noticed a change to RawHID on @KurtE's GitHub. So will also download that as well. This is going to be fun to play with...
 
I have it uploading and downloading files consistently. Basically had to turn off MTP and all debugging. Was able to eliminate the delays as well which helps with the transfer speeds. I think the remote side was being overrun. Ran out of time to mess with it anymore tonight:( Hopefully some more tomorrow. @KurtE, is this transferring at 480 Mbs (thanks defragster) ?
 
Glad I could help - however that was this time :) Great you got the pieces together and working!

lawn tractor mower deck broke - so learning to use the welder I got to put the lift bracket back on where rusted metal finally failed. Fun so far ... a couple days of distraction ... looking now not sure anything new would last 25 years so on the job learning to get back to yardwork. Putting it away with wet grass not the best - should have cleaned and repainted a few times apparently.

Last/current test sketch was three T_4.1's on QNEthernet UDP Chat. Running for days (4?) the same unit exited the CHAT again {500340]chat23> [Ethernet] Link OFF} while the first 2 keep going with some 623K messages recorded. Will have to ask Shawn about that - no light on the MagJack ... :( - saw some issue about that it seems ...
 
I have it uploading and downloading files consistently. Basically had to turn off MTP and all debugging. Was able to eliminate the delays as well which helps with the transfer speeds. I think the remote side was being overrun. Ran out of time to mess with it anymore tonight:( Hopefully some more tomorrow. @KurtE, is this transferring at 480 Mbs (thanks defragster) ?

Glad it all worked out. And thanks for turning everything off and testing. Didn't get around to that yesterday :). Even with everything turned off most files I transferred seemed to have not issue except for a few jpg's I tested. If I remember correctly we had a similar issue with MTP when we were do logging - we basically killed the loop when logging to the SD card.

Today probably will set up to retest with everything turned off. Then will have some fun with other examples :)
 
I have it uploading and downloading files consistently. Basically had to turn off MTP and all debugging. Was able to eliminate the delays as well which helps with the transfer speeds. I think the remote side was being overrun. Ran out of time to mess with it anymore tonight:( Hopefully some more tomorrow. @KurtE, is this transferring at 480 Mbs (thanks defragster) ?

Thanks for testing. As @mjs513 mentioned, in some other cases we did not call the MTP stuff during some critical things. Probably will remove it from the upload/download code, but still interested on why? I am assuming some timing thing, but might be good to understand what!

Yesterday I decided to rebase my core rawhid512pr branch to the current code. Then tried building with it and IntervalTimer would not compile! I was running with relesed TD as had no need for those new fangled calls ;)
So just updated back to beta build and it compiles now? I have not updated the boards.txt yet to add in the ability for 512. Will try that soon. That will get us up to the 480... Note the only real difference is how much data is in each packet. (64 bytes or 512) So about 8 times as fast for things.

lawn tractor mower deck broke - so learning to use the welder I got to put the lift bracket back on where rusted metal finally failed. Fun so far ... a couple days of distraction ... looking now not sure anything new would last 25 years so on the job learning to get back to yardwork. Putting it away with wet grass not the best - should have cleaned and repainted a few times apparently.
Know the feeling! 2 or was it 3 years ago I hit one (or was that 50) too many rocks with my 60" mow deck and snapped one of the wheels off of it... Did not want to go to dealer then, to drop it off and have them reweld and unbend... So had them drop off new 48" deck, which is good as I am hitting fewer big rocks. Keep meaning to get the other one fixed though, as when I mow the sides of our road, I extend out a bit farther.

Glad it all worked out. And thanks for turning everything off and testing. Didn't get around to that yesterday :). Even with everything turned off most files I transferred seemed to have not issue except for a few jpg's I tested. If I remember correctly we had a similar issue with MTP when we were do logging - we basically killed the loop when logging to the SD card.

Today probably will set up to retest with everything turned off. Then will have some fun with other examples :)
Me too, But I have some other non-Teensy stuff to attend to later this morning.
 
@KurtE - @wwatson - @defragster

Did some more testing with that one jpeg that showed issues with uploading and downloading with MTP enabled.

Found that if you just comment out the mtp_loop command in the upload/download functions transfers were successful and degradation of the image occurred even with debug still enabled. In this way you can still use MTP at least on the host.
 
Sounds good, I pushed up some changes, hopefully caught the ones you mentioned.

But in addition added support for rawhid512.

Updated the two sketches, plus readme.txt
And also as I mentioned in previous post, I updated my cores fork/branch:
https://github.com/KurtE/cores/tree/rawhid_512pr
Where I rebased off of current master branch.
So if you want to try it, you would need to be running on current beta TD do to the changes to IntervalTimer.

Plus either update boards.txt or create boards.local.txt file with stuff out of readme. Then if running 2.x, need to clear the ide's knowledge of what is cached.
The stuff in the first post of the thread: https://forum.pjrc.com/threads/53548-Arduino-CLI-And-IDE-now-Released-Teensy-Supported!
the 4) section...
 
Sounds good, I pushed up some changes, hopefully caught the ones you mentioned.

But in addition added support for rawhid512.

Updated the two sketches, plus readme.txt
And also as I mentioned in previous post, I updated my cores fork/branch:
https://github.com/KurtE/cores/tree/rawhid_512pr
Where I rebased off of current master branch.
So if you want to try it, you would need to be running on current beta TD do to the changes to IntervalTimer.

Plus either update boards.txt or create boards.local.txt file with stuff out of readme. Then if running 2.x, need to clear the ide's knowledge of what is cached.
The stuff in the first post of the thread: https://forum.pjrc.com/threads/53548-Arduino-CLI-And-IDE-now-Released-Teensy-Supported!
the 4) section...

Synched up the changes and used RawHid512 to xfer that problematic jpeg up and down. Both xfer's were successful and images displayed correctly - just from that limited test it looks like it works.
 
Synched up the changes and used RawHid512 to xfer that problematic jpeg up and down. Both xfer's were successful and images displayed correctly - just from that limited test it looks like it works.

I just finished syncing and testing as well. Tested with MTP and full debug then full debug then no debug. Transferred a WAV file back and forth. Still plays. Here is some download times:
Code:
CMD:3 Filename:t.wav
Downloading t.wav
..Sending t.wav
............................................................................ etc...
Remote Send File Completed
.
Completed, total byte: 16787550 elapsed millis: 4138
$$r 32MEGfile.dat

CMD:3 Filename:32MEGfile.dat
Downloading 32MEGfile.dat
..Sending 32MEGfile.dat
............................................................................. etc...
Remote Send File Completed
.
Completed, total byte: 32768000 elapsed millis: 8072

All seems to work great so far.
 
As a test I decided to see what would happen if I used a T4.0 as a sensor hub and then send the data via RAWHID. First I pulled out the old sensor board that we used for I2C testing using just the BNO080 and the onboard lidar and added a MPL311x pressure sensor via the QWIIC connector. Second I used the simple approach of putting the data into a structure and then sending it out via RAWHID to a TMM. Here is a quick photo of the setup.
IMG-0866.jpg

The sketch does not add any delays so it is sending data as fast as possible, in this case the major driver is the pressure sensor since I am using a oversampling rate corresponding to about 38ms. Yes I know i can do things to make it faster before you ask. Here is the sensor hub sketch:
Code:
//=============================================================================
// Globals used in transfers and the like. 
//=============================================================================
#define FILE_IO_SIZE 4096
#define FILE_BUFFER_SIZE (FILE_IO_SIZE * 8)

enum {CMD_NONE = -1, CMD_DATA=0, CMD_DIR=1, CMD_CD, CMD_DOWNLOAD, CMD_UPLOAD, CMD_LOCAL_DIR, CMD_LOCAL_CD,       CMD_RESPONSE, CMD_PROGRESS, CMD_RESET};

struct RawHID_packet_t{
  //put your variable definitions here for the data you want to send
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  long timestamp;
  uint8_t id;
  int16_t distance;    // packet data.
  float roll;
  float pitch;
  float yaw;
  float altitude;
  float pressure;
  float temperature;
};

//give a name to the group of data
RawHID_packet_t mypacket;

uint16_t rx_size = 64;  // later will change ... hopefully
byte buffer[512];
byte rxBuffer[512];

//setup to get LIDAR Data
#include <Wire.h>
#include <LIDARLite.h>

LIDARLite myLidarLite;

#include "SparkFun_BNO080_Arduino_Library.h"
BNO080 myIMU;

#include <Wire.h>
#include "MPL3115A2.h"

//Create an instance of the object
MPL3115A2 myPressure;

void setup(){
  while (!Serial && millis() < 5000) ; //wait up to 5 seconds

#ifdef __IMXRT1062__
  if (CrashReport) {
    Serial.print(CrashReport);
  }
 #endif

#ifdef USB_RAWHID512
rx_size = RawHID.rxSize();
#endif

  Serial.printf("\n\nUSB Host RawHid File Transfers Remote(slave) side\n");
  Serial.printf("Transfer size: %u\n", rx_size);
  
  // Set configuration to default and I2C to 400 kHz
  myLidarLite.begin(0, true); 
  Wire.setClock(400000);
  // Change this number to try out alternate configurations
  myLidarLite.configure(0); 
  
  Wire1.begin();
  Wire1.setClock(400000);
  while (myIMU.begin(0x4b, Wire1, 255) == false)
  {
    Serial.println(F("BNO080 not detected at default I2C address. Check your jumpers and the hookup guide. Freezing..."));
    delay(10);
  }
  
  myIMU.enableRotationVector(10); //Send data update every 50ms

  Serial.println(F("Rotation vector enabled"));
  Serial.println(F("Output in form roll, pitch, yaw"));
  
  myPressure.begin(); // Get sensor online

  //Configure the sensor
  //myPressure.setModeAltimeter(); // Measure altitude above sea level in meters
  myPressure.setModeBarometer(); // Measure pressure in Pascals from 20 to 110 kPa
  myPressure.setOversampleRate(4); // Set Oversample to the recommended 128
  myPressure.enableEventFlags(); // Enable all three pressure and temp event flags 

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWriteFast(LED_BUILTIN, LOW);
  
}

void loop(){
  //digitalToggle(LED_BUILTIN);
  
  float roll, pitch, yaw;
  
  // Take a measurement with receiver bias correction and print to serial terminal (remove false
  //mypacket.distance = myLidarLite.distance(true));
  //memcpy(buffer, &mydata, sizeof(mydata));
  //RawHID.send(buffer, 1000);
  
  // Take 99 measurements without receiver bias correction and print to serial terminal
  //for(int i = 0; i < 99; i++)
  //{
  mypacket.distance = myLidarLite.distance(false);  

  
  //Look for reports from the IMU
  if (myIMU.dataAvailable() == true)
  {
    roll = (myIMU.getRoll()) * 180.0 / PI; // Convert roll to degrees
    pitch = (myIMU.getPitch()) * 180.0 / PI; // Convert pitch to degrees
    yaw = (myIMU.getYaw()) * 180.0 / PI; // Convert yaw / heading to degrees

    mypacket.roll = roll;
    mypacket.pitch = pitch;
    mypacket.yaw = yaw;
  }
  
  //mypacket.altitude = myPressure.readAltitudeFt();
  mypacket.altitude = 0;
  mypacket.pressure = myPressure.readPressure();
  mypacket.temperature = myPressure.readTempF();

  mypacket.timestamp = millis();
  mypacket.id = 1;
  memcpy(buffer, &mypacket, sizeof(mypacket));
  RawHID.send(buffer, 1000);
  //Serial.printf("%d, %d, %f, %f, %f, %f, %f, %f\n", millis(), mypacket.distance, mypacket.roll, mypacket.pitch, 
  //              mypacket.yaw, mypacket.altitude, mypacket.pressure/100.0f, mypacket.temperature);

  //delay(25);
}
on the host side:
Code:
#include "USBHost_t36.h"

// uncomment the line below to output debug information
//#define DEBUG_OUTPUT

// Uncomment the line below to print out information about the USB devices that attach.
#define PRINT_DEVICE_INFO

//=============================================================================
// optional debug stuff
//=============================================================================
#ifdef DEBUG_OUTPUT
#define DBGPrintf Serial.printf
#else
// not debug have it do nothing
inline void DBGPrintf(...) {
}
#endif

//=============================================================================
// USB Objects
//=============================================================================
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
USBHIDParser hid1(myusb);
USBHIDParser hid2(myusb);

DMAMEM uint8_t rawhid_big_buffer[8 * 512] __attribute__((aligned(32)));
RawHIDController rawhid1(myusb, 0, rawhid_big_buffer, sizeof(rawhid_big_buffer));
USBSerialEmu seremu(myusb);


#ifdef PRINT_DEVICE_INFO
USBDriver *drivers[] = { &hub1, &hub2, &hid1, &hid2 };
#define CNT_DEVICES (sizeof(drivers) / sizeof(drivers[0]))
const char *driver_names[CNT_DEVICES] = { "Hub1", "Hub2", "HID1", "HID2" };
bool driver_active[CNT_DEVICES] = { false, false, false, false };

// Lets also look at HID Input devices
USBHIDInput *hiddrivers[] = { &rawhid1, &seremu };
#define CNT_HIDDEVICES (sizeof(hiddrivers) / sizeof(hiddrivers[0]))
const char *hid_driver_names[CNT_DEVICES] = { "RawHid1", "SerEmu" };
bool hid_driver_active[CNT_DEVICES] = { false, false };
#endif

//=============================================================================
// forward references
//=============================================================================
extern bool OnReceiveHIDData(uint32_t usage, const uint8_t *data, uint32_t len);



struct RX_DATA_STRUCTURE {
  //put your variable definitions here for the data you want to send
  //THIS MUST BE EXACTLY THE SAME ON THE OTHER ARDUINO
  long timestamp;
  uint8_t id;
  int16_t distance;    // packet data.
  float roll;
  float pitch;
  float yaw;
  float altitude;
  float pressure;
  float temperature;
};

byte buffer[512];
byte rxBuffer[512];

//give a name to the group of data
RX_DATA_STRUCTURE mydata;

void setup() {
  while (!Serial && millis() < 5000) ; //wait up to 5 seconds

#ifdef __IMXRT1062__
  if (CrashReport) {
    Serial.print(CrashReport);
  }
#endif


  Serial.printf("\n\nUSB Host RawHid File Transfers Host(master) side\n");

  myusb.begin();

  rawhid1.attachReceive(OnReceiveHIDData);

  // check if any data has arrived on the USBHost serial port
  forward_remote_serial();

  // Optional.
  UpdateActiveDeviceInfo();

  pinMode(LED_BUILTIN, OUTPUT);
  digitalWriteFast(LED_BUILTIN, LOW);
}

void loop() {

}


//=============================================================================
// OnReceiveHIDData - called when we receive RawHID packet from the USBHost object
//=============================================================================
bool OnReceiveHIDData(uint32_t usage, const uint8_t *data, uint32_t len) {
  DBGPrintf("OnReceiveHidDta(%x %p %u)\n", usage, data, len);

  memcpy(&mydata, data, sizeof(mydata));
  Serial.printf("%d, %d, %d, %f, %f, %f, %f, %f, %f\n", mydata.id, mydata.timestamp,
                mydata.distance, mydata.roll, mydata.pitch, 
                mydata.yaw, mydata.altitude, mydata.pressure, mydata.temperature);


  return true;
}


//=============================================================================
//=============================================================================
void forward_remote_serial() {
  uint16_t rd, wr, n;
  uint8_t emu_buffer[512];

  // check if any data has arrived on the USBHost serial port
  rd = seremu.available();
  if (rd > 0) {
    // check if the USB virtual serial port is ready to transmit
    wr = Serial.availableForWrite();
    if (wr > 0) {
      // compute how much data to move, the smallest
      // of rd, wr and the buffer size
      if (rd > wr) rd = wr;
      if (rd > sizeof(emu_buffer)) rd = sizeof(emu_buffer);
      // read data from the USB host serial port
      n = seremu.readBytes((char *)emu_buffer, rd);
      // write it to the USB port
      //DBGPrintf("U-S(%u %u):", rd, n);
      Serial.write(emu_buffer, n);
    }
  }
}



//=============================================================================
// updateActiveDeviceInfo
//=============================================================================
// check to see if the device list has changed:
void UpdateActiveDeviceInfo() {
#ifdef PRINT_DEVICE_INFO
  for (uint8_t i = 0; i < CNT_DEVICES; i++) {
    if (*drivers[i] != driver_active[i]) {
      if (driver_active[i]) {
        Serial.printf("*** Device %s - disconnected ***\n", driver_names[i]);
        driver_active[i] = false;
      } else {
        Serial.printf("*** Device %s %x:%x - connected ***\n", driver_names[i], drivers[i]->idVendor(), drivers[i]->idProduct());
        driver_active[i] = true;

        const uint8_t *psz = drivers[i]->manufacturer();
        if (psz && *psz) Serial.printf("  manufacturer: %s\n", psz);
        psz = drivers[i]->product();
        if (psz && *psz) Serial.printf("  product: %s\n", psz);
        psz = drivers[i]->serialNumber();
        if (psz && *psz) Serial.printf("  Serial: %s\n", psz);

        // Note: with some keyboards there is an issue that they don't output in boot protocol mode
        // and may not work.  The above code can try to force the keyboard into boot mode, but there
        // are issues with doing this blindly with combo devices like wireless keyboard/mouse, which
        // may cause the mouse to not work.  Note: the above id is in the builtin list of
        // vendor IDs that are already forced
      }
    }
  }

  for (uint8_t i = 0; i < CNT_HIDDEVICES; i++) {
    if (*hiddrivers[i] != hid_driver_active[i]) {
      if (hid_driver_active[i]) {
        Serial.printf("*** HID Device %s - disconnected ***\n", hid_driver_names[i]);
        hid_driver_active[i] = false;
      } else {
        Serial.printf("*** HID Device %s %x:%x - connected ***\n", hid_driver_names[i], hiddrivers[i]->idVendor(), hiddrivers[i]->idProduct());
        hid_driver_active[i] = true;

        const uint8_t *psz = hiddrivers[i]->manufacturer();
        if (psz && *psz) Serial.printf("  manufacturer: %s\n", psz);
        psz = hiddrivers[i]->product();
        if (psz && *psz) Serial.printf("  product: %s\n", psz);
        psz = hiddrivers[i]->serialNumber();
        if (psz && *psz) Serial.printf("  Serial: %s\n", psz);
        //if (hiddrivers[i] == &seremu) {
        //  Serial.printf("   RX Size:%u TX Size:%u\n", seremu.rxSize(), seremu.txSize());
        //}
        //if (hiddrivers[i] == &rawhid1) {
        //  rx_size = rawhid1.rxSize();
        //  Serial.printf("   RX Size:%u TX Size:%u\n", rx_size, rawhid1.txSize());
        //}
      }
    }
  }
#else
  // we still want to find out if rawhid1 connected and if so what size is it.
  static bool last_rawhid1 = false;
  if (rawhid1 && !last_rawhid1) {
    rx_size = rawhid1.rxSize();
    DBGPrintf("rawhid1 connected rx:%u tx:%u\n", rx_size, rawhid1.txSize());
  }
  last_rawhid1 = rawhid1;

#endif
}

Just with this quick test seems to be keeping up with the xfer's with no issue:
Code:
type, timestamp (miilis), roll, pitch, yaw, altitude, pressure(pa), temperature
1, 6439, 177, -1.895981, -0.504256, -66.783936, 0.000000, 101258.250000, 77.562500
1, 6492, 178, -1.905749, -0.502355, -66.787788, 0.000000, 101258.000000, 77.562500
1, 6544, 178, -1.901901, -0.508194, -66.787704, 0.000000, 101256.500000, 77.562500
1, 6597, 175, -1.901901, -0.508194, -66.787704, 0.000000, 101266.500000, 77.675003
1, 6650, 175, -1.901901, -0.508194, -66.787704, 0.000000, 101263.500000, 77.562500
1, 6703, 175, -1.902129, -0.507186, -66.727585, 0.000000, 101253.250000, 77.449997
1, 6755, 175, -1.896288, -0.503341, -66.727676, 0.000000, 101265.250000, 77.562500
1, 6808, 175, -1.896288, -0.503341, -66.727676, 0.000000, 101264.500000, 77.562500

if I don't use the pressure sensor:
Code:
1, 14234, 173, -1.875804, -0.643529, -66.038666, 0.000000, 0.000000, 0.000000
1, 14239, 175, -1.875899, -0.643454, -66.032799, 0.000000, 0.000000, 0.000000
1, 14243, 175, -1.875899, -0.643454, -66.032799, 0.000000, 0.000000, 0.000000
1, 14248, 175, -1.875899, -0.643454, -66.032799, 0.000000, 0.000000, 0.000000
1, 14253, 176, -1.875899, -0.643454, -66.032799, 0.000000, 0.000000, 0.000000

1st case about 50ms between packets, second case about 5ms.

@KurtE Definitely think it should be incorporated into the core.
 
@mjs513 - This is impressive:) I'm going to redo my USBMonitor library using RawHID instead of SerialTransfer over USBSerial. I have it working with the RA8876 display but cannot get return handshaking values fast enough. Round trip values took 3ms to 4ms which was not fast enough to avoid overrunning the RA8876.
 
@mjs513 - This is impressive:) I'm going to redo my USBMonitor library using RawHID instead of SerialTransfer over USBSerial. I have it working with the RA8876 display but cannot get return handshaking values fast enough. Round trip values took 3ms to 4ms which was not fast enough to avoid overrunning the RA8876.

Did a bit more work on the 2 sketches - wanted to see about requesting a data set and receiving just that data or if I wanted all of it so I created a menu on the host side:
Code:
Command list
	I - Get IMU Data
	L - Get LIDAR Data
	P - Get Press/Temp Data
	A - Get All sensor Data
	S - Stop getting data

So for example requesting just IMU data:
Code:
0, 32701, -0.647013, -0.947008, -69.142097
10, 32711, -0.651051, -0.941249, -69.136345
10, 32721, -0.651051, -0.941249, -69.136345
$$S$$
Command list
...
or if I request all:
Code:
10, 97443, -0.646007, -1.047586, -69.085350
30, 97447, 177.000000
30, 97451, 176.000000
30, 97455, 177.000000
10, 97456, -0.645932, -1.047582, -69.091110
30, 97460, 176.000000
$$S$$
Basically just recycled alot of @KurtE's data file transfer test sketches, so made life alot easier. Did this for future use in robotics projects.
 
Did a bit more work on the 2 sketches ...
Basically just recycled alot of @KurtE's data file transfer test sketches, so made life alot easier. Did this for future use in robotics projects.

Just thinking how nice a pair of T_4.1's doing this would have made the OLD NAV stuff with @brtaylor fly :) Faster updates on the position and data transfer to second T_4.1 over USB Host would have made the cool @tonton81 SPI_Transfer look slow with this. ... and a T_3.5 was in use on your end.
 
Just thinking how nice a pair of T_4.1's doing this would have made the OLD NAV stuff with @brtaylor fly :) Faster updates on the position and data transfer to second T_4.1 over USB Host would have made the cool @tonton81 SPI_Transfer look slow with this. ... and a T_3.5 was in use on your end.

Thought had crossed my mind when I was working on it. Seems that stuff that we did is always in the back of my mind when I work with the IMU's
 
Sorry, been sort of goofing off with this stuff. Playing around with Visual Studio c++ builds and have a app run on pc that sends files back and forth. Boy am I rusty with this, like what is the best set of APIS on the pc to open a file and read/write...

Hopefully we will be able to get the couple of pull requests pulled in, maybe for next beta:
USBHost: https://github.com/PaulStoffregen/USBHost_t36/pull/119
Cores: https://github.com/PaulStoffregen/cores/pull/629

The USBHost PR also fixed some serial and Seremu stuff.

boards.txt (or boards.local.txt) Either add the lines mentioned earlier or we can document them.

Would also be good to update the documentation on the website. Things like maybe move/rework the rawhid page, which is currently under: https://www.pjrc.com/teensy/rawhid.html
Currently this one shows up under code library and not under Teensyduino.
 
Back
Top