Forum Rule: Always post complete source code & details to reproduce any issue!
Page 8 of 13 FirstFirst ... 6 7 8 9 10 ... LastLast
Results 176 to 200 of 305

Thread: USBHost_t36 USB Mass Storage Driver Experiments

  1. #176
    Have problem I have been working on all weekend with no solution yet. I know you guys are really busy right now but I thought it might be good to bring it to light.
    I am chasing down these intermittent lockups with MSC , T36 and various USB drives.

    My problem is setting the buffer size for different Usb drives. It never is the same for all drives.

    I am using all of the recent Arduino and TD software along with logger_RaWrite.ino.
    Here is what I am seeing:
    Code:
    //Copyright 2019 by Walter Zimmer
    // Version 07-may-19
    //
    #include "uSDFS.h"
    
    #define TEST_DRV 2
    //
    #define MXFN 1 // maximal number of files //was 100
    #define MXRC 2 // number of records in file // was 1000
    char *fnamePrefix = "A";
    
    //
    #if TEST_DRV == 0
      const char *Dev = "0:/";  // SPI
    #elif TEST_DRV == 1
      const char *Dev = "1:/";  // SDHC
    #elif TEST_DRV == 2
      const char *Dev = "2:/";  // USB
    #endif
    
    FRESULT rc;        /* Result code */
    FATFS fatfs;      /* File system object */
    FIL fil;        /* File object */
    
    #if defined(__MK20DX256__)
      #define BUFFSIZE (2*1024) // size of buffer to be written
    #elif defined(__MK66FX1M0__)
     #define BUFFSIZE (16384) // size of buffer to be written 
    #elif defined(__IMXRT1062__)
      #define BUFFSIZE (8*1024) // size of buffer to be written
    #endif
    
    uint32_t buffer[BUFFSIZE];
    UINT wr;
    
    /* Stop with error message */
    void die(const char *text, FRESULT rc)
    { Serial.printf("%s: Failed with rc=%s.\r\n", text,FR_ERROR_STRING[rc]);  while(1) asm("wfi"); }
    
    //=========================================================================
    void blink(uint16_t msec)
    {
      digitalWriteFast(13,!digitalReadFast(13)); delay(msec);
    }
    
    void setup()
    {
      // wait for serial line to come up
      pinMode(13,OUTPUT);
      pinMode(13,HIGH);
    
      while(!Serial);
      Serial.println("Test logger_RawWrite");
      Serial.print("uSDFS_VER:"); Serial.println(uSDFS_VER);
      Serial.print("BUFFSIZE :");  Serial.println(BUFFSIZE);
      Serial.print("Dev Type :");  Serial.println(Dev);
      if((rc = f_mount (&fatfs, Dev, 1))) die("Mount",rc);      /* Mount/Unmount a logical drive */
    
      Serial.printf("File System %s\n", fileSystem[fatfs.fs_type]);
      Serial.printf("Free Disk Size %d clusters\n",fatfs.free_clst);
      Serial.printf("Cluster Size %d sectors\n",fatfs.csize);
    #if FF_MAX_SS != FF_MIN_SS
      Serial.printf("Sector Size %d bytes\n",fatfs.ssize);
    #else
      Serial.printf("Sector Size %d bytes\n",FF_MIN_SS);
    #endif
      //-----------------------------------------------------------
      Serial.printf("\nChange drive\n");
      if((rc = f_chdrive(Dev))) die("chdrive",rc);
    }
    
    void loop()
    {
    	static uint32_t count=0;
    	static uint32_t ifn=0;
    	static uint32_t isFileOpen=0;
    	static char filename[80];
    	static uint32_t t0=0;
    	static uint32_t t1=0;
      static uint32_t dtwmin=1<<31, dtwmax=0;
      static uint32_t dto=1<<31, dtc=0;
    
      if(ifn>MXFN) { blink(500); return; }
      
      // stop testing (finish actual file)
      while (Serial.available() > 0) 
      { if ('q' == Serial.read() ) ifn = MXFN+1; }
      
      if(!count)
      {
        // close file
        if(isFileOpen)
        { dtc = micros();
          //close file
          if (rc = f_close(&fil)) die("close", rc);
          //
          isFileOpen=0;
          t1=micros();
          dtc = t1-dtc;
          float MBs = (MXRC*BUFFSIZE*4.0f)/(1.0f*(t1-t0));
          Serial.printf(" (%d - %f MB/s)\n (open: %d us; close: %d us; write: min,max: %d %d us)\n\r",
                            t1-t0,MBs, dto, dtc, dtwmin,dtwmax);
          dtwmin=1<<31; dtwmax=0;
        }
      }
        
      //
      if(!isFileOpen)
      {
        // open new file
        ifn++;
        if(ifn>MXFN) 
        { rc = f_unmount(Dev);
          Serial.print("unmount "); Serial.println(FR_ERROR_STRING[rc]);
          pinMode(13,OUTPUT); return; 
        } // at end of test: prepare for blinking
    
        dto=micros();
        sprintf(filename,"%s_%05d.dat",fnamePrefix,ifn);
        Serial.println(filename);
        //
        // check status of file
        rc = f_stat(filename,0);
        Serial.printf("stat %s %x\n",FR_ERROR_STRING[rc],fil.obj.sclust);
        
        rc = f_open(&fil, filename, FA_WRITE | FA_CREATE_ALWAYS);
        Serial.printf(" opened %s %x\n\r",FR_ERROR_STRING[rc],fil.obj.sclust);
        // check if file is Good
        if(rc == FR_INT_ERR)
        { // only option is to close file
            rc = f_close(&fil);
            if(rc == FR_INVALID_OBJECT)
            { Serial.println("unlinking file");
              rc = f_unlink(filename);
              if (rc) die("unlink", rc);
            }
            else
              die("close", rc);
          // retry open file
          if(rc = f_open(&fil, filename, FA_WRITE | FA_CREATE_ALWAYS)) die("open", rc);
        }
        //
        isFileOpen=1;
        t0=micros();
        dto=t0-dto;
      }
      
      if(isFileOpen)
      {
         // fill buffer
         for(int ii=0;ii<BUFFSIZE;ii++) buffer[ii]='0'+(count%10);
         count++;
         //write data to file 
         if(!(count%10))Serial.printf(".");
         if(!(count%640)) Serial.println(); Serial.flush();
         //
         uint32_t ta=micros();
         rc = f_write(&fil, buffer, BUFFSIZE, &wr);
         uint32_t tb=micros();
         if (rc == FR_DISK_ERR) // IO error
         {  Serial.printf(" write FR_DISK_ERR at count # %d\n",count);
            // only option is to close file
            // force closing file
            count=MXRC;
         }
         else if(rc) die("write",rc);
        //    
         uint32_t dt=tb-ta;
         if(dt<dtwmin) dtwmin=dt;
         if(dt>dtwmax) dtwmax=dt;
         //
         count %= MXRC;
      }    
    }
    This creates this response:
    Code:
    Test logger_RawWrite
    uSDFS_VER:15_MAY_19_08_16
    BUFFSIZE :16384
    Dev Type :2:/
    sizeof Device = 36
    sizeof Pipe = 96
    sizeof Transfer = 64
    power up USBHS PHY
     reset waited 5
    USBHS_ASYNCLISTADDR = 0
    USBHS_PERIODICLISTBASE = 20004000
    periodictable = 20004000
    port change: 10001803
        connect
      begin reset
    port change: 18001205
      port enabled
      end recovery
    new_Device: 480 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
      12 01 10 02 00 00 00 40 51 09 66 16 01 00 01 02 03 01 
        VendorID = 0951, ProductID = 1666, Version = 0001
        Class/Subclass/Protocol = 0 / 0 / 0
        Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: Kingston
    enumeration:
    Product: DataTraveler 3.0
    enumeration:
    Serial Number: 00E04C819241F2C188BE0F0D
    enumeration:
    Config data length = 32
    enumeration:
    Configuration Descriptor:
      09 02 20 00 01 01 00 80 96 
        NumInterfaces = 1
        ConfigurationValue = 1
      09 04 00 00 02 08 06 50 00 
        Interface = 0
        Number of endpoints = 2
        Class/Subclass/Protocol = 8(Mass Storage) / 6(SCSI) / 80(Bulk Only)
      07 05 81 02 00 02 FF 
        Endpoint = 1 IN
        Type = Bulk
        Max Size = 512
        Polling Interval = 255
      07 05 02 02 00 02 FF 
        Endpoint = 2 OUT
        Type = Bulk
        Max Size = 512
        Polling Interval = 255
    enumeration:
    msController claim this=200029C0
    msController claim this=20002D40
    msController claim this=200030C0
    Descriptor 4 = INTERFACE
    msController claim this=200029C0
    09 04 00 00 02 08 06 50 00 07 05 81 02 00 02 FF 07 05 02 02 00 02 FF 
    numendpoint=2
    endpointIn=81
    endpointOut=2
    packet size in (msController) = 512
    packet size out (msController) = 512
    polling intervalIn = 255
    polling intervalOut = 255
    new_Pipe
    new_Pipe
    Descriptor 5 = ENDPOINT
    Descriptor 5 = ENDPOINT
    control CallbackIn (msController)
    00 00 00 00 00 00 00 00 
    ## mscInit before msgGetMaxLun: 1
    control CallbackIn (msController)
    00 00 00 00 00 00 00 00 
    ## mscInit after msgGetMaxLun: 0
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 01 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 01 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 02 00 00 00 24 00 00 00 80 00 06 12 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 36
    00 80 06 02 F8 00 00 00 4B 69 6E 67 73 74 6F 6E 44 61 74 61 54 72 61 76 65 6C 65 72 20 33 2E 30 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 02 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 03 00 00 00 08 00 00 00 80 00 0A 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 8
    03 9A 33 F3 00 00 02 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 03 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 04 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    FA B8 00 10 8E D0 BC 00 B0 B8 00 00 8E D8 8E C0 FB BE 00 7C BF 00 06 B9 00 02 F3 A4 EA 21 06 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 04 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 05 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 00 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    EB 58 90 6D 6B 66 73 2E 66 61 74 00 02 20 20 00 02 00 00 00 00 F8 00 00 20 00 40 00 00 08 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 05 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 06 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 01 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    52 52 61 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 06 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    File System FS_FAT32
    Free Disk Size 1867135 clusters
    Cluster Size 32 sectors
    Sector Size 512 bytes
    
    Change drive
    A_00001.dat
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 07 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 07 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    stat FR_OK 0
     opened FR_OK 0
    
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 08 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 08 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 09 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 09 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0A 00 00 00 00 40 00 00 00 00 0A 2A 00 00 0B 12 B8 00 00 20 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 1
    msController dataOut (static)31
    55 53 42 43 0A 00 00 00 00 40 00 00 00 00 0A 2A 00 00 0B 12 B8 00 00 20 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0A 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0B 00 00 00 00 40 00 00 00 00 0A 2A 00 00 0B 12 D8 00 00 20 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0B 00 00 00 00 40 00 00 00 00 0A 2A 00 00 0B 12 D8 00 00 20 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 1
    msController dataOut (static)16384  --------> Point of lockup
    31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00
    Now if I change:
    Code:
    #elif defined(__MK66FX1M0__)
     #define BUFFSIZE (16384) // size of buffer to be written 
    #elif defined(__IMXRT1062__)
      #define BUFFSIZE (8*1024) // size of buffer to be written
    #endif
    To:
    Code:
    #elif defined(__MK66FX1M0__)
     #define BUFFSIZE (16383) // size of buffer to be written 
    #elif defined(__IMXRT1062__)
      #define BUFFSIZE (8*1024) // size of buffer to be written
    #endif
    Or change this in ehci.cpp:
    Code:
    // Create a Bulk or Interrupt Transfer and queue it
    //
    bool USBHost::queue_Data_Transfer(Pipe_t *pipe, void *buffer, uint32_t len, USBDriver *driver)
    {
    	Transfer_t *transfer, *data, *next;
    	uint8_t *p = (uint8_t *)buffer;
    	uint32_t count;
    	bool last = false;
    
    	// TODO: option for zero length packet?  Maybe in Pipe_t fields?
    
    	//println("new_Data_Transfer");
    	// allocate qTDs
    	transfer = allocate_Transfer();
    	if (!transfer) return false;
    	data = transfer;
    	for (count=(len >> 14); count; count--) {
    		next = allocate_Transfer();
    		if (!next) {
    			// free already-allocated qTDs
    			while (1) {
    				next = (Transfer_t *)transfer->qtd.next;
    				free_Transfer(transfer);
    				if (transfer == data) break;
    				transfer = next;
    			}
    			return false;
    		}
    		data->qtd.next = (uint32_t)next;
    		data = next;
    	}
    	// last qTD needs info for followup
    	data->qtd.next = 1;
    	data->pipe = pipe;
    	data->buffer = buffer;
    	data->length = len;
    	data->setup.word1 = 0;
    	data->setup.word2 = 0;
    	data->driver = driver;
    	// initialize all qTDs
    	data = transfer;
    	while (1) {
    		uint32_t count = len;
    		if (count > 16384) {
    			count = 16384;
    		} else {
    			last = true;
    		}
    		init_qTD(data, p, count, pipe->direction, 0, last);
    		if (last) break;
    		p += count;
    		len -= count;
    		data = (Transfer_t *)(data->qtd.next);
    	}
    	return queue_Transfer(pipe, transfer);
    }
    To:
    Code:
    		if (count >= 16384) {
    I get this:
    Code:
    Test logger_RawWrite
    uSDFS_VER:15_MAY_19_08_16
    BUFFSIZE :16384
    Dev Type :2:/
    sizeof Device = 36
    sizeof Pipe = 96
    sizeof Transfer = 64
    power up USBHS PHY
     reset waited 5
    USBHS_ASYNCLISTADDR = 0
    USBHS_PERIODICLISTBASE = 20004000
    periodictable = 20004000
    port change: 10001803
        connect
      begin reset
    port change: 18001205
      port enabled
      end recovery
    new_Device: 480 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
      12 01 10 02 00 00 00 40 51 09 66 16 01 00 01 02 03 01 
        VendorID = 0951, ProductID = 1666, Version = 0001
        Class/Subclass/Protocol = 0 / 0 / 0
        Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: Kingston
    enumeration:
    Product: DataTraveler 3.0
    enumeration:
    Serial Number: 00E04C819241F2C188BE0F0D
    enumeration:
    Config data length = 32
    enumeration:
    Configuration Descriptor:
      09 02 20 00 01 01 00 80 96 
        NumInterfaces = 1
        ConfigurationValue = 1
      09 04 00 00 02 08 06 50 00 
        Interface = 0
        Number of endpoints = 2
        Class/Subclass/Protocol = 8(Mass Storage) / 6(SCSI) / 80(Bulk Only)
      07 05 81 02 00 02 FF 
        Endpoint = 1 IN
        Type = Bulk
        Max Size = 512
        Polling Interval = 255
      07 05 02 02 00 02 FF 
        Endpoint = 2 OUT
        Type = Bulk
        Max Size = 512
        Polling Interval = 255
    enumeration:
    msController claim this=200029C0
    msController claim this=20002D40
    msController claim this=200030C0
    Descriptor 4 = INTERFACE
    msController claim this=200029C0
    09 04 00 00 02 08 06 50 00 07 05 81 02 00 02 FF 07 05 02 02 00 02 FF 
    numendpoint=2
    endpointIn=81
    endpointOut=2
    packet size in (msController) = 512
    packet size out (msController) = 512
    polling intervalIn = 255
    polling intervalOut = 255
    new_Pipe
    new_Pipe
    Descriptor 5 = ENDPOINT
    Descriptor 5 = ENDPOINT
    control CallbackIn (msController)
    00 00 00 00 00 00 00 00 
    ## mscInit before msgGetMaxLun: 1
    control CallbackIn (msController)
    00 00 00 00 00 00 00 00 
    ## mscInit after msgGetMaxLun: 0
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 01 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 01 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 02 00 00 00 24 00 00 00 80 00 06 12 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 36
    00 80 06 02 F8 00 00 00 4B 69 6E 67 73 74 6F 6E 44 61 74 61 54 72 61 76 65 6C 65 72 20 33 2E 30 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 02 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 03 00 00 00 08 00 00 00 80 00 0A 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 8
    03 9A 33 F3 00 00 02 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 03 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 04 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    FA B8 00 10 8E D0 BC 00 B0 B8 00 00 8E D8 8E C0 FB BE 00 7C BF 00 06 B9 00 02 F3 A4 EA 21 06 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 04 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 05 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 00 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    EB 58 90 6D 6B 66 73 2E 66 61 74 00 02 20 20 00 02 00 00 00 00 F8 00 00 20 00 40 00 00 08 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 05 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 06 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 01 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    52 52 61 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 06 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    File System FS_FAT32
    Free Disk Size 1867131 clusters
    Cluster Size 32 sectors
    Sector Size 512 bytes
    
    Change drive
    A_00001.dat
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 07 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 07 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    stat FR_OK 0
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 08 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 08 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 09 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 09 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0A 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0A 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0B 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 42 65 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0B 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0C 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0C 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
     opened FR_OK 0
    
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0D 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0D 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0E 00 00 00 00 40 00 00 00 00 0A 2A 00 00 0B 12 F8 00 00 20 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 1
    msController dataOut (static)16384
    30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0E 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0F 00 00 00 00 40 00 00 00 00 0A 2A 00 00 0B 13 18 00 00 20 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 1
    msController dataOut (static)16384
    31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0F 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 10 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 10 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 11 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 42 65 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 11 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 12 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 12 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 13 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 13 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 14 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 08 01 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    52 52 61 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 14 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
     (61982 - 2.114678 MB/s)
     (open: 26970 us; close: 39998 us; write: min,max: 3653 17635 us)
    
    unmount FR_OK
    Test logger_RawWrite
    uSDFS_VER:15_MAY_19_08_16
    BUFFSIZE :16384
    Dev Type :2:/
    sizeof Device = 36
    sizeof Pipe = 96
    sizeof Transfer = 64
    power up USBHS PHY
     reset waited 5
    USBHS_ASYNCLISTADDR = 0
    USBHS_PERIODICLISTBASE = 20004000
    periodictable = 20004000
    port change: 10001803
        connect
      begin reset
    port change: 18001205
      port enabled
      end recovery
    new_Device: 480 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
      12 01 10 02 00 00 00 40 51 09 66 16 01 00 01 02 03 01 
        VendorID = 0951, ProductID = 1666, Version = 0001
        Class/Subclass/Protocol = 0 / 0 / 0
        Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: Kingston
    enumeration:
    Product: DataTraveler 3.0
    enumeration:
    Serial Number: 00E04C819241F2C188BE0F0D
    enumeration:
    Config data length = 32
    enumeration:
    Configuration Descriptor:
      09 02 20 00 01 01 00 80 96 
        NumInterfaces = 1
        ConfigurationValue = 1
      09 04 00 00 02 08 06 50 00 
        Interface = 0
        Number of endpoints = 2
        Class/Subclass/Protocol = 8(Mass Storage) / 6(SCSI) / 80(Bulk Only)
      07 05 81 02 00 02 FF 
        Endpoint = 1 IN
        Type = Bulk
        Max Size = 512
        Polling Interval = 255
      07 05 02 02 00 02 FF 
        Endpoint = 2 OUT
        Type = Bulk
        Max Size = 512
        Polling Interval = 255
    enumeration:
    msController claim this=200029C0
    msController claim this=20002D40
    msController claim this=200030C0
    Descriptor 4 = INTERFACE
    msController claim this=200029C0
    09 04 00 00 02 08 06 50 00 07 05 81 02 00 02 FF 07 05 02 02 00 02 FF 
    numendpoint=2
    endpointIn=81
    endpointOut=2
    packet size in (msController) = 512
    packet size out (msController) = 512
    polling intervalIn = 255
    polling intervalOut = 255
    new_Pipe
    new_Pipe
    Descriptor 5 = ENDPOINT
    Descriptor 5 = ENDPOINT
    control CallbackIn (msController)
    00 00 00 00 00 00 00 00 
    ## mscInit before msgGetMaxLun: 1
    control CallbackIn (msController)
    00 00 00 00 00 00 00 00 
    ## mscInit after msgGetMaxLun: 0
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 01 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 01 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 02 00 00 00 24 00 00 00 80 00 06 12 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 36
    00 80 06 02 F8 00 00 00 4B 69 6E 67 73 74 6F 6E 44 61 74 61 54 72 61 76 65 6C 65 72 20 33 2E 30 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 02 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 03 00 00 00 08 00 00 00 80 00 0A 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 8
    03 9A 33 F3 00 00 02 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 03 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 04 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    FA B8 00 10 8E D0 BC 00 B0 B8 00 00 8E D8 8E C0 FB BE 00 7C BF 00 06 B9 00 02 F3 A4 EA 21 06 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 04 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 05 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 00 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    EB 58 90 6D 6B 66 73 2E 66 61 74 00 02 20 20 00 02 00 00 00 00 F8 00 00 20 00 40 00 00 08 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 05 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 06 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 01 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    52 52 61 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 06 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    File System FS_FAT32
    Free Disk Size 1867131 clusters
    Cluster Size 32 sectors
    Sector Size 512 bytes
    
    Change drive
    A_00001.dat
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 07 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 07 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    stat FR_OK 0
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 08 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 08 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 09 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 09 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0A 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0A 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0B 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 42 65 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0B 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0C 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0C 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
     opened FR_OK 0
    
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0D 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0D 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0E 00 00 00 00 40 00 00 00 00 0A 2A 00 00 0B 12 F8 00 00 20 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 1
    msController dataOut (static)16384
    30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 30 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0E 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 0F 00 00 00 00 40 00 00 00 00 0A 2A 00 00 0B 13 18 00 00 20 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 1
    msController dataOut (static)16384
    31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 31 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 0F 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 10 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 08 C9 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 10 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 11 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 42 65 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 11 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 12 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 12 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 13 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 7B 58 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    54 45 45 4E 53 59 46 4C 41 53 48 08 00 00 E6 6B B3 4E B3 4E 00 00 E6 6B B3 4E 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 13 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 14 00 00 00 00 02 00 00 00 00 0A 2A 00 00 00 08 01 00 00 01 00 00 00 00 00 00 00 
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)512
    52 52 61 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 14 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
     (61982 - 2.114678 MB/s)
     (open: 26970 us; close: 39998 us; write: min,max: 3653 17635 us)
    
    unmount FR_OK ------> Completed successfuly.
    Same results with a multiple of 16384 up to 32768 on some drives.

    Sorry, I know this is long post.

    I am seeing the same results on my other T36 system with slightly older uSDFS software (before WXMZ's upgrade).
    It seems to be something with the modulus of 16384, not really sure.
    I just know there is a problem here that I can't figure out at this time.
    Last edited by wwatson; 05-20-2019 at 01:01 AM. Reason: Update: Incomplete editing

  2. #177
    Senior Member
    Join Date
    Dec 2016
    Location
    Montreal, Canada
    Posts
    3,021
    Code:
    if (count >= 16384) {
    count = 16384; <--
    , shouldnt you make it 16383 also? i wouldnt know if it helps though

  3. #178
    @tonton81
    That's the problem. I am trying to figure out what the problem is.
    I have tried changing
    Code:
    count = 16384;
    To:
    Code:
    count = 16383;
    That an just created a Followup Error.
    Chalking it up to my lack of understanding what is needed here.
    I know something is not right or obvious to me.
    I'll keep reading and working on it.
    So close...

  4. #179
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    Did you pick up my version of the usbhost_t36 WIP2-Bluetooth branch?

    There was a fix to ehci.cpp... in queue_Data_Transfer:

    I did a little more complex change on off chance you pass in 0 for length, but basically changed:
    Something like:

    Code:
    for (count=len >> 14); count; count--)
    To:
    Code:
    for (count=((len-1) >> 14); count; count--)

  5. #180
    @Kurte - Wow

    Guess I was on the right track but failed to see your fix to ehci.cpp. My bad.

    Thank you so much. On to bigger and better! You saved me a lot of wasted time.

    It works great.

    Edit: Tired of rabbit holes

  6. #181
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    I got my orico HUB usb3 Drive Holder - failed - just see HUB in Debug with current code on my machine. Collecting all the latest ZIP FILES:

    https://github.com/KurtE/USBHost_t36...WIP2-Bluetooth

    https://github.com/WMXZ-EU/uSDFS

    https://github.com/wwatson4506/MSC/

    <EDIT>: Went to USBHost and plugged in Bluetooth Dongle to the Orico USB Drive Hub/Housing and ran ...\KeyboardBT.ino and turned on Logitec K480 and it came up - so the HUB is valid for use.

    That didn't get past this - it finds the HUB and then not the drive. Ideas?
    Code:
    Test logger_RawWrite
    BUFFSIZE :24576
    Dev Type :2:/
    USB2 PLL running
     reset waited 6
    USBHS_ASYNCLISTADDR = 0
    USBHS_PERIODICLISTBASE = 2001C000
    periodictable = 2001C000
    port change: 10001803
        connect
      begin reset
    port change: 18001205
      port enabled
      end recovery
    new_Device: 480 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
      12 01 10 02 09 00 01 40 09 21 13 28 01 90 01 02 00 01 
        VendorID = 2109, ProductID = 2813, Version = 9001
        Class/Subclass/Protocol = 9(Hub) / 0 / 1(Single-TT)
        Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: VIA Labs, Inc.         
    enumeration:
    Product: USB2.0 Hub             
    enumeration:
    Config data length = 25
    enumeration:
    Configuration Descriptor:
      09 02 19 00 01 01 00 E0 00 
        NumInterfaces = 1
        ConfigurationValue = 1
      09 04 00 00 01 09 00 00 00 
        Interface = 0
        Number of endpoints = 1
        Class/Subclass/Protocol = 9(Hub) / 0 / 0
      07 05 81 03 01 00 0C 
        Endpoint = 1 IN
        Type = Interrupt
        Max Size = 1
        Polling Interval = 12
    enumeration:
    USBHub memory usage = 960
    USBHub claim_device this=20002A00
    found possible interface, altsetting=0
    number of interfaces found = 1
    USBHub control callback
    09 29 04 E9 00 32 64 00 FF 00 00 00 00 00 00 00 
    Hub ports = 4
    USBHub control callback
    USBHub control callback
    USBHub control callback
    USBHub control callback
    power turned on to all ports
    device addr = 1
    new_Pipe
    allocate_interrupt_pipe_bandwidth
      ep interval = 12
      interval = 256
     best_bandwidth = 2, at offset = 0
    pipe cap1 = F0012101

  7. #182
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,683
    @defragster
    I am assuming that you used @KurtE's hack in https://forum.pjrc.com/threads/55821...l=1#post205833.

    Know this is going to sound funny but did you try an external drive attached directly to the hub instead of the internal drive? Probably could test it with a thumb drive

  8. #183
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    @defragster and @mjs513,

    Yes looks like it needs hub object

  9. #184
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    Quote Originally Posted by KurtE View Post
    @defragster and @mjs513,

    Yes looks like it needs hub object
    I looked at the linked item and put in the lines that seemed relevant - but there must be more?

    [ @mjs513 - I was using a sketch with which seemed to be what that post indicated:]
    Code:
    #include <USBHost_t36.h>
    extern USBHost myusb;
    USBHub hub1(myusb);
    USBHub hub2(myusb);

  10. #185
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    I keep getting this when it says anything in the sketch with those HUB lines?
    Code:
    Test logger_RawWrite
    BUFFSIZE :24576
    Dev Type :2:/
    ## mscInit before msgGetMaxLun: 1
    ## mscInit after msgGetMaxLun: 0
    Mount: Failed with rc=FR_NO_FILESYSTEM.
    :

    I had started with two partitions - redid to one partition for the 500GB and then just redid it again with a smaller 120 GB single partition and it won't see FileSystem? And PC has it formatted with a .txt file ...

  11. #186
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    Plugged in my External drive that worked to this new Orico Hub & SATA Drive adapter - with the Drive removed it runs fine to the external drive in the Hub. With the drive in it finds the drive first and fails to find FileSystem.

    So it works as a Hub - Bt and the External HDD - maybe it mounts the drive oddly being internal to the hub - and also being the SATA USB interface - does this debug show anything - longer chain than above?:

    <EDITED> It came up with no FileSystem after I did cut to Paste here - then I removed drive - reformatted to Whole disk and put it back on and USB did recognition without restarting sketch - that follows after REMOVE:

    Code:
    Test logger_RawWrite
    BUFFSIZE :24576
    Dev Type :2:/
    ## mscInit before msgGetMaxLun: 1
    ## mscInit after msgGetMaxLun: 0
    Test logger_RawWrite
    BUFFSIZE :24576
    Dev Type :2:/
    USB2 PLL running
     reset waited 6
    USBHS_ASYNCLISTADDR = 0
    USBHS_PERIODICLISTBASE = 2001C000
    periodictable = 2001C000
    port change: 10001803
        connect
      begin reset
    port change: 18001205
      port enabled
      end recovery
    new_Device: 480 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
      12 01 10 02 09 00 01 40 09 21 13 28 01 90 01 02 00 01 
        VendorID = 2109, ProductID = 2813, Version = 9001
        Class/Subclass/Protocol = 9(Hub) / 0 / 1(Single-TT)
        Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: VIA Labs, Inc.         
    enumeration:
    Product: USB2.0 Hub             
    enumeration:
    Config data length = 25
    enumeration:
    Configuration Descriptor:
      09 02 19 00 01 01 00 E0 00 
        NumInterfaces = 1
        ConfigurationValue = 1
      09 04 00 00 01 09 00 00 00 
        Interface = 0
        Number of endpoints = 1
        Class/Subclass/Protocol = 9(Hub) / 0 / 0
      07 05 81 03 01 00 0C 
        Endpoint = 1 IN
        Type = Interrupt
        Max Size = 1
        Polling Interval = 12
    enumeration:
    USBHub memory usage = 960
    USBHub claim_device this=20002A00
    found possible interface, altsetting=0
    number of interfaces found = 1
    USBHub control callback
    09 29 04 E9 00 32 64 00 FF 00 00 00 00 00 00 00 
    Hub ports = 4
    USBHub control callback
    USBHub control callback
    USBHub control callback
    USBHub control callback
    power turned on to all ports
    device addr = 1
    new_Pipe
    allocate_interrupt_pipe_bandwidth
      ep interval = 12
      interval = 256
     best_bandwidth = 2, at offset = 0
    pipe cap1 = F0012101
    HUB Callback (member)
    status = 2
    getstatus, port = 1
    USBHub control callback
    01 01 01 00 
    New Port Status
      status=10101  port=1
      state=0
      Device is present: 
      Has Power
    USBHub control callback
    Port Status Cleared, port=1
    timer event (19999 us): Debounce Timer, this = 20002A00, timer = 20002D18
    ports in use bitmask = 2
    getstatus, port = 1
    USBHub control callback
    01 01 00 00 
    New Port Status
      status=101  port=1
      state=2
      Device is present: 
      Has Power
    timer event (19999 us): Debounce Timer, this = 20002A00, timer = 20002D18
    ports in use bitmask = 2
    getstatus, port = 1
    USBHub control callback
    01 01 00 00 
    New Port Status
      status=101  port=1
      state=3
      Device is present: 
      Has Power
    timer event (19999 us): Debounce Timer, this = 20002A00, timer = 20002D18
    ports in use bitmask = 2
    getstatus, port = 1
    USBHub control callback
    01 01 00 00 
    New Port Status
      status=101  port=1
      state=4
      Device is present: 
      Has Power
    timer event (19999 us): Debounce Timer, this = 20002A00, timer = 20002D18
    ports in use bitmask = 2
    getstatus, port = 1
    USBHub control callback
    01 01 00 00 
    New Port Status
      status=101  port=1
      state=5
      Device is present: 
      Has Power
    timer event (19999 us): Debounce Timer, this = 20002A00, timer = 20002D18
    ports in use bitmask = 2
    getstatus, port = 1
    USBHub control callback
    01 01 00 00 
    New Port Status
      status=101  port=1
      state=6
      Device is present: 
      Has Power
    sending reset
    send_setreset
    USBHub control callback
    unhandled setup, message = 40323
    timer event (19999 us): Debounce Timer, this = 20002A00, timer = 20002D18
    ports in use bitmask = 0
    HUB Callback (member)
    status = 2
    getstatus, port = 1
    USBHub control callback
    03 05 10 00 
    New Port Status
      status=100503  port=1
      state=7
      Device is present: 
      Enabled, speed = 480 Mbit/sec
      Has Power
    USBHub control callback
    unhandled setup, message = 140123
    timer event (24999 us): Hello, I'm resettimer, this = 20002A00, timer = 20002D34
    port_doing_reset = 1
    PORT_RECOVERY
    new_Device: 480 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
      12 01 10 02 00 00 00 40 80 00 01 A0 03 02 01 02 03 01 
        VendorID = 0080, ProductID = A001, Version = 0203
        Class/Subclass/Protocol = 0 / 0 / 0
        Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: TOSHIBA
    enumeration:
    Product: External USB 3.0
    enumeration:
    Serial Number: 201503310007F
    enumeration:
    Config data length = 85
    enumeration:
    Configuration Descriptor:
      09 02 55 00 01 01 00 80 FA 
        NumInterfaces = 1
        ConfigurationValue = 1
      09 04 00 00 02 08 06 50 00 
        Interface = 0
        Number of endpoints = 2
        Class/Subclass/Protocol = 8(Mass Storage) / 6(SCSI) / 80(Bulk Only)
      07 05 81 02 00 02 00 
        Endpoint = 1 IN
        Type = Bulk
        Max Size = 512
        Polling Interval = 0
      07 05 02 02 00 02 00 
        Endpoint = 2 OUT
        Type = Bulk
        Max Size = 512
        Polling Interval = 0
      09 04 00 01 04 08 06 62 00 
        Interface = 0
        Number of endpoints = 4
        Class/Subclass/Protocol = 8(Mass Storage) / 6(SCSI) / 98(UAS)
      07 05 01 02 00 02 00 
        Endpoint = 1 OUT
        Type = Bulk
        Max Size = 512
        Polling Interval = 0
      04 24 01 00 
      07 05 82 02 00 02 00 
        Endpoint = 2 IN
        Type = Bulk
        Max Size = 512
        Polling Interval = 0
      04 24 02 00 
      07 05 83 02 00 02 00 
        Endpoint = 3 IN
        Type = Bulk
        Max Size = 512
        Polling Interval = 0
      04 24 03 00 
      07 05 04 02 00 02 00 
        Endpoint = 4 OUT
        Type = Bulk
        Max Size = 512
        Polling Interval = 0
      04 24 04 00 
    enumeration:
    USBHub memory usage = 960
    USBHub claim_device this=2001B280
    msController claim this=2001C5A0
    msController claim this=2001C920
    msController claim this=2001CCA0
    Descriptor 4 = INTERFACE
    msController claim this=2001C5A0
    09 04 00 00 02 08 06 50 00 07 05 81 02 00 02 00 07 05 02 02 00 02 00 09 04 00 01 04 08 06 62 00 07 05 01 02 00 02 00 04 24 01 00 07 05 82 02 00 02 00 04 24 02 00 07 05 83 02 00 02 00 04 24 03 00 07 05 04 02 00 02 00 04 24 04 00 
    numendpoint=2
    endpointIn=81
    endpointOut=2
    packet size in (msController) = 512
    packet size out (msController) = 512
    polling intervalIn = 0
    polling intervalOut = 0
    new_Pipe
    new_Pipe
    Descriptor 5 = ENDPOINT
    Descriptor 5 = ENDPOINT
    Descriptor 4 = INTERFACE
    msController claim this=2001C920
    09 04 00 01 04 08 06 62 00 07 05 01 02 00 02 00 04 24 01 00 07 05 82 02 00 02 00 04 24 02 00 07 05 83 02 00 02 00 04 24 03 00 07 05 04 02 00 02 00 04 24 04 00 
    msController claim this=2001CCA0
    09 04 00 01 04 08 06 62 00 07 05 01 02 00 02 00 04 24 01 00 07 05 82 02 00 02 00 04 24 02 00 07 05 83 02 00 02 00 04 24 03 00 07 05 04 02 00 02 00 04 24 04 00 
    Descriptor 5 = ENDPOINT
    Descriptor 36 =  ???
    Descriptor 5 = ENDPOINT
    Descriptor 36 =  ???
    Descriptor 5 = ENDPOINT
    Descriptor 36 =  ???
    Descriptor 5 = ENDPOINT
    Descriptor 36 =  ???
    control CallbackIn (msController)
    00 00 00 00 00 00 00 00 
    ## mscInit before msgGetMaxLun: 1
    control CallbackIn (msController)
    00 00 00 00 00 00 00 00 
    ## mscInit after msgGetMaxLun: 0
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 01 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 01 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 02 00 00 00 24 00 00 00 80 00 06 12 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 36
    00 00 06 12 5B 00 00 00 54 4F 20 45 78 74 65 72 6E 61 6C 20 55 53 42 20 33 2E 30 20 20 20 20 20 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 02 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 03 00 00 00 08 00 00 00 80 00 0A 25 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 8
    3A 38 60 2F 00 00 02 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 03 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 04 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 04 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 05 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    33 C0 8E D0 BC 00 7C 8E C0 8E D8 BE 00 7C BF 00 06 B9 00 02 FC F3 A4 50 68 1C 06 CB FB B9 04 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 05 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 06 00 00 00 00 00 00 00 80 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 06 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    msController CallbackOut (static)
    transfer->qtd.token = 0
    msController dataOut (static)31
    55 53 42 43 07 00 00 00 00 02 00 00 80 00 0A 28 00 00 00 00 01 00 00 01 00 00 00 00 00 00 00 
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 512
    45 46 49 20 50 41 52 54 00 00 01 00 5C 00 00 00 86 C1 D5 FD 00 00 00 00 01 00 00 00 00 00 00 00 
    ** ????
    msController CallbackIn (static)
    transfer->qtd.token = 0
    msController dataIn (static): 13
    55 53 42 53 07 00 00 00 00 00 00 00 00 
    ** CSWSIGNATURE
    Mount: Failed with rc=FR_NO_FILESYSTEM.
    port change: 1C00100A
        disconnect
    disconnect_Device:
    USBDriver (available_drivers) list: 2001B280 -> 2001C920 -> 2001CCA0
    USBDriver (dev->drivers) list: 20002A00
    disconnect driver 20002A00
    disconnect_Device:
    USBDriver (available_drivers) list: 2001B280 -> 2001C920 -> 2001CCA0
    USBDriver (dev->drivers) list: 2001C5A0
    disconnect driver 2001C5A0
    Device Disconnected...
    USBDriver (available_drivers) list: 2001C5A0 -> 2001B280 -> 2001C920 -> 2001CCA0
    delete_Pipe 2001CCC0
      remove QH from async schedule
      Free transfers
      Free transfers attached to QH
        * 536989536
    * Delete Pipe completed
    delete_Pipe 2001CA00
      remove QH from async schedule
      Free transfers
      Free transfers attached to QH
        * 536986752
    * Delete Pipe completed
    delete_Pipe 2001CD20
      remove QH from async schedule
      Free transfers
      Free transfers attached to QH
        * 536986880
    * Delete Pipe completed
    removed Device_t from devlist
    USBDriver (available_drivers) list: 20002A00 -> 2001C5A0 -> 2001B280 -> 2001C920 -> 2001CCA0
    delete_Pipe 2001CD80
      Free transfers
        * 536989408 * remove * free
      Free transfers attached to QH
        * 536986944
    * Delete Pipe completed
    delete_Pipe 2001C400
      shut down async schedule
      Free transfers
      Free transfers attached to QH
        * 536986816
    * Delete Pipe completed
    removed Device_t from devlist
      disable
    port change: 10001803
        connect
    port change: 1C001002
        disconnect
    port change: 10001803
        connect
      begin reset
    port change: 18001205
      port enabled
      end recovery
    new_Device: 480 Mbit/sec
    new_Pipe
    enumeration:
    enumeration:
    enumeration:
    Device Descriptor:
      12 01 10 02 09 00 01 40 09 21 13 28 01 90 01 02 00 01 
        VendorID = 2109, ProductID = 2813, Version = 9001
        Class/Subclass/Protocol = 9(Hub) / 0 / 1(Single-TT)
        Number of Configurations = 1
    enumeration:
    enumeration:
    Manufacturer: VIA Labs, Inc.         
    enumeration:
    Product: USB2.0 Hub             
    enumeration:
    Config data length = 25
    enumeration:
    Configuration Descriptor:
      09 02 19 00 01 01 00 E0 00 
        NumInterfaces = 1
        ConfigurationValue = 1
      09 04 00 00 01 09 00 00 00 
        Interface = 0
        Number of endpoints = 1
        Class/Subclass/Protocol = 9(Hub) / 0 / 0
      07 05 81 03 01 00 0C 
        Endpoint = 1 IN
        Type = Interrupt
        Max Size = 1
        Polling Interval = 12
    enumeration:
    USBHub memory usage = 960
    USBHub claim_device this=20002A00
    found possible interface, altsetting=0
    number of interfaces found = 1
    USBHub control callback
    09 29 04 E9 00 32 64 00 FF 00 00 00 00 00 00 00 
    Hub ports = 4
    USBHub control callback
    USBHub control callback
    USBHub control callback
    USBHub control callback
    power turned on to all ports
    device addr = 3
    new_Pipe
    allocate_interrupt_pipe_bandwidth
      ep interval = 12
      interval = 256
     best_bandwidth = 2, at offset = 0
    pipe cap1 = F0012103
    Last edited by defragster; 05-22-2019 at 01:09 AM.

  12. #187
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    Something really odd to post on T4 Beta - the other day I noted USB survives power off when UARTS are powered … on T4B2m in that case this Orico Hub will power the T4 to restart and send out Debug Spew to the Serial4 T_3.1 … This would say the Orico hub is evil and sending power back perhaps?

  13. #188
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    Posted on T4 thread - if this USB Hub device is powering back to anything it is a device problem not Teensy - I think Paul already confirmed as much the other week - but was hoping for confirmation.

    When I get in the state where Woke USB is active when 'unpowered' [ powered by UART signals] and this 'Hub' device powers up Teensy - pulling the power from hub turns it off - so of course that is where the power is coming from.

    I think I need to leave a bad product review and return the device - but would like to know before wasting time and effort to return it. Having power and hub seemed like the perfect mate for Teensy - and a drive inside too. If returning don't need to diagnose the drive fail …

    @mjs513 - got that new computer back up and running to owner - and he left his old computer - ordered a $60 2 TB Seagate 7200 RPM drive with 256 MB cache to see if the computer works and the drive just got trashed - it is 3 year old i7 laptop - and just got some windows updates … one of the lame low power 2 core i7-7600U's - but maybe dual boot Linux as I really don't need another Win machine. Looked at SSD's for computer - still don't trust them for long/happy life - esp not comparing that 2 TB for $60.

  14. #189
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    @mjs513 - on the Seagate 5400rpm 1TB drive - did you have to do anything special to use the drive?

    I put this 500GB in external powered adapter that worked with the 3.5" and like the Orico Powered up it returns this going direct to breakout USB connector :
    Code:
    Test logger_RawWrite
    BUFFSIZE :24576
    Dev Type :2:/
    ## mscInit before msgGetMaxLun: 1
    ## mscInit after msgGetMaxLun: 0
    Mount: Failed with rc=FR_NO_FILESYSTEM.
    It is failing here with fmt==3
    ...\libraries\uSDFS\src\ff.c ~line 3286 :: if (fmt >= 2) return FR_NO_FILESYSTEM; /* No FAT volume is found */

    I deleted the simple partition again and reformatted exFat - Windows likes the disk and wrote a file to it.
    The type of the file system is exFAT.
    // …
    488358144 KB available on disk.

    262144 bytes in each allocation unit.
    1907656 total allocation units on disk.
    1907649 allocation units available on disk.
    Just confirmed that again this drive holder works with the other old 3.5" disk as before:
    Code:
    Test logger_RawWrite
    BUFFSIZE :24576
    Dev Type :2:/
    ## mscInit before msgGetMaxLun: 1
    ## mscInit after msgGetMaxLun: 0
    File System FS_EXFAT
    Free Disk Size -1 clusters
    Cluster Size 256 sectors
    Sector Size 512 bytes
    
    Change drive
    A_00001.dat
    stat FR_NO_FILE 0
     opened FR_OK 0
    
    ................................................................
    .................................... (10573996 - 9.296769 MB/s)
     (open: 855031 us; close: 44000 us; write: min,max: 7916 36913 us)

  15. #190
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    @mjs513, @defraster, @WMXZ, @wwatson, @Paul...

    I sort of have been out of it for the last week or so... But hopefully will be able to slowly get back up to speed.

    Sort of trying to figure out what else should be tested and/or suggestions on changes or...

    Things like:

    a) adding HUB objects to sketches that use USB... Before I thought we needed to add stuff like:
    Code:
    #include <USBHost_t36.h>
    extern USBHost myusb;
    USBHub hub1(myusb);
    USBHub hub2(myusb);
    But I think we can in this case just do:
    Code:
    #include <USBHost_t36.h>
    USBHub hub1(nullptr);
    USBHub hub2(nullptr);
    I hated adding that extern, but most of the USB Host objects only allow you to pass a reference to the USBHost object, but looks like the USBHub also allows you to pass in pointer.... And I don't believe any of our objects actually use the pointer/reference for anything... @Paul - Wondering your thoughts of adding pointer constructor version to all USB objects... Like was done for HUB
    Code:
    class USBHub : public USBDriver {
    public:
    	USBHub(USBHost &host) : debouncetimer(this), resettimer(this) { init(); }
    	USBHub(USBHost *host) : debouncetimer(this), resettimer(this) { init(); }
    Also wondering if it would be OK to also have default value of nullptr for this...


    b) It is interesting on how some of these different hard drives, act so very differently, hopefully in several of these cases we can resolve and/or detect issues... Things like:
    1) Type of boot record? I know when Windows saw one of my hard disks, it said it needed to init it to either MBR or ??? Do we handle both?
    2) Multiple LUN values?

    3) My Toshiba External Hard drive which supports eSATA (and USB), did not work. Was formatted on Windows as FAT... But hung on read. One interesting thing I saw with this disk was from the msDeviceInquiry call, the returned data:
    Code:
    BYTE      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ---------------------------------------------------------
    0000      05 80 00 21 1f 00 00 00 54 4f 53 48 49 42 41 20   ...!....TOSHIBA 
    0010      56 69 72 74 75 61 6c 20 43 64 72 6f 6d 20 20 20   Virtual Cdrom   
    0020      31 2e 30 30 00 00 00 00 00 00 00 00 00 00 00 00   1.00............
    The first byte 05 - CD/DVD ... Where other disks have value 0.. So maybe we need to check this byte and error out if not 0 = Direct access block device (e.g., magnetic disk)

    c) I tried something that I was pretty sure that would not work, and that we to try plugging in external USB CDROM/DVD drives, which failed... Mentioned in #157, The Memorex one, kept resetting connecting/disconnecting... But then again I am guessing these will never work with these libraries anyway as I believe they use different file system (UDF)...


    Now to see what else I need to catch up on...

  16. #191
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    @...

    For what is worth, I am trying an experiment with the Toshiba Hard drive....

    That is I do the inquiry on each possible LUN (this one said Max 1), if the drive type != 0 it tries the next one... This appears to work for the Toshiba...

    I have extra debug stuff printing, but you can see:
    Code:
    Test logger_RawWrite
    uSDFS_VER:15_MAY_19_08_16
    BUFFSIZE :8192
    Dev Type :2:/
    ## mscInit before msgGetMaxLun: 1
    ## mscInit after msgGetMaxLun: 1
    ## mscInit after msDeviceInquiry LUN(0): Device Type: 5 result:0
    BYTE      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ---------------------------------------------------------
    0000      05 80 00 21 1f 00 00 00 54 4f 53 48 49 42 41 20   ...!....TOSHIBA 
    0010      56 69 72 74 75 61 6c 20 43 64 72 6f 6d 20 20 20   Virtual Cdrom   
    0020      31 2e 30 30 00 00 00 00 00 00 00 00 00 00 00 00   1.00............
    ## mscInit after msDeviceInquiry LUN(1): Device Type: 0 result:0
    BYTE      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ---------------------------------------------------------
    0000      00 00 04 02 1f 00 00 00 54 4f 53 48 49 42 41 20   ........TOSHIBA 
    0010      45 78 74 65 72 6e 61 6c 20 48 44 44 20 20 20 20   External HDD    
    0020      31 2e 30 30 00 00 00 00 00 00 00 00 00 00 00 00   1.00............
    ## mscInit after msReadDeviceCapacity: 0
    BYTE      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ---------------------------------------------------------
    0000      af 6d 70 74 00 02 00 00 00 00 00 00 00 00 00 00   .mpt............
    File System FS_EXFAT
    Free Disk Size -1 clusters
    Cluster Size 512 sectors
    Sector Size 512 bytes
    
    Change drive
    A_00001.dat
    stat FR_OK 0
     opened FR_OK 0
    
     (24996 - 2.621860 MB/s)
     (open: 11036 us; close: 9000 us; write: min,max: 3975 11979 us)
    
    unmount FR_OK
    So may try to clean this up... I added functions to query/set current LUN and then added the loop which appears again to work here...

    Kurt

  17. #192
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    Quote Originally Posted by KurtE View Post
    @...

    For what is worth, I am trying an experiment with the Toshiba Hard drive....

    That is I do the inquiry on each possible LUN (this one said Max 1), if the drive type != 0 it tries the next one... This appears to work for the Toshiba...

    I have extra debug stuff printing, but you can see:
    ...
    So may try to clean this up... I added functions to query/set current LUN and then added the loop which appears again to work here...

    Kurt
    I'm wondering if my failed drive is marked oddly for partitions [ LUNs ? ] and the one looked at doesn't have a valid _FileSystem?

    Not having looked at the code - not sure how partitions are handled - is each a LUN?

    This drive from NEW it seemed a large and small partition would allow for more usable allocation units - so I made TWO. Maybe that initial partition left a table record that is confusing the code - and even changing it didn't clean it up?

    I need to get my brake working on the lawn mower so I can spend an hour or two cutting grass before it becomes a jungle - even if just a quick bypass of the interlock so I can get it started ...

  18. #193
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    @defragster (and others) - I pushed up the WIP LUN code in the branch: https://github.com/KurtE/MSC/tree/try_lun_for_hd_type

    Will probably try out a few more changes, like if it does not find a LUN with type=0, maybe it should abort with an error code.

    Not sure yet what multiple partitions does or should do.

    But maybe should take a look and see...

  19. #194
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,250
    Quote Originally Posted by KurtE View Post

    Will probably try out a few more changes, like if it does not find a LUN with type=0, maybe it should abort with an error code.

    Not sure yet what multiple partitions does or should do.

    But maybe should take a look and see...
    Concerning Multiple partition, IFAIK these must also be enabled inside ffconf.h (part of uSDFS)
    maybe
    #define FF_MULTI_PARTITION 1 (line 184 or so)

  20. #195
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    9,033
    Updated source to 'an hour ago' : https://github.com/KurtE/MSC/tree/try_lun_for_hd_type

    … for both logger_RawWrite and RawWrite_FS the 2.5" reports:
    Code:
    Test logger_RawWrite
    BUFFSIZE :24576
    Dev Type :2:/
    ## mscInit before msgGetMaxLun: 1
    ## mscInit after msgGetMaxLun: 1
    ## mscInit after msDeviceInquiry LUN(0): Device Type: 0 result:0
    BYTE      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ---------------------------------------------------------
    0000      00 00 02 02 1f 00 00 00 53 54 35 30 30 4c 4d 30   ........ST500LM0
    0010      33 30 2d 32 45 37 31 37 44 20 20 20 20 20 20 20   30-2E717D       
    0020      20 20 20 20 00 00 00 00 00 00 00 00 50 8f d4 3e       ........P..>
    ## mscInit after msReadDeviceCapacity: 0
    BYTE      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ---------------------------------------------------------
    0000      2f 60 38 3a 00 02 00 00 90 06 f0 3e ed 06 00 00   /`8:.......>....
    Mount: Failed with rc=FR_NO_FILESYSTEM.
    Test logger_RawWrite  >> THIS IS THE _FS version
    1970-01-01 00:00:00
    BUFFSIZE :8192
    Dev Type :2
    Using uSDFS
    uSDFS_VER:15_MAY_19_08_16
    ## mscInit before msgGetMaxLun: 1
    ## mscInit after msgGetMaxLun: 1
    ## mscInit after msDeviceInquiry LUN(0): Device Type: 0 result:0
    BYTE      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ---------------------------------------------------------
    0000      00 00 02 02 1f 00 00 00 53 54 35 30 30 4c 4d 30   ........ST500LM0
    0010      33 30 2d 32 45 37 31 37 44 20 20 20 20 20 20 20   30-2E717D       
    0020      20 20 20 20 00 00 00 00 00 00 00 00 00 00 00 00       ............
    ## mscInit after msReadDeviceCapacity: 0
    BYTE      00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
    ---------------------------------------------------------
    0000      2f 60 38 3a 00 02 00 00 00 00 00 00 00 00 00 00   /`8:............
    Mount: Failed with rc=FR_NO_FILESYSTEM.
    Swapped Seagate 2.5" for the working Samsung 3.5" in the usable external Drive holder and the 3.5" drive still works for both logger_RawWrite and RawWrite_FS

    Gotta go get on the lawn ...

  21. #196
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    Thanks @defragster - Looks like in both cases, it is using the LUN 0 to work, so looks like I did not break that

    @WMXZ/@wwatson, Not sure what all the consequences would be to the two/three code bases to enable multiple partitions/voilumes.

    That is there is lots of the code that is hard coded to use the msDrive1 object. My guess this could take some investigation/changes. Where for example some function like disk_read is called with some pdrv value, there would need to be something that maps the pdrv to the appropriate object or the like... But again I don't enough here to know how that mapping would work. Currently I believe that pdrv values are simply something like SPI or SDHC or MSC...

  22. #197
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,250
    Quote Originally Posted by KurtE View Post
    Thanks @defragster - Looks like in both cases, it is using the LUN 0 to work, so looks like I did not break that

    @WMXZ/@wwatson, Not sure what all the consequences would be to the two/three code bases to enable multiple partitions/voilumes.

    That is there is lots of the code that is hard coded to use the msDrive1 object. My guess this could take some investigation/changes. Where for example some function like disk_read is called with some pdrv value, there would need to be something that maps the pdrv to the appropriate object or the like... But again I don't enough here to know how that mapping would work. Currently I believe that pdrv values are simply something like SPI or SDHC or MSC...
    Yes, the possible usage (e.g. multiple disk on USB hub) may need more careful thinking
    Question: Is the file system capable of handling multiple disks (i.e. not using global variables)?
    for uSDFS the underlaying FS is written in plain C (ff.c), so it is better to check.
    if ff.c allows multiple disks open, then it would be possible to allow access to multiple devices.

    I had once a version that allowed multiple SPI CS, but my application was one disk at a time.
    I can reintroduce that again for SPI and USB, SDHC allows only one disk at the time (at least that is what I was told)

  23. #198
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    @WMXZ - Thanks,

    Personally one disk at a time is probably good enough (at least for anything I might try to do).

    But I can maybe see conditions where the user may want to use multiple partitions.... For example if I have a larger drive, maybe setup two partitions, one larger with a better FS, maybe a second smaller one with FAT, to transfer information from Host to Teensy... Wondering what would break when we enabled the FF_MULTI_PARTITION ... May have to try at some point.

  24. #199
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,053
    Ok, I updated the Toshiba HD to have two partitions. A smaller partition at start that is fat32 and the rest as second partition NTFS.

    And it looks like the current code without enabling MULTI_PARTION works for this case.

    Both for logger...

    Code:
    est logger_RawWrite
    uSDFS_VER:15_MAY_19_08_16
    BUFFSIZE :8192
    Dev Type :2:/
    File System FS_FAT32
    Free Disk Size 2050028 clusters
    Cluster Size 8 sectors
    Sector Size 512 bytes
    
    Change drive
    A_00001.dat
    stat FR_OK 0
     opened FR_OK 0
    
     (65996 - 0.993030 MB/s)
     (open: 22038 us; close: 15000 us; write: min,max: 23979 26975 us)
    
    unmount FR_OK
    As well as MBR_diskIO_Test
    Code:
    Disk initialize Status: 0
    Disk read Result: 0
    fa b8 00 10 8e d0 bc 00 b0 b8 00 00 8e d8 8e c0
    fb be 00 7c bf 00 06 b9 00 02 f3 a4 ea 21 06 00
    00 be be 07 38 04 75 0b 83 c6 10 81 fe fe 07 75
    f3 eb 16 b4 02 b0 01 bb 00 7c b2 80 8a 74 01 8b
    4c 02 cd 13 ea 00 7c 00 00 eb fe 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 28 d3 6f a8 00 00 00 20
    21 00 0c 0b cc ff 00 08 00 00 00 c0 fa 00 00 0b
    cd ff 07 fe ff ff 00 c8 fa 00 00 90 75 73 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa
    
    Master Boot Record
      Partition: 0 first Sector: 2048 total Sectors: 16433152
      Partition: 1 first Sector: 16435200 total Sectors: 1937084416
      Partition: 2 first Sector: 0 total Sectors: 0
      Partition: 3 first Sector: 0 total Sectors: 0
    This was the disk that did not work at all earlier...

    Issued PR to handle this drive

  25. #200
    Senior Member+
    Join Date
    Jul 2014
    Location
    New York
    Posts
    3,683
    @KurtE, @defragster, @wwatson and @WMXZ

    Wow. Now that I got my internet back you guys really have been busy - reading this on emails on the phone didn't sink in until now. A lot to catch up on and update.

    @KurtE - did you try the drive partitioned with 2 exFAT partitions using multipartion? Will have to update and see what happens

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •