Forum Rule: Always post complete source code & details to reproduce any issue!
Page 13 of 15 FirstFirst ... 3 11 12 13 14 15 LastLast
Results 301 to 325 of 351

Thread: USBHost_t36 USB Mass Storage Driver Experiments

  1. #301
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,699
    Starting off slightly off-topic. I just received a new Raspberry PI 4, that hopefully tomorrow will set up. Forgot to get a micro HDMI cable. It is now in mail box in town...

    Was looking around on how to install Ubuntu on it and ran across a site that shows you how to install it on an SSD: https://jamesachambers.com/raspberry...llation-guide/

    Included in this are some cheap setups for SSD drives.
    One is Do it your self with a cheap SSD: https://jamesachambers.com/raspberry...sd-upgrade-30/

    cheap SSD Drive: https://www.amazon.com/Kingston-120G...language=en_US

    Cheap Adapter: https://www.amazon.com/StarTech-com-...language=en_US

    Total: $19.99+$9.99 or lets say $30

    Or a bit more expensive, a plug in thumb drive wheich is SSD: https://www.amazon.com/dp/B01MU8TZRV...language=en_US $46

    The reason I mention that here, is maybe it might be fun to try one of these here... And then maybe end up using it for the new RPI4 (or 3)..

  2. #302
    Senior Member
    Join Date
    Aug 2017
    Posts
    147
    @Kurte

    Thanks for this information. SSD's are something that I have wanted to play with but just could not afford at that time. The plugin SSD drive would be the best choice for me for minimal hardware clutter.
    I
    have the latest RPI3 and have always used USB Drives with them. I was using Ubuntu MATE. The latest I found is:
    https://ubuntu-mate.org/raspberry-pi/

    In the boot directory, 'cmdline.txt', this worked:
    Code:
    #dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
    dwc_otg.lpm_enable=0 console=tty1 root=/dev/sda1 rootfstype=ext4 elevator=deadline rootwait
    It also worked with Raspbian.

    Has anybody tried adapting or using lwext4 an ext4 Linux style file system for microcontrollers?
    Would this be a worthwhile project?

  3. #303
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    5,699
    @wwatson - Today I received the cheap drive/adapter and plugged it into my PC and had to initialize it. So I choose MBR
    I then formatted all of it as one exfat partition...

    I then ran the MBR_diskIO_test program and it ran...
    Code:
    Disk read Result: 0
    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
    bd be 07 80 7e 00 00 7c 0b 0f 85 0e 01 83 c5 10
    e2 f1 cd 18 88 56 00 55 c6 46 11 05 c6 46 10 00
    b4 41 bb aa 55 cd 13 5d 72 0f 81 fb 55 aa 75 09
    f7 c1 01 00 74 03 fe 46 10 66 60 80 7e 10 00 74
    26 66 68 00 00 00 00 66 ff 76 08 68 00 00 68 00
    7c 68 01 00 68 10 00 b4 42 8a 56 00 8b f4 cd 13
    9f 83 c4 10 9e eb 14 b8 01 02 bb 00 7c 8a 56 00
    8a 76 01 8a 4e 02 8a 6e 03 cd 13 66 61 73 1c fe
    4e 11 75 0c 80 7e 00 80 0f 84 8a 00 b2 80 eb 84
    55 32 e4 8a 56 00 cd 13 5d eb 9e 81 3e fe 7d 55
    aa 75 6e ff 76 00 e8 8d 00 75 17 fa b0 d1 e6 64
    e8 83 00 b0 df e6 60 e8 7c 00 b0 ff e6 64 e8 75
    00 fb b8 00 bb cd 1a 66 23 c0 75 3b 66 81 fb 54
    43 50 41 75 32 81 f9 02 01 72 2c 66 68 07 bb 00
    00 66 68 00 02 00 00 66 68 08 00 00 00 66 53 66
    53 66 55 66 68 00 00 00 00 66 68 00 7c 00 00 66
    61 68 00 00 07 cd 1a 5a 32 f6 ea 00 7c 00 00 cd
    18 a0 b7 07 eb 08 a0 b6 07 eb 03 a0 b5 07 32 e4
    05 00 07 8b f0 ac 3c 00 74 09 bb 07 00 b4 0e cd
    10 eb f2 f4 eb fd 2b c9 e4 64 eb 00 24 02 e0 f8
    24 02 c3 49 6e 76 61 6c 69 64 20 70 61 72 74 69
    74 69 6f 6e 20 74 61 62 6c 65 00 45 72 72 6f 72
    20 6c 6f 61 64 69 6e 67 20 6f 70 65 72 61 74 69
    6e 67 20 73 79 73 74 65 6d 00 4d 69 73 73 69 6e
    67 20 6f 70 65 72 61 74 69 6e 67 20 73 79 73 74
    65 6d 00 00 00 63 7b 9a 33 08 72 2d 5a 03 00 20
    21 00 07 fe ff ff 00 08 00 00 00 38 f9 0d 00 00
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00 00 00 00 00 00 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: 234436608
      Partition: 1 first Sector: 0 total Sectors: 0
      Partition: 2 first Sector: 0 total Sectors: 0
      Partition: 3 first Sector: 0 total Sectors: 0
    Next up need to remember what speed test or the like there is...

    Yes I also wondered if there was some linux disk format setups for Microcontrollers as well.

    Probably will do a little more on the system with this and then try it out on one of the RPIs...

  4. #304
    Senior Member
    Join Date
    Aug 2017
    Posts
    147

    Updated MSC

    @All

    I have cleaned up and updated MSC.

    Added more complete error processing including using sense codes. Funny thing is I have not been able generate any errors yet so not sure how it will respond.
    I'm sure eventually they will happen

    Here is the link again:
    https://github.com/wwatson4506/MSC

  5. #305
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,068
    Too late to check for updated source - but using TD_1.47 and what I have that compiles I am seeing this error on SD cards in a USB Adaoter:
    Code:
    Test logger_RawRead
    uSDFS_VER:30_Jun_19_07_17
    BUFFSIZE :8192
    Dev Type :2:/
    CSW Tag Error: 253
    I have not seen this before? Time for Zzzz's here but tried to compile this using updated TyComm from my SubLime editor with https://github.com/Defragster/Tset that is working on T4 with TD 1.47 otherwise.

  6. #306
    Junior Member
    Join Date
    Jun 2016
    Location
    Rennes France
    Posts
    18
    Hi thanks for this library. I have test logger_RawWrite_FS example with one usb stick and it work fine. Just one thing interrogate me, when i start program without Usb stick, the program stay lock in mounting process infinitely without generate error message. I have write one simple program to test this:
    #include <diskio.h>
    #include <ff.h>
    #include <ffconf.h>
    #include <uSDFS.h>
    #include <USBHost_t36.h>
    USBHub hub1(nullptr);
    USBHub hub2(nullptr);
    const char *Dev = "2:/"; // USB
    FRESULT rc; /* Result code */
    FATFS fatfs; /* File system object */
    FIL fil; /* File object */
    /* 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 setup() {

    while(!Serial);
    // put your setup code here, to run once:
    if((rc = f_mount (&fatfs, Dev, 1))) die("Mount",rc); /* Mount/Unmount a logical drive */

    Serial.println("USB Mount OK");
    }
    void loop() {
    // put your main code here, to run repeatedly:
    while (Serial.available() > 0) {
    char Ordre = Serial.read();
    switch (Ordre) {
    case 'm':
    rc = f_mount (&fatfs, Dev, 1);
    Serial.println ("Mount USB");
    Serial.println(FR_ERROR_STRING[rc]);
    break;
    case 'u':
    rc = f_unmount(Dev);
    Serial.println ("Unmount USB");
    Serial.println(FR_ERROR_STRING[rc]);
    break;
    }
    }
    }
    .
    I start with plugged USB stick and mounting is OK, then i send 'u' with serial terminal to un_mount it and un_mount work fine. But when i try to mount again with 'm' command, the mount process seem lock.
    My project try to verify if stick is present before record data to it, and if not prevent user to plug Usb Stick and mount it manually (or automatically if stick is plugged).
    Any suggestions to solve this ? Regards Eric

  7. #307
    Senior Member
    Join Date
    Aug 2017
    Posts
    147
    Hi Eric,

    Just got home. There are a few things we can do to check for a non available drive. It should be plug and play. I have checks in MSC to check for non existent drive connections.
    In some of my older test programs I checked for this. In MassStoreageHost.cpp there is a function (bool deviceAvailable(void)) that returns the status tf a drive is connected.
    Got your INO and will test with it.

    Are you using the T36 or T4?

  8. #308
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,068
    Quote Originally Posted by defragster View Post
    Too late to check for updated source - but using TD_1.47 and what I have that compiles I am seeing this error on SD cards in a USB Adaoter:
    Code:
    Test logger_RawRead
    uSDFS_VER:30_Jun_19_07_17
    BUFFSIZE :8192
    Dev Type :2:/
    CSW Tag Error: 253
    I have not seen this before? Time for Zzzz's here but tried to compile this using updated TyComm from my SubLime editor with https://github.com/Defragster/Tset that is working on T4 with TD 1.47 otherwise.
    I finally got back here. Pulled the current uSDFS and MSC with TD 1.47 on PJRC final Beta breakout.

    I still get this error using two USB adapters for SD cards. Have used these before.

    Those same SD cards on the Breakout as #1 SDHC work, and using a standard FLASH USB Stick as #2 works.

    This is with :: "{sketchbook}\libraries\uSDFS\examples\logger_RawW rite\logger_RawWrite.ino"

    Also oddly the '.' printed during progress are showing on are dropping on NewLines and I don't see why - maybe it is the Beta Try_update for T_Sermon.

    Also this sketch doesn't include this needed to use a hub to get power for external drives:
    Code:
    #include <USBHost_t36.h>
    extern USBHost myusb;
    USBHub hub1(myusb);
    USBHub hub2(myusb);
    Doing that gives the same err #253 using the Flash Adapter to SD.

    Plugged an SSD drive on SATA/USB adapter to HUB and it worked.

    Just confirmed that TyCommander as SerMon gets the dots out as they always have been:
    Code:
    A_00010.dat
    stat FR_OK 9d6
     opened FR_OK 0
    
    .................................................................................................... (4050993 - 8.088881 MB/s)
     (open: 44994 us; close: 39000 us; write: min,max: 3965 9972 us)
    Versus this from Try#6 on the T4 Beta thread - which ODDLY does copy paste right … below is a screen shot:
    Code:
    ........ (4050993 - 8.088881 MB/s)
     (open: 44994 us; close: 39000 us; write: min,max: 3965 9972 us)
    Posting this here in context to LINK in case I can't create a repro program on T4 Beta thread:
    Click image for larger version. 

