Forum Rule: Always post complete source code & details to reproduce any issue!
Page 27 of 39 FirstFirst ... 17 25 26 27 28 29 37 ... LastLast
Results 651 to 675 of 963

Thread: MTP Responder Contribution

  1. #651
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,419
    @mjs513 - Thanks
    Nice the beta6 cores are MTP ready. Now further MTP work from external lib will be easier.

    Yes, manual hardFault inclusion - maybe it will prove useful and get into the next build.

  2. #652
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,190
    @KurtE - @defragster
    Transferring a 32MB file from a 25Q512 created using LFSIntegrity from the Teensy to the PC was no issue. No starts and stops of the transfer noticed either watching the progress meter.

  3. #653
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,206
    Morning all,

    I put some more hacks into my branch: https://github.com/KurtE/MTP_t4/tree...d_object_large

    That fixes some of the issues we were running into yesterday with the larger files not working on some of the SPI chips... Not sure if all of them, but was able to send like 3+mb file to some of my nand chips..

    Still playing some, to see if I can figure out why others may not work.

  4. #654
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,190
    @KurtE
    Just downloaded your latest changes and gave it a test:
    1. 25Q512 failed to transfer the 4.8MB PDF using 30Mhz SPI Clock. Changed it to 45Mhz and it transferred no problem using a T4.1
    2. 25Q65 fails the transfer on a T4.1 whether at 30 or 45Mhz. Just seems to hang and have to repower the Teensy to recover. This is the last thing I see in the Serial Monitor:
    Code:
    CMD: 100c(SEND_OBJECT_INFO)l: 20 T:1f : 1 ffffffff
    DATA:100c(SEND_OBJECT_INFO)l: 162 T:1f : 0 3000 4cbebf 3000 0
    SendObjectInfo: 1 4294967295 20202000: 0 3000 0 4cbebf 3000 0 0 0 0 0 0 0 0 0 0 : swampy.pdf
    sd_getReadOnYieldWrites store:0 count:1 0
    RESP:2001(RSP:OK)l: 24 T:1f : 1 ffffffff 3
    CMD: 100d(SEND_OBJECT)l: 12 T:20
    MTPD::SendObject: len:0 Use Yield:0
    Was able to transfer a 214KB jpg though, which seems to be a max.

    3. 25Q128 transfers the same PDF no problem at 30Mhz
    4. 25M02 NAND works no problem running at 55Mhz SPI Clock.

    Not sure why the 25Q64 is giving me such a problem. This is the one that is on the audio board.

  5. #655
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,206
    I will take a look...

    Right now trying to figure out why when I and a 3mb file it write 4mb...

  6. #656
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,206
    Pushed up a few "fixes" for larger file issue.
    Now to look at 25q64... I think that is same one on Propshield

  7. #657
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,190
    Sorry was outside shoveling - but yep - same one as on the propshield.

  8. #658
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,419
    Got sync'd to 2 hours back - not clear to start yet ... which example? ... "mtp-test" ?

    @mjs513 - when it p#654 "Just seems to hang" - was that with the HardFault detector active?

  9. #659
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,206
    Some of the time, I can copy a 3+MB file to that device, other times I fill the 1mb secondary buffer I defined and then get the timeout for reading more data... I tried increasing the max time between reads from 4 to 5ms and it appeared to error out quicker, and not after it filled the second buffer.

    So the next thing I thought I would try to experiment with, is once it detects that an error happened. I know that the full file did not transfer.

    Is there some way to reset the connection, so that you don't have to reboot the Teensy... So far sending a reset event does not appear to want to respond.,

    Will try a few other things.

  10. #660
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,206
    @defragster yes I am using the mtp-test from this branch. I am tempted to bring over some of the other stuff from my other branch, which had more commands, if you just hit enter it told you the command list...

    @all - I have been making use of my format hack in this sketch: But so far only on littleFS file systems. Currently it only does quick formats.

    As for SDFS not sure how best to do it. the SDFS library has example sketch that does formats, but 3 different options, and knows more internals. Again would maybe be nice if that was abstracted out into the
    FS.h (FS object)...

  11. #661
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,190
    Quote Originally Posted by KurtE View Post
    .......
    As for SDFS not sure how best to do it. the SDFS library has example sketch that does formats, but 3 different options, and knows more internals. Again would maybe be nice if that was abstracted out into the
    FS.h (FS object)...
    Maybe keep a wish list of what you think should be brought over into LittleFS and maybe in Beta7 at least some of them can be brought over?

  12. #662
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,190
    Quote Originally Posted by defragster View Post
    Got sync'd to 2 hours back - not clear to start yet ... which example? ... "mtp-test" ?

    @mjs513 - when it p#654 "Just seems to hang" - was that with the HardFault detector active?
    No - had the had the hardfault detector active in beta5 but when I brought over Beta6 I didn't go through the changes and incorporate them into the new core.

    EDIT: the problem may not be so much a hard fault but losing the pointer to the winbond chip since Teensy still shows up in windows explorer but can no longer access the chip.

  13. #663
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,419
    Built and running okay - nothing special 1Gb NAND took a 2.4MB file (with 8MB PSRAM)- not much room left as it was running LFSIntegrity last.

    Will get the T4_PowerButton-master built in and play some.

  14. #664
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,419
    First was seeing HardFault work - had to move to another sketch:
    Code:
    T:\tCode\RAM\SDtoPSRAM\SDtoPSRAM.ino Feb  7 2021 21:57:00
    card initialized.
    00000001Hardfault.
    Return Address: 0xF26
    	(DIVBYZERO) Divide by zero
    In testing to see code included :: Took out the #include <T4_PowerButton.h> and the test div by zero ignored until adding this to setup : SCB_CCR = 0x10; //Enable "Div By Zero" exceptions
    So then and it would just hang - confirmed the same in MTP code.

    It works in above sketch - the same code in the MTP :: examples\mtp-test\mtp-test.ino
    Handles the div by zero and restarts - but fails to capture USB for printing with the nature of the USB presented by the MTP But the setup() early prints now show.

    Okay found the fix for HardFault Printing:
    Code:
    Setup done
    CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
    RESP:2001(RSP:OK)l: 16 T:0 : 1
    00000001Hardfault.
    Return Address: 0x2310
    	(DIVBYZERO) Divide by zero
    
    T:\tCode\libraries\MTP_t4-MEM_send_object_large\examples\mtp-test\mtp-test.ino Feb  7 2021 22:18:36
    MTP_test
    This needs longer wait in : T:\tCode\libraries\T4_PowerButton\T4_PowerButton.c pp
    This is AFTER prior fault was found so only makes sense to wait the needed time to post the notice.
    Code:
    bool show_callstack(void)
    {
    
      arm_dcache_delete((void*)&sRegInfo, sizeof(RegInfo));
      bool found = sRegInfo.marker == _marker;
      if (!found) return false;
    
    #if (HARDFAULTSOUT==Serial)
      while(!Serial && millis() < 10000){} // was :: 3000){}
    #endif
    ...
    Made an issue : github.com/FrankBoesing/T4_PowerButton/issues/4
    Last edited by defragster; 02-08-2021 at 07:49 AM.

  15. #665
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,419
    Question: Where are the problem areas? Which media interfaces?

    First Test: QSPI 16 MB - on T_4.1 with 8 MB PSRAM.

    Deleted the 12 MB of data from LFSIntegrity - OKAY

    Put onto the "This PC\Teensy\QSPI" the file :: Audio_workshop.pdf with size : 8.47 MB (8,890,368.00 bytes) Onto QSPI with estimate of 45 seconds.

    The 'QSPI' was then NOT VISIBLE on Teensy ? Had to click TyComm 'Reset'.

    Drive appeared and the file was fully readable on restart.

    TEST TWO: Plugged T_4.1 into PJRC memory board, SPI "This PC\Teensy\nand3" of 64 MB was empty.
    Copied same 8 MB Audio...PDF and it worked and the file was readable - the Teensy drive did not go away and the file was immediately shown.
    > The SPI NAND copy seemed faster than the QSPI 16MB Flash.

    Renamed that first copied file and copied a second copy of same "Audio_workshop.pdf" {8.48MB} was shown in file explorer when the copy completed no issue, again all 31 pages of PDF are good to read.

    TEST THREE:Plugged T_4.1 into PJRC memory board, SPI "This PC\Teensy\nand4" of 64 MB had LFSIntegrity files.
    > Delete All files : Okay explorer redraws 'Folder is empty"
    > Copy completed and Explorer window redraws showing the "Audio_workshop.pdf" with SIZE 0 bytes - gave a 20 sec estimate - drive has lots of Formatting to do.
    > No reset!
    > Something went wrong we can't open this file
    > Return to Teensy ROOT in Explorer - then back to NAND4 - file is shown with proper size and the file opens usably complete.

  16. #666
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,419
    Question: using the T_4.1 with SPI PJRC memory board wondering why these { "nand1","nand2" } ( the large 128 and 256 MB nand's ) are not presented on MTP Just the above noted 64MB #3 and #4?
    - is the driver not taking these larger NAND's?
    Reading the SerMon now it shows this at 33 and 25 MHz SPI speed:
    Code:
    SPIFlash Storage 0 3 nand1 failed or missing
    SPIFlash Storage 1 4 nand2 failed or missing
    I put an SDIO card in and it shows the files and it very quickly and usable updated and copied 'audio...PDF' to "This PC\Teensy\sdio"

    I just deleted the above copied 'AUDIO...PDF' ( SDIO, NAND's, QSPI ) test files and all deletes worked with an explorer refresh showing the empty or remaining files as expected.

    ERROR file not removed on SDIO card: On restart the 'AUDIO...PDF' file is still present on Reset of the Teensy.
    >> Second restart still shows 'Audio_workshop.pdf' among the listed files and the file is still intact and readable.
    - > the SD card is a 32GB card that has other files ( mostly WAV files ) used in other Teensy testing.
    >> Files were removed from the SPI NAND media and the QSPI flash.

    Using LOGLOW T_4.0 with SDIO and Audio card with FLASH and SPI SD card:
    Code needs to not define QSPI when using T_4.0 - it hangs after showing the 2 SD cards:
    Code:
    #ifdef ARDUINO_TEENSY41
    #define USE_LFS_RAM 1     // T4.1 PSRAM (or RAM)
    #define USE_LFS_QSPI 1    // T4.1 QSPI
    #else
    #define USE_LFS_RAM 0     // T4.1 PSRAM (or RAM)
    #define USE_LFS_QSPI 0    // T4.1 QSPI
    #endif
    /
    Audio Memory CS is 6 and looks to be found but not presented in explorer - only SDIO?:
    Code:
    sd_addFilesystem: 2 20003c68 nand4 1
    SPIFlash Storage 3 6 nand4 16777216 8388608
    > of course it is NOR - does the name matter?

    SPI SD on CS of 10 also not displaying with T_4.0?

    Here is full SerMon spew:
    Code:
    T:\tCode\libraries\MTP_t4-MEM_send_object_large\examples\mtp-test\mtp-test.ino Feb  8 2021 02:40:14
    MTP_test
    sd_addFilesystem: 0 20002d08 sdio 0
    SDIO Storage 0 254 sdio 31092375552 163840
    sd_addFilesystem: 1 200031c4 sd1 0
    SD Storage 1 10 sd1 15923150848 65536
    SPIFlash Storage 0 3 nand1 failed or missing
    SPIFlash Storage 1 4 nand2 failed or missing
    SPIFlash Storage 2 5 nand3 failed or missing
    sd_addFilesystem: 2 20003c68 nand4 1
    SPIFlash Storage 3 6 nand4 16777216 8388608
    
    **** dir of sd[0] ****
    test1.txt
    
    Setup done
    CMD: 1002(OPEN_SESSION)l: 16 T:0 : 1
    RESP:2001(RSP:OK)l: 16 T:0 : 1
    CMD: 1001(GET_DEVICE_INFO)l: 12 T:1
    RESP:2001(RSP:OK)l: 12 T:1
    CMD: 1014(GET_DEVICE_PROP_DESC)l: 16 T:2 : d402
    RESP:2001(RSP:OK)l: 16 T:2 : d402
    CMD: 1004(GET_STORAGE_IDS)l: 12 T:3
    RESP:2001(RSP:OK)l: 12 T:3
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:4 : 1
    RESP:2001(RSP:OK)l: 16 T:4 : 1
    CMD: 1005(GET_STORAGE_INFO)l: 16 T:5 : 2
    RESP:2001(RSP:OK)l: 16 T:5 : 2
    SDIO is 32GB and copy of 8,685 KB 'AUDIO...PDF' is doing WINDOWS fail beep - like when I tried before to copy to FLASH with too little room. But it seems the T_4.0 is not responsive because nothing new shows on SerMon? Same results with smaller 12KB image file.
    Last edited by defragster; 02-08-2021 at 10:28 AM. Reason: QSPI 0 on T_4.0

  17. #667
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,237
    Quote Originally Posted by defragster View Post
    > of course it is NOR - does the name matter?
    The name does not matter, I choose these ignoring what the chips really are.
    They are only to give a name to MTP storage.

  18. #668
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,419
    Quote Originally Posted by WMXZ View Post
    The name does not matter, I choose these ignoring what the chips really are.
    They are only to give a name to MTP storage.
    Expected it didn't - but it was an excuse to bring it up just in case

    Except as noted ( T_4.0 and no delete on SDIO ) it generally works REALLY well!

    The T_4.1 seems to populate to the WIN PC much faster that the T_4.0 - which may point to some issue why the T_4.0 seems to have major failure to function - unless it is me missing more in the sketch than QSPI.

    T_4.0 doesn't have PSRAM for a buffer - but doesn't seem full?:
    Code:
    RAM1:  29.82% of 512 kB used.
       Code (ITCM, 32 kB Blocks):  111.51 kB
       Variables (DTCM):            24.69 kB
       Available for Variables:    359.31 kB
    
    RAM2:   2.67% of 512 kB used.
       Variables (DMAMEM):          13.66 kB
       Available for Heap:         498.34 kB
    
    FLASH:   6.90% of 1984 kB used.
       Code and Constants:         136.80 kB

  19. #669
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,190
    @defragster
    Regarding your post #665. I just retested using the Audio_workshop.pdf with size : 8.47 MB so documents would match on what we transferred. Will try and follow your test methodology:

    Test One: QSPI 16 MB - on T_4.1 with 8 MB PSRAM. All prior files were deleted so started with clean slate.

    Copy and pasted the file Audio_workshop file with no issue. Was able to open the doc from the 16MB QSPI flash and read it no problem.

    Test Two : "Plugged T_4.1 into PJRC memory board, SPI "This PC\Teensy\nand3" of 64 MB was empty.
    Copied same 8 MB Audio...PDF and it worked and the file was readable - the Teensy drive did not go away and the file was immediately shown.
    > The SPI NAND copy seemed faster than the QSPI 16MB Flash." CONFIRMED.

    Test Three: "plugged T_4.1 into PJRC memory board, SPI This PC\Teensy\nand4" .

    Copied same 8 MB Audio...PDF and it worked and the file was readable - the Teensy drive did not go away and the file was immediately shown.
    > The SPI NAND copy seemed faster than the QSPI 16MB Flash."

    Test four: plugged T_4.1 into PJRC memory board, SPI This PC\Teensy\NOR5.
    >Failed to transfer and hung as I mentioned before.
    > Restarted T4.1 and file showed as 0 Bytes transferred.

    The testing was done @KurtE's latest changes as of this morning.

  20. #670
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,206
    Morning all,

    I keep meaning to change the test program to support all 4 of the flash chips on the memory board. I think my other branch one did. Yesterday I did change (did not push up), that added pin 7, to the SPI list, where I then wired up the propshield to go to that one instead of it's default 6...

    Will spend some more time today, trying out different ideas on how to recover.

    Another thing that might be fun and potentially useful, is how hard would it be to detect when an SDCard is plugged in or removed? That is right now if you startup the test and you don't have an SDCard inserted, the drive does not show up. If you then plug in an SD, it still does not show up. Should it? If so how do we detect this on the Teensy?

    There is some stuff in IMXRT RM about DATA3 pin can be used for detection also CD_B pin, which I am guessing is not routed to SD on T4.1...
    We do have some IO pins that can be that: like on T4.1 pin 14 and pin 35... But I am guessing that there is nothing routed to the SD card on the T4.1...

    But there is a discussion about using the DATA3 pin, which can trigger an interrupt when the card is inserted or removed. But sounded like only if you are not using DATA3 for data... Agan not sure.

    But again wondering how that should/if how a storage should show up for SDCard when it was first not detected? On your PC an SDCard slot often shows up as a drive even if there is no card inserted. Should that happen with MTP? Or should it show up if it is later detected... If so how to update the MTP stuff?

    Could tell PC with storage added event, but not sure what impact that would have with current list in the file showing storage IDS... May have to experiment.

  21. #671
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    8,552
    Normally, the slots have an inbuilt switch which tells you if there is a card inserted or not.
    Without that, it's a bit difficult... but I wouln'd say impossible.
    A removed card could be detected by a timeout on block-adressing.
    An inserted card... without polling...hm, don't know, at the moment. In this case, the card need to initialize anyway, and why should it be DATA3, before that..

  22. #672
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,206
    Hi Frank,
    From section: 26.5.7
    The uSDHC uses either the DATA3 pin or the CD_B pin to detect card insertion or
    removal. When there is no card on the MMC/SD bus, the DATA3 will be pulled to a low
    voltage level by default.
    When any card is inserted to or removed from the socket, the uSDHC detects the logic
    value changes on the DATA3 pin and generates an interrupt. When the DATA3 pin is not
    used for card detection (for example, it is implemented in GPIO), the CD_B pin must be
    connected for card detection. Whether DATA3 is configured for card detection or not, the
    CD_B pin is always a reference for card detection. Whether the DATA3 pin or the CD_B
    pin is used to detect card insertion, the uSDHC will send an interrupt (if enabled) to
    inform the Host system that a card is inserted
    So I would think it would not be difficult to catch the first insertion... I think I read somewhere else in the registers something like you can check for card inserted if for example there is no active CMD or the like.
    Obviously it would be nice if this was actually built into the SD stuff. Probably can not get this without running additional pins in the external SPI SD case.

  23. #673
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    7,190
    Morning @KurtE
    Spent the morning before testing incorporating your changes into my mtp-test sketch which had the NAND and FRAM devices already incorporated. If interested here is what I used:
    Attached Files Attached Files

  24. #674
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    9,206
    Thanks Mike,

    I will integrate it in... As for FRAM don't have any. QSPI NAND I do have that on one of mine...

    Right now playing with Yet Another Lyxmotion Servo design for some of the others as an option...

  25. #675
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    14,419
    Update to p#673 : "...\MTP_t4-MEM_send_object_large\examples\mtp-test\mtp-test.ino"
    Code:
    mtp-test.ino
    > Longer start delay( 9s) for Serial - T_4.1 was showing nothing
    > #define ZERO block T_4.0 on QSPI like is done for RAM - as it hangs T_4.0

    T_4.0 now total fail with p#673 version - more to look at in changes - but at least seeing startup text now:
    T:\tCode\libraries\MTP_t4-MEM_send_object_large\examples\mtp-test\mtp-test.ino Feb 8 2021 11:34:23
    MTP_test
    sd_addFilesystem: 0 2000308c sdio 0
    SDIO Storage 0 254 sdio 31092375552 163840
    sd_addFilesystem: 1 20003660 PROGM 0
    Program Storage 0 PROGM 983040 8192
    No storage

Posting Permissions

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