Forum Rule: Always post complete source code & details to reproduce any issue!
Page 50 of 53 FirstFirst ... 40 48 49 50 51 52 ... LastLast
Results 1,226 to 1,250 of 1304

Thread: Teensyduino File System Integration, including MTP and MSC

  1. #1226
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,523
    The Cache write stuff looks ok: I am doing an output each time we do a write to Cache:
    >> cache write: 3 3 2 6144

    So wrote cache 3 which was also block three to file

    Then: cache write: 2 5 3 10240
    So writing out cache block 2 which is physical block 5, and the > block we have output in the past was 3.
    So the extend message is letting me know it then should have output block (buffer?) Block 4 first and then it outputs block 5

    Hope that makes sense... Maybe I should have put in another debug message for each block that was output to fill in the gaps

    Edit: Sorry as I mentioned I left on lots of debug output...
    Will probably turn those off soon.

  2. #1227
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,229
    Test #2 - moved MTP.begin to after setting up the file systems and had 1 inaccuarate file transfer

    Click image for larger version. 

Name:	Capture.PNG 
Views:	4 
Size:	49.4 KB 
ID:	28419

  3. #1228
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    Quick NOTE: Repeated w/MakeFiles >> Empty SD card ('W'ipe files), CP_HDD_USB copy to T_4.1_MTP. all files (1_Primes, 't', 'b') copied 2min 9 sec, 'v'erify on T_4.1 GOOD on all 'checked' files. Return SD to PC and compare to HDD source GOOD, ScanDisk Clean (no FOUND.000), CodeCompare HDD to SD GOOD.
    > not sure why the prior p#122 "105.txt" got Zero size ...

    Quote Originally Posted by KurtE View Post
    I am sort of confused here..

    You show the old style of the error messages: $$$ Failed to read Index record: 8 bytes Read: 0


    The code that shows read failure:
    Code:
    		uint64_t seek_pos = block_index * sizeof(RecordBlock);
    		bool seek_ok = index_.seek(seek_pos, SeekSet);
    		if (!seek_ok) {
    			MTP_class::PrintStream()->printf(F("$$$ Failed to seek for read Index record: %u addr:%llu Cur: %llu\n"), 
    				recordBlocksInfo_[biIndex].block_index, seek_pos, index_.position());
    		}
    		size_t bytes_read = index_.read((char *)&recordBlocks_[biIndex], sizeof(RecordBlock));
    		if (!seek_ok || (bytes_read != sizeof(RecordBlock))) {
    			MTP_class::PrintStream()->printf(F("$$$ Failed to read Index record: %u seek:%u bytes Read: %u\n"), block_index, seek_ok, bytes_read);
    		}
    So your output is not showing the seek: value...
    Kurt, those were the only 'unique' lines among the other spew having the $$$ start chars.
    Maybe it wasn't current, but if that not an issue - then nothing else showed.

  4. #1229
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,229
    Quote Originally Posted by KurtE View Post
    The Cache write stuff looks ok: I am doing an output each time we do a write to Cache:
    >> cache write: 3 3 2 6144

    So wrote cache 3 which was also block three to file

    Then: cache write: 2 5 3 10240
    So writing out cache block 2 which is physical block 5, and the > block we have output in the past was 3.
    So the extend message is letting me know it then should have output block (buffer?) Block 4 first and then it outputs block 5

    Hope that makes sense... Maybe I should have put in another debug message for each block that was output to fill in the gaps

    Edit: Sorry as I mentioned I left on lots of debug output...
    Will probably turn those off soon.
    Didn't really think it was an issue, was just documenting what I was seeing . I did rerun the Makefiles comparison test.

    1. Reformatted the SDCard.
    2. Ran Makefiles with the 't' and 'v' option - all good
    3. Copied files to PC Directory
    4. Removed SD Card from T4.1 and put it into the PC
    5. Did a code compare between SD Card and Directory on PC:
    NO DIFFERENCES FOUND! between sd card and what was copied.

    This is using Tim's sketch with just MTP.begin after storage configured.

  5. #1230
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,523
    Quote Originally Posted by mjs513 View Post
    NO DIFFERENCES FOUND! between sd card and what was copied.

    This is using Tim's sketch with just MTP.begin after storage configured.


    I just pushed up the changes after a little cleanup. That is I did a few things like remove trailing blanks from lines.
    Also I set DEBUG back to 0 and then updated the code such that only errors would print out by default

    So it won't print the new records... Unless DEBUG....

    I did the full copy again of the generated SDCard and it completed with no messages.

  6. #1231
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    Got update to MTP_Storage.cpp : Not back at it for another couple hours.

    reminder: The MakeFiles.ino sketch has the 'v'erify for files it makes for testing on non-removable media.
    > should be able to create desired: number of files, and DIR depth, file size of known content
    > verify they are created and stored right
    > then MTP copied to host for storage
    > "W"iped from local T_4.1 storage
    > then copied back to T_4.1 storage with MTP
    > 'v'erify should show those files as Good or otherwise

    Example output on a GOOD and BAD folder:
    Code:
            
    D0.7 /                                        
    2048_390.txt	XXXX	 File name Size 2048 MISMATCH != size of 2017:            removed file data before copy
    	  DONE RESULTS BAD HERE  	XXX 'b XX	  MISSING 1 FILE(S)        Removed this file before copy
     2 File Error(s)  
    	 with 6 files of Size 12257 Bytes	4.205872 ms
            
    D0.8 /                                                                    
    DONE RESULTS GOOD HERE 8 Files(s)	 with 8 files of Size 12000 Bytes	5.388092 ms
        
    Total 14 files of Size 24257 Bytes	 Verify Errors 2	11.333312 msec
    Bytes Used: 2490368, Bytes Total:125062610944
    
    ----	Task 'v' complete!	----
    Other LFS data can also "C"opy to SD when USE_SDIO_SD commented out, assume this still works. To allow data written to LFS to be pulled off to do COMPARE on PC via SD card.
    Custom 'u'ser data set specific to LFS media
    Other options:
    Code:
    Menu Options:
    	t - Test Files write 2204
    	b - Test Files write BIG
    	s - Test Files write small
    	u - Test Files write USER edit      change code at: case 'u': // USER
    	n - Test ASCII and UTF8 Filenames
    	v - Verify Files
    	l - List files on media
    
    	R - Restart Teensy
    	U - USB reset
    	W - Remove ALL media content
    	C - Copy LFS media content to SD

  7. #1232
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    Made edits to github.com/Defragster/T4LockBeta/tree/main/MakeFiles

    > added #define && #ifdef options for LFS:
    Code:
    //#define USE_SDIO_SD
    //#define USE_PSRAM
    #define TEST_QSPI // Typical NOR FLASH
    //#define TEST_QSPI_NAND // NAND Flash
    Also tested "C"opy of LFS drive to SD Card to work.
    > Filling selected LFS drive will create a new unique Folder on SD card of the DIR/FILE content
    {had a too small char string path buffer now fixed}

    Put USE of LFS_PROG for mtpindex under #ifdef

  8. #1233
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,229
    @wwatson - @KurtE - @defragster
    Decided to have a little fun with MTP/MSC/USBHost so I picked up a M.2 SATA 500GB card and used a M.2 SSD adapter to USB:
    https://www.amazon.com/gp/product/B0...0?ie=UTF8&th=1 and https://www.amazon.com/gp/product/B0...0?ie=UTF8&th=1

    Formatted in PC as GPT and 1exFAT volume. Plugged it into a USB 3 hub and attached that to the T4.1 and guess what it worked:
    Code:
    Storage Index 3 Name: MSC0-��H8��Gs�$Vą Selected
    
     Space Used = 932970496
    Filesystem Size = 500022902784
    Directory
    ---------
    New folder (8)/
      2001/
        calculations.wav                  426300
        completed.wav                     276460
        dangerous_to_remain.wav           372892
        enough_info.wav                   513388
        functional.wav                    237356
        one_moment.wav                    202236
        operational.wav                   772140
        sorry_dave.wav                    791164
        stop.wav                          200844
      Audacity/
        Away_in_a_Manger.mp3              2014737
        Dont_Rain_on_My_Parade.mp3        3944449
        Take_My_Breathe_Away.mp3          5740819
        Welcome_Christmas.mp3             2985790
      Dont Rain on My Parade.mp3          3944449
      FLAC/
        T1_1024.FLA                       9802802
        T1_128.FLA                        11126659
        T1_256.FLA                        10415954
        T1_512.FLA                        10007370
      GIF/
        2001Station.gif                   4155497
        2001_.wav                         8130604
        giphy.gif                         3057429
        Hubble_small.gif                  563816
        ISS_small.gif                     3757080
        jwst_full.gif                     1832311
        jwst_small.gif                    1959082
        martian2.gif                      3168322
        Martian_cart.gif                  2093083
        Odessy.gif                        2025535
        teacup.gif                        57868
      JWST-SideView.jpg                   4810864
      mtpindex.dat                        0
      odd1.mp3                            46888
      odd1.wav                            553004
      PictureViewOptions.ini              57
      propshield_pinout.png               186124
      R.jpg                               30256
      SDTEST1.raw                         8393684
      servonum.jpg                        158936
      Shaya.png                           200265
      testImage.png                       27111
      testImage2.jpg                      54248
      testImage2.png                      23065
      testimg.png                         1089
      Untitled6.jpg                       254222
      zarathustra.mp3                     489461
    Transferring that directory did take a while so probably will have to do a few more tests and maybe partition it. But it is possible and it does work!

  9. #1234
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,523
    Looks great. I don't have any that size... The biggest one I have tried with are the 256gb.

  10. #1235
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    720
    @Paul @KurtE @mjs513 - Spent a couple of hours converting DiskIOV3 to the new USBHost_T36 library. Only took a couple of hours This was using KurtE's latest branch so I could test with multiple partitions. Everything seems to be working well:
    Code:
    DiskIOMB
    
    The original version of microBox found here:
     http://sebastian-duell.de/en/microbox/index.html
    
    Initializing, please wait...
    
    Type 'help' for a list of commands...
    
    root@Teensy:/16GEXFATP1>ld
    
    Found 10 logical drives.
    
    Logical Drive Information For Attached Drives
    Logical Drive #:  4: | Volume Label:  16GEXFATP1 | valid: 1 | Drive Type: USB
    Logical Drive #:  5: | Volume Label:  16GFAT32P2 | valid: 1 | Drive Type: USB
    Logical Drive #:  6: | Volume Label:   128GFAT32 | valid: 1 | Drive Type: USB
    Logical Drive #: 20: | Volume Label:        SDIO | valid: 1 | Drive Type: SDHC/SDXC
    Logical Drive #: 24: | Volume Label:       SDSPI | valid: 1 | Drive Type: SDHC/SDXC
    Logical Drive #: 28: | Volume Label:     QPINAND | valid: 1 | Drive Type: LFS
    Logical Drive #: 30: | Volume Label:   SPIFLASH5 | valid: 1 | Drive Type: LFS
    Logical Drive #: 31: | Volume Label:   SPIFLASH6 | valid: 1 | Drive Type: LFS
    Logical Drive #: 32: | Volume Label:    SPINAND3 | valid: 1 | Drive Type: LFS
    Logical Drive #: 33: | Volume Label:    SPINAND4 | valid: 1 | Drive Type: LFS
    10 Logical Drives Found
    Default Logical Drive: /16GEXFATP1/ (4:)
    root@Teensy:/16GEXFATP1>ls
    Volume Label: 16GEXFATP1
    Full Path: /16GEXFATP1
    32MEGfile.dat                             32768000     (null) 169 1900 00:221:217
    armaged.wav                               56862764     (null) 169 1900 00:221:217
    ThePaperboysMolinos.wav                   35638654     (null) 169 1900 00:221:217
    ThePaperboysMolinosI'veJustSeenaFace.wav  36380570     (null) 169 1900 00:221:217
    StatusQuoWhateverYouWant.wav              60148386     (null) 169 1900 00:221:217
    YoureLazyJimmyBarnesJoeBonamassa.wav     102878370     (null) 169 1900 00:221:217
    DeffLepardAnimal.wav                      43025216     (null) 169 1900 00:221:217
    SDTEST1.WAV                               16787550     (null) 169 1900 00:221:217
    SDTEST2.WAV                               16425698     (null) 169 1900 00:221:217
    SDTEST3.WAV                               13617358     (null) 169 1900 00:221:217
    SDTEST4.WAV                               17173152     (null) 169 1900 00:221:217
    test1.txt                                       53     (null) 169 1900 00:221:217
    Free Space: 7301201920
    root@Teensy:/16GEXFATP1>
    CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyACM0
    The only thing that is not working is playing music files. I am working on that now. I am sure I have not got all of the libraries needed setup correctly.

    One thing that i did notice when I was compiling was this warning have to do with the Audio library:
    Code:
    /home/wwatson/arduino-1.8.19/hardware/teensy/../tools/arm/bin/arm-none-eabi-g++ -c -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -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=157 -DARDUINO=10819 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -I/tmp/arduino_build_808623/pch -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/cores/teensy4 -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/USBHost_t36-fs_integration_part2 -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SdFat/src -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SPI -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SD/src -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/SerialFlash -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Wire -I/home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio/utility /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio/output_spdif.cpp -o /tmp/arduino_build_808623/libraries/Audio/output_spdif.cpp.o
    /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio/output_pwm.cpp: In static member function 'static void AudioOutputPWM::isr()':
    /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio/output_pwm.cpp:370:29: warning: invalid conversion from 'volatile audio_block_t* {aka volatile audio_block_struct*}' to 'audio_block_t* {aka audio_block_struct*}' [-fpermissive]
       AudioStream::release(block);
                                 ^
    In file included from /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio/output_pwm.h:31:0,
                     from /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio/output_pwm.cpp:28:
    /home/wwatson/arduino-1.8.19/hardware/teensy/avr/cores/teensy4/AudioStream.h:154:14: note:   initializing argument 1 of 'static void AudioStream::release(audio_block_t*)'
      static void release(audio_block_t * block);
                  ^
    /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio/output_pwm.cpp: In member function 'virtual void AudioOutputPWM::update()':
    /home/wwatson/arduino-1.8.19/hardware/teensy/avr/libraries/Audio/output_pwm.cpp:402:12: warning: invalid conversion from 'volatile audio_block_t* {aka volatile audio_block_struct*}' to 'audio_block_t* {aka audio_block_struct*}' [-fpermissive]
      old_block = block ;
    I am using Arduino 1.8.19 and TD1.57B1. Did not see any issues or PR's for it. It cropped up when testing WaveFilePlayerUSB.ino.

    As KurtE would say "Now back to playing..."

  11. #1236
    Junior Member
    Join Date
    May 2022
    Posts
    18
    Hi
    Thanks for the MTP library
    I have a teensy 4.1 and the MTP is working fine on it, I am able to log data to the Teensy SD card and can also see the data in the SD card through file explorer on my PC
    however once I open the SD card file or directory on my PC, the files no longer get updated even though the Teensy is logging data to the SD card. If I restart the teensy then I can see all the extra logs that wasn't showing before the restart and this cycle continues. So every time a new data in logged to the SD card, I have to restart the Teensy to be able to see the changes through MTP.
    Is there a solution for this?
    Thanks

  12. #1237
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,523
    @Maher - yes you are right that there is currently no automatically defined mechanism for the MTP code base to know when the file system changes.

    This is something we have talked about and at some point, hopefully reasonably soon we will have at least a partial solution.

    We do have some brute force methods, slightly short of having to reboot the teensy, that can be done.

    If you look at some of the examples, we have a simple keyboard interface, and in several of them you will see, a command like:

    Code:
          case 'r':
            Serial.println("Send Device Reset Event");
            MTP.send_DeviceResetEvent();
            break;
    And when MTP sees a device reset event, it starts up a new session, and when we see a new session setup, we then clear out or old cache of data and start fresh. Which if your directory then gets reenumerated it should then get the new data.

    There was/is code at some point that we had that the app could say some file X has changed/created and it would then if necessary send an event to the MTP host to say something was added or changed.... (If the directory with the files) had not been previously enumerated, then it does nothing.

    Again hopefully we will flesh out more of this level of notifications

  13. #1238
    Junior Member
    Join Date
    May 2022
    Posts
    18
    Hi Kurt, thanks for reply!
    I'll try out this brute force method
    thanks again

  14. #1239
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,449
    Quote Originally Posted by Maher View Post
    Hi Kurt, thanks for reply!
    I'll try out this brute force method
    thanks again
    The reason for this implementation is that in MTP the PC is the master and it can do what it wants. For example, PC does not need to refresh directories, and Windows behaves differently than Linux. Teensy responds mainly to commands, but it could send also events, that is what we implemented. But Teensy cannot enquire, which events the PC accepts. So I would not call it brute force, but implemented according to specs.
    Apart from Semantics, the indirect refresh method works here since I have implemented it.

  15. #1240
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    720
    @All - With the recent changes to USBHost_t36 and being close to complete I decided to revisit TeensyEXT4. I went through it again and finally have it working with the T4.1

    Here is some output:
    Code:
    Teensy EXT4 file system testing
    
    open_blockdev: Passed
    ext4_mbr_scan:
    mbr_entry 0:
     offeset: 0x100000, 1MB
     size:    0x39a200000, 14754MB
    mbr_entry 1:
            empty/unknown
    mbr_entry 2:
            empty/unknown
    mbr_entry 3:
            empty/unknown
    mbr_scan() Passed
    
    test_lwext4_mount() Passed
    
    
    cleanup:
    remove /mp/test1
    remove /mp/dir1
    cleanup: time: 0 ms
    ********************
    ext4_mount_point_stats
    inodes_count = 944704
    free_inodes_count = 944692
    blocks_count = 3777024
    free_blocks_count = 3692117
    block_size = 4096
    block_group_count = 116
    blocks_per_group= 32768
    inodes_per_group = 8144
    volume_name = TEENSYEXT4
    ********************
    ls /mp/
    ext4_dir_open(): Passed
      .
      [dir] .
      ..
      [dir] ..
      lost+found
      [dir] lost+found
      mp
      [dir] mp
    test_lwext4_dir_test: 0
    directory create: /mp/dir1/
    add files to: /mp/dir1/
    ls /mp/
    ext4_dir_open(): Passed
      .
      [dir] .
      ..
      [dir] ..
      lost+found
      [dir] lost+found
      dir1
      [dir] dir1
      mp
      [dir] mp
    test_lwext4_dir_test: time: 2 ms
    test_lwext4_dir_test: av: 2 ms/entry
    file_test:
      rw size: 8192
      rw count: 10
    ext4_write: 8192 * 10 ...
      write time: 17 ms
      write speed: 4444 KB/s
    ext4_read: 8192 * 10 ...
      read time: 9 ms
      read speed: 8000 KB/s
    ls /mp/
    ext4_dir_open(): Passed
      .
      [dir] .
      ..
      [dir] ..
      lost+found
      [dir] lost+found
      dir1
      [dir] dir1
      mp
      [dir] mp
      hello.txt
      [fil] hello.txt
      test1
      [fil] test1
    ********************
    ext4_mount_point_stats
    inodes_count = 944704
    free_inodes_count = 944689
    blocks_count = 3777024
    free_blocks_count = 3692094
    block_size = 4096
    block_group_count = 116
    blocks_per_group= 32768
    inodes_per_group = 8144
    volume_name = TEENSYEXT4
    ********************
    
    cleanup:
    remove /mp/test1
    remove /mp/dir1
    cleanup: time: 0 ms
    ********************
    ext4_mount_point_stats
    inodes_count = 944704
    free_inodes_count = 944692
    blocks_count = 3777024
    free_blocks_count = 3692117
    block_size = 4096
    block_group_count = 116
    blocks_per_group= 32768
    inodes_per_group = 8144
    volume_name = TEENSYEXT4
    ********************
    ********************
    ext4 blockdev stats
    bdev->bread_ctr = 18
    bdev->bwrite_ctr = 12
    bcache->ref_blocks = 7
    bcache->max_ref_blocks = 7
    bcache->lru_ctr = 250
    
    ********************
    Done...
    This version of lwext4 does not use a virtual image file. It uses a real block device formatted as ext4. There is still a lot of restructuring and testing to do such as finding out why journaling is not working. I did a lot of hacking on the source files so I need to go through all of them to make sure they are complete. The testing was done on a 16G thumb drive formatted to ext4.

    Once I have it somewhat cleaned up I'll push it up to GitHub.

  16. #1241
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,229
    @wwatson
    Thats great news - could definitely use something like that now I am using a PI4 - especially for recovery purposes

  17. #1242
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,523
    I second what @mjs513 said. Will be fun to play with it

  18. #1243
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    720
    @KurtE, @mjs513 - I am getting close to pushing it up to GitHub. Just got finished testing multiple partitions and it's working I am still learning about ext4 and the way Linux uses it. It is interesting. I finally understand how block and character devices are treated as file objects (device files). The next step is setting a block device instance for SD cards with ext4 formatting.

    Tomorrow I'll push it up...

  19. #1244
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    720

    Smile TeensyEXT4 is working finally

    @All - I have pushed up the latest working version of TeensyEXT4 and updated the README.md file.

    Here:
    https://github.com/wwatson4506/TeensyEXT4

    A few notes on this library.

    1) It is a mix of C and C++. Most of the library was written in C++ so it is riddled with printf() statements. Because of that I needed to do an override of _write().
    Code:
    extern "C" {
    __attribute__((weak)) 
    int _write(int file, char *ptr, int len)
    {
    	int i;
    	for(i = 0; i < len; i++)
    	{
    		usb_serial_putchar(*(ptr+i));
    		if (*(ptr+i) == '\n')
    			usb_serial_putchar('\r');
       }
    	usb_serial_flush_output();
    	return len;
    }
    2) Need to figure out the best place to put the USBHost declarations. Right now they are in 'usb_bd.cpp' :
    Code:
    // Setup USBHost_t36 and as many HUB ports as needed.
    USBHost myusb;
    USBHub hub1(myusb);
    USBHub hub2(myusb);
    USBHub hub3(myusb);
    USBHub hub4(myusb);
    
    // Instances for the number of USB drives you are using.
    USBDrive myDrive1(myusb);
    USBDrive myDrive2(myusb);
    And that requires:
    Code:
    // TODO: This needs to change.
    extern 	USBHost myusb;
    
    ...
    
     myusb.begin();
    To be in the sketch. Maybe some advice on this

    3) I noticed that the read/write speeds were faster than what I normally see:
    Code:
    file_test:
      rw size: 32768
      rw count: 1000
    ext4_write: 32768 * 1000 ...
      write time: 4375 ms
      write speed: 7312 KB/s
    ext4_read: 32768 * 1000 ...
      read time: 1752 ms
      read speed: 18254 KB/s
    This was using my slowest 16G thumb drive writing and reading a 32Mb file. Possibly due to the way lwext4 caches reads and writes? Not sure...

    4) Tested usage of multiple partitions. lwext4 handles it ok. Just need to make sure each partition has a different mount point name. Let's say '/mp/' and 'mp1' for two partitions. So during mounting, directory and file operations you would use the appropriate mount point.
    Mounting the partitions will look like this:
    Code:
      if (!test_lwext4_mount(&bdevs.partitions[0], bc))
    	Serial.printf("test_lwext4_mount() Failed\n");
      else
    	Serial.printf("test_lwext4_mount() Passed\n\n");
    For first partition. Or:
    Code:
      if (!test_lwext4_mount(&bdevs.partitions[1], bc))
    	Serial.printf("test_lwext4_mount() Failed\n");
      else
    	Serial.printf("test_lwext4_mount() Passed\n\n");
    For second partition.

    Next step is setting up usage of lwext4 on SD cards. There is still a lot of work to be done with this and a lot to learn. I am open to any and all advice/help I can get from the experts

    WIP...

    Playtime now...

  20. #1245
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    720
    Quick update to TeensyEXT4. It now supports SD cards formatted to ext4. To test SD card usage you will need to select one but not both of these lines:

    Code:
      parent_blockdev = ext4_usb_bd_get(); // uncomment for USB drive testing,
    //  Uncomment the line below and comment line above 
    //  to test SDIO card.  
    //  parent_blockdev = ext4_sd_bd_get(); // uncomment for SD card testing,
    Added two files to the src directory:
    'sd_bd.cpp' and 'sd_bd.h'.
    Last edited by wwatson; 06-12-2022 at 06:56 PM. Reason: Typo...

  21. #1246
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,229
    Quote Originally Posted by wwatson View Post
    Quick update to TeensyEXT4. It now supports SD cards formatted to ext4. To test SD card usage you will need to select one but not both of these lines:

    Code:
      parent_blockdev = ext4_usb_bd_get(); // uncomment for USB drive testing,
    //  Uncomment the line below and comment line above 
    //  to test SDIO card.  
    //  parent_blockdev = ext4_sd_bd_get(); // uncomment for SD card testing,
    Added two files to the src directory:
    'sd_bd.cpp' and 'sd_bd.h'.
    Very cool - now another thing to try out


    vERY C

  22. #1247
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    720
    Quote Originally Posted by mjs513 View Post
    Very cool - now another thing to try out


    vERY C
    I guess the next step is creating some sketches use the lwext4 filesystem API starting with a version of listfiles.ino. That is found in ext4.c.

  23. #1248
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    16,008
    Odd Windows doesn't seem to have a way to R/W ext4.
    Search shows some tools to read only or one to converts ext4 partition to Fat32 or NTFS

    So funny that Teensy can do ext4 I/O ... ???

  24. #1249
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,229
    Quote Originally Posted by wwatson View Post
    I guess the next step is creating some sketches use the lwext4 filesystem API starting with a version of listfiles.ino. That is found in ext4.c.
    Thats a good place to start definitely - guess at some point have to incoporate into MTP

    @defragster - yep. I could only find apps to read/copy ext4 files but not write

  25. #1250
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,523
    Quote Originally Posted by defragster View Post
    Odd Windows doesn't seem to have a way to R/W ext4.
    Search shows some tools to read only or one to converts ext4 partition to Fat32 or NTFS

    So funny that Teensy can do ext4 I/O ... ???
    Yep... Next up NTFS?

Posting Permissions

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