Name:	Try6_BadnLine.png 
Views:	3 
Size:	11.8 KB 
ID:	17331

  9. #309
    Junior Member
    Join Date
    Jun 2016
    Location
    Rennes France
    Posts
    18
    Quote Originally Posted by wwatson View Post
    Hi Eric,

    Just got home. There are a few things we can do to check for a non available drive. It should be plug and play. I have checks in MSC to check for non existent drive connections.
    In some of my older test programs I checked for this. In MassStoreageHost.cpp there is a function (bool deviceAvailable(void)) that returns the status tf a drive is connected.
    Got your INO and will test with it.

    Are you using the T36 or T4?
    Sorry but I'm newbie in C++ and i don't arrived to implement this function (bool deviceAvailable(void)). Actually i pass though µSDFS class and i don't have directly access to MSC methods. When i try to do, this return me error ( like : not in this scope or undefined reference to `deviceAvailable()'). Like there isn't method in µFDFS who can directly give me memory device status, i can't obtain this information.. Please have you one example of your old test program ?
    I use T36..
    Thanks

  10. #310
    Senior Member
    Join Date
    Aug 2017
    Posts
    147
    @BOBILLIER, @all,

    Found a bug in MSC that I think prevents remounting of a device unless it is unplugged and plugged in again or a reset is performed, (same diff). When a USB drive device is plugged in and the device is showing available, a call to 'WaitDriveReady()' is performed which then checks if it has been initialized. If not it calls mscInit() which sets the device to initialized.
    Code:
    // Wait for drive to be usable
    uint8_t WaitDriveReady(void) {
    	while(!msDrive1.available());     // Check drive is online
    	if(!msDrive1.initialized())
    		mscInit();  				  // Init drive if needed.
    	return msDrive1.WaitMediaReady(); // Wait for it to be ready
    }
    When the USB device is unmounted deviceInitialized is never set to false so mscInit() is not being called.
    Will work on this Friday when I go on vacation.

    @defragster,
    I have not yet tried a USB SD card reader yet, but I do have a Targus SD card reader to work with. This could be fun
    Code 253 is an arbitrary code for a CSW Tag Error located in MassStorage.h. I means that the tag number in the CBW was not returned in the CSW.
    zzz is not just a freight code. Going for it!

  11. #311
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,068
    Quote Originally Posted by wwatson View Post
    ...
    @defragster,
    I have not yet tried a USB SD card reader yet, but I do have a Targus SD card reader to work with. This could be fun
    Code 253 is an arbitrary code for a CSW Tag Error located in MassStorage.h. I means that the tag number in the CBW was not returned in the CSW.
    zzz is not just a freight code. Going for it!
    SD in adapter was working before - not sure when or why it stopped. I thought one of my cards was bad - but tried both in the SDHC and they both ran.

  12. #312
    Junior Member
    Join Date
    Jun 2016
    Location
    Rennes France
    Posts
    18
    Hi
    I have another problem with those libraries. I have try to create on basic example with one main and one include file where i have put declarations , prototypes and functions (.h and .cpp) (see attachement).Test_USB_Teensy_lib.zip
    But when i compile , i have always this error message
    Code:
    :\Edruino\Temp\sketch\USB_REC.cpp.o:(.data.VolToPart+0x0): multiple definition of `VolToPart'
    
    C:\Edruino\Temp\sketch\Test_USB_Teensy_lib.ino.cpp.o:(.data.VolToPart+0x0): first defined here
    
    c:/program files (x86)/arduino/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/5.4.1/../../../../arm-none-eabi/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions
    
    collect2.exe: error: ld returned 1 exit status
    
    Erreur de compilation pour la carte Teensy 3.6
    After work arround i have find than if i put FF_MULTI_PARTITION to 0 in ffconf.h in µSDFS library the error disappear (but you lost multi partition option).

    Another things. I have try to use those libraries with multi-threading and this seem not working. The time of threading (10ms) seem incompatible with good mount and/or good open file. somebody have experiment this? And find some solutions ?

  13. #313
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,398
    Quote Originally Posted by BOBILLIER View Post
    After work arround i have find than if i put FF_MULTI_PARTITION to 0 in ffconf.h in µSDFS library the error disappear (but you lost multi partition option).
    did you try method in
    https://forum.pjrc.com/threads/55821...l=1#post207424 ?

  14. #314
    Senior Member
    Join Date
    Aug 2017
    Posts
    147
    @defragster,

    Quote Originally Posted by defragster View Post
    Too late to check for updated source - but using TD_1.47 and what I have that compiles I am seeing this error on SD cards in a USB Adaoter:
    Code:

    Test logger_RawRead
    uSDFS_VER:30_Jun_19_07_17
    BUFFSIZE :8192
    Dev Type :2:/
    CSW Tag Error: 253

    I have not seen this before? Time for Zzzz's here but tried to compile this using updated TyComm from my SubLime editor with https://github.com/Defragster/Tset that is working on T4 with TD 1.47 otherwise.
    I duplicated the error on my USB card reader. Now have to figure out what I did wrong with the latest update. Funny thing is that I can't get the USB card reader to power up using logger_rawWrite.ino.
    It only powers up with my own programs and gives me the CSW tag error. Sigh, back to the drawing board!

  15. #315
    Junior Member
    Join Date
    Jun 2016
    Location
    Rennes France
    Posts
    18
    Hi. I progress in my work and i actually experiment a sketch who append datas every second in a file. All seem ok during ~2H, but finally the record crash and the process stay lock in open (and/or write)file process .
    I have few time experiment same crash during my tests
    My question is: is-there internal timeout in those libraries to avoid to stay lock ? if no i consider using https://github.com/adafruit/Adafruit_SleepyDog , but it's a bit a strong reset..

  16. #316
    Junior Member
    Join Date
    Jun 2016
    Location
    Rennes France
    Posts
    18
    Finally after few investigations, crashs seem coming from a poor USB power supply. But my question about timeout to avoid to stay locked during open and/or write operations, is always open..

  17. #317
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,068
    Quote Originally Posted by BOBILLIER View Post
    Finally after few investigations, crashs seem coming from a poor USB power supply. But my question about timeout to avoid to stay locked during open and/or write operations, is always open..
    What is the USB 'data' device? When I did my testing - unless just a USB flash adapter - I put the disk on a powered HUB to make sure it had clean full power - requires lines for USBHub in post #308. In fact I got one HUB/Drive box that gave 3 USB ports and internally put the HDD/SSD on another USB device port and was powered by Wall Wart.

    @BOBILLIER - what are you using for " libraries with multi-threading and this seem not working. The time of threading (10ms " … Is this TeensyThreads? I've not seen during this recent work (mostly in conjunction with Teensy 4.0 Beta) that anyone tried any threading - as TeensyThreads just started working with T4.

  18. #318
    Senior Member
    Join Date
    Aug 2017
    Posts
    147
    @defragster - figured out why the SD card reader was not working. I MESSED UP AGAIN

    In my efforts to do better error checking I created msProcessError() and used that to process any CSW errors after sending a CBW. Another problem was for some reason I had commented out the
    do..while() loop in WaitMediaReady() function which I un-commented. I moved msProcessErroer() to MassStorgageHost.cpp and will play with it there.
    After these changes logger_RawWrite.ino was working again with my USB SD card reader.
    I updated MSC on github.

    @all
    If you do a git pull on MSC make sure you back up MSC on your computers.

    @kurte
    Your version of MSC has the do..while() loop commented out as well. I will probably fail as well when trying to read a USB SD card reader.

    Sorry for the confusion.

  19. #319
    Senior Member
    Join Date
    Aug 2017
    Posts
    147
    @defragster - Today I believe I have the problem with the SD flash card reader fixed. I have working with both the T3.6 and the T4. All other types of USB drives I have are also still working.
    I pushed the changes today. If you have the time please check it out.
    The link again:
    https://github.com/wwatson4506/MSC

    EDIT: And anybody else that was having problems.
    Last edited by wwatson; 08-31-2019 at 11:29 PM.

  20. #320
    Senior Member
    Join Date
    Aug 2016
    Posts
    132
    Quote Originally Posted by wwatson View Post
    @defragster - Today I believe I have the problem with the SD flash card reader fixed. I have working with both the T3.6 and the T4. All other types of USB drives I have are also still working.
    I pushed the changes today. If you have the time please check it out.
    The link again:
    https://github.com/wwatson4506/MSC

    EDIT: And anybody else that was having problems.
    I just tried to compile the test_diskio.ino sketch, and it errors out with the following
    Code:
    Arduino: 1.8.9 (Windows 10), TD: 1.47-beta7, Board: "Teensy 4.0, Serial, Faster, US English"
    
    D:\Arduino\arduino-builder -dump-prefs -logger=machine -hardware D:\Arduino\hardware -hardware C:\Users\admin\AppData\Local\Arduino15\packages -tools D:\Arduino\tools-builder -tools D:\Arduino\hardware\tools\avr -tools C:\Users\admin\AppData\Local\Arduino15\packages -built-in-libraries D:\Arduino\libraries -libraries C:\Users\admin\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,opt=o2std,keys=en-us -ide-version=10809 -build-path C:\Users\admin\AppData\Local\Temp\arduino_build_535115 -warnings=none -build-cache C:\Users\admin\AppData\Local\Temp\arduino_cache_941518 -verbose C:\Users\admin\Documents\Arduino\libraries\uSDFS\examples\test_diskio\test_diskio.ino
    D:\Arduino\arduino-builder -compile -logger=machine -hardware D:\Arduino\hardware -hardware C:\Users\admin\AppData\Local\Arduino15\packages -tools D:\Arduino\tools-builder -tools D:\Arduino\hardware\tools\avr -tools C:\Users\admin\AppData\Local\Arduino15\packages -built-in-libraries D:\Arduino\libraries -libraries C:\Users\admin\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,opt=o2std,keys=en-us -ide-version=10809 -build-path C:\Users\admin\AppData\Local\Temp\arduino_build_535115 -warnings=none -build-cache C:\Users\admin\AppData\Local\Temp\arduino_cache_941518 -verbose C:\Users\admin\Documents\Arduino\libraries\uSDFS\examples\test_diskio\test_diskio.ino
    Using board 'teensy40' from platform in folder: D:\Arduino\hardware\teensy\avr
    Using core 'teensy4' from platform in folder: D:\Arduino\hardware\teensy\avr
    Detecting libraries used...
    "D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy4" "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino_build_535115\\sketch\\test_diskio.ino.cpp" -o nul
    C:\Users\admin\Documents\Arduino\libraries\uSDFS\examples\test_diskio\test_diskio.ino:5:23: fatal error: sd_config.h: No such file or directory
    
    compilation terminated.
    
    Error compiling for board Teensy 4.0.
    I think I didnt install something required maybe, the uSDFS_test compiles fine. haven't run it yet. but it does compile the test does not.

  21. #321
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,068
    Quote Originally Posted by wwatson View Post
    @defragster - Today I believe I have the problem with the SD flash card reader fixed. I have working with both the T3.6 and the T4. All other types of USB drives I have are also still working.
    I pushed the changes today. If you have the time please check it out.
    The link again:
    https://github.com/wwatson4506/MSC

    EDIT: And anybody else that was having problems.
    Thanks for the link! Got there and new ZIP and overwrote the old MSC - compiled " logger_RawWrite.ino " - ran on SD on USB Flash and No Errors! And Paul got the progress Dots printing right in t_SerMon as well!

    NOTE: md SD card #1 ran 4.8 to 6.4 MB/sec and SD card #2 … that I thought was bad and marked it - fails without notice - though it worked as SDIO the other day - it also quietly fails now.

    And SD card #1 on SDIO all 6.1 to 6.9 MB/sec

  22. #322
    Senior Member
    Join Date
    Aug 2017
    Posts
    147
    @firehopper - I was able to duplicate the error with test_diskio.ino as well on the T4. It works fine with the T3.6 but fails with the T4.I will check it out. Might be something to do with the versions of
    uSDFS I have on both computers. I have been working the T3.6 on one computer and the T4 on another. Maybe out of sync with uSDFS versions.

    Got a birthday party for one of the grandkids tonight that I have to cook for so I will look at it in the morning.
    @defragster - I actually did not test SDIO. I will check it tomorrow.

    Thanks for testing guys

    EDIT: @defragster - I do not know how you are getting the write speeds you are getting. The best I can get is 1.4MB/s on SDIO and 1.05MB/s on the USB Sd card reader. Maybe it's the SD cards I have.
    Last edited by wwatson; 09-01-2019 at 02:13 AM.

  23. #323
    Senior Member
    Join Date
    Aug 2017
    Posts
    147
    @firehopper

    I just tried to compile the test_diskio.ino sketch, and it errors out with the following
    Code:

    Arduino: 1.8.9 (Windows 10), TD: 1.47-beta7, Board: "Teensy 4.0, Serial, Faster, US English"

    D:\Arduino\arduino-builder -dump-prefs -logger=machine -hardware D:\Arduino\hardware -hardware C:\Users\admin\AppData\Local\Arduino15\packages -tools D:\Arduino\tools-builder -tools D:\Arduino\hardware\tools\avr -tools C:\Users\admin\AppData\Local\Arduino15\packages -built-in-libraries D:\Arduino\libraries -libraries C:\Users\admin\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,opt=o2std,keys =en-us -ide-version=10809 -build-path C:\Users\admin\AppData\Local\Temp\arduino_build_53 5115 -warnings=none -build-cache C:\Users\admin\AppData\Local\Temp\arduino_cache_94 1518 -verbose C:\Users\admin\Documents\Arduino\libraries\uSDFS\e xamples\test_diskio\test_diskio.ino
    D:\Arduino\arduino-builder -compile -logger=machine -hardware D:\Arduino\hardware -hardware C:\Users\admin\AppData\Local\Arduino15\packages -tools D:\Arduino\tools-builder -tools D:\Arduino\hardware\tools\avr -tools C:\Users\admin\AppData\Local\Arduino15\packages -built-in-libraries D:\Arduino\libraries -libraries C:\Users\admin\Documents\Arduino\libraries -fqbn=teensy:avr:teensy40:usb=serial,opt=o2std,keys =en-us -ide-version=10809 -build-path C:\Users\admin\AppData\Local\Temp\arduino_build_53 5115 -warnings=none -build-cache C:\Users\admin\AppData\Local\Temp\arduino_cache_94 1518 -verbose C:\Users\admin\Documents\Arduino\libraries\uSDFS\e xamples\test_diskio\test_diskio.ino
    Using board 'teensy40' from platform in folder: D:\Arduino\hardware\teensy\avr
    Using core 'teensy4' from platform in folder: D:\Arduino\hardware\teensy\avr
    Detecting libraries used...
    "D:\\Arduino\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-g++" -E -CC -x c++ -w -g -Wall -ffunction-sections -fdata-sections -nostdlib -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=147 -DARDUINO=10809 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH "-ID:\\Arduino\\hardware\\teensy\\avr\\cores\\teensy 4" "C:\\Users\\admin\\AppData\\Local\\Temp\\arduino_b uild_535115\\sketch\\test_diskio.ino.cpp" -o nul
    C:\Users\admin\Documents\Arduino\libraries\uSDFS\e xamples\test_diskio\test_diskio.ino:5:23: fatal error: sd_config.h: No such file or directory

    compilation terminated.

    Error compiling for board Teensy 4.0.

    I think I didnt install something required maybe, the uSDFS_test compiles fine. haven't run it yet. but it does compile the test does not.
    It was to different versions of uSDFS that was causing my failure test_diskio.ino. I upgraded both computers to the latest version and both the T4 and T3.6 ran the sketch ok.

    Hope that helps.
    Last edited by wwatson; 09-01-2019 at 08:00 PM. Reason: Wrong tags

  24. #324
    Junior Member
    Join Date
    Jun 2016
    Location
    Rennes France
    Posts
    18
    Quote Originally Posted by defragster View Post
    What is the USB 'data' device? When I did my testing - unless just a USB flash adapter - I put the disk on a powered HUB to make sure it had clean full power - requires lines for USBHub in post #308. In fact I got one HUB/Drive box that gave 3 USB ports and internally put the HDD/SSD on another USB device port and was powered by Wall Wart.
    I just use one simple USB Key with 16GB directly connect to USB Port (this who place on the top of T3.6 circuit). But like I have powered T3.6 with only 5V, i lost some power through LP38691 circuit. Finally, i just obtain 4.6V for my USB key. I solve this by powering key directly through 5V power supply.
    Quote Originally Posted by defragster View Post
    @BOBILLIER - what are you using for " libraries with multi-threading and this seem not working. The time of threading (10ms " … Is this TeensyThreads? I've not seen during this recent work (mostly in conjunction with Teensy 4.0 Beta) that anyone tried any threading - as TeensyThreads just started working with T4.
    Yes i'm using TeensyThreads library. the 10ms come from the information i have find in the read-me https://github.com/ftrias/TeensyThre...ster/readme.md in "Change" paragraph. I have don't test it to verify if 10ms is true.
    To solve my problem with write multi-threading, i have place the open-write-close action to USB Key in the loop() (not in one thread) and just before do it, i lock threading mechanism with one threading.stop() and a threading.start(-1) just after. Like i just save my data every second and like write to key (take between 16 and 40ms) , my threading process isn't very perturbed. And now, all seem working correctly.

    wwatson, thank for your library upgrade. But i have test it for my Unmount - mount action and i have always the same problem. I can unmount correctly , but if i try to mount my key again, nothing arrive and T3.6 stay lock. (i have test with and without unplug-plug key action). Do you plan to solve this ? Thanks

  25. #325
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,068
    Quote Originally Posted by wwatson View Post


    Thanks for testing guys

    EDIT: @defragster - I do not know how you are getting the write speeds you are getting. The best I can get is 1.4MB/s on SDIO and 1.05MB/s on the USB Sd card reader. Maybe it's the SD cards I have.
    Thanks for seeing through making it usable!

    I am using the SanDisk Ultra - a 32GB micro SDHC card. Seems that is what PJRC.com noted as good on the SD related page - brand makes a difference - and some are 'misbranded' it seems at times. But one seems dead now - and I tossed another cheapo out sometime during T4 Beta as well? I have new ones of some brand - not sure these were new just ones I had around open with no current purpose from old phones or something. Other than that this was the stock example from current downloads. For HDD's and other testing I had played some with alternate buffer sizes - but this was fresh from github.

    @BOBILLIER - okay - simple FLASH cards work okay. But nothing HDD or even SSD would work without being on a powered HUB - so I wondered. And working from hub requires that 'HUB' code as noted then it can chain USB to get to a device on a HUB 'transparently'.

    TeensyThreads seems nice - I just looked at it for Teensy 4 and learned the loop() is just thread 0 - not sure if it is treated like all other threads. I left a question I didn't see an answer to about that - and I didn't get back to it after I looked a bit. I did suggest a perf 'cycles per thread' used tracker for debug that got put in - I hacked up a slightly diff implementation that made more sense to me but didn't see any reaction to that yet. Using that it looked like in the sample I wrote 10% of the T_4 was consumed in the thread switching - mainly because my threads did very little and then did a .yield() so the switch rate was extreme.

    @wwatson - seems I asked a while back about async calls to move data? THough not sure that would help TeensyThreads taskswitch any better unless it was running with DMA?

Posting Permissions

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