Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 3 1 2 3 LastLast
Results 1 to 25 of 51

Thread: Teensy 4.1 external flash memory question.

  1. #1
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29

    Teensy 4.1 external flash memory question.

    Hello,

    I'm currently figuring out teensy 4.1 external memory capability using PSRAM and flash memory.

    Followed by hackster.io (https://www.hackster.io/news/adding-...1-89e527855502), I was able to run PSRAM test without a problem.

    However, I ran into an issue with flash memory.

    This is my teensy 4.1 back panel. A 8MB PSRAM(from PJRC store) and a 128MB flash memory(W25Q128JVSIM) are installed.

    Click image for larger version. 

Name:	20200717_155040.jpg 
Views:	21 
Size:	180.0 KB 
ID:	21048

    Using a given example code from extRAM_SPIFFS_t4\examples\flashtest7FI, I got these outputs.

    Click image for larger version. 

Name:	a.PNG 
Views:	26 
Size:	24.6 KB 
ID:	21049 Click image for larger version. 

Name:	Code section.PNG 
Views:	27 
Size:	23.2 KB 
ID:	21052
    Attempts to write a buffer to memory, but halted indefinitely.

    Click image for larger version. 

Name:	y.png 
Views:	11 
Size:	10.1 KB 
ID:	21050
    Erase function forever prints '.' (I ran about 3 hours).

    seems like external flash memory is initialized but forever halted on write/erase command... or it's not even responding?

    I'm pretty sure I'm missing something or doing something wrong.

    Hope I can get some help here.

    P.S. Only one different factor compared to hackster.io is a flash memory, he used W25Q128JVSI'Q' and I'm using W25Q128JVSI'M' as a flash memory.
    Click image for larger version. 

Name:	Capture.PNG 
Views:	16 
Size:	22.8 KB 
ID:	21051

    Best,

    Alex Han

  2. #2
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    @Han
    Think the problem may be more related to getting a good solder connection. If you zoom in and lighten image of the flash chip:
    Click image for larger version. 

Name:	20200717_155040.jpg 
Views:	6 
Size:	182.8 KB 
ID:	21053

    It looks like the pin 3 on the right side of the chip (circled) does not have a good solder connection to the pad. Some of the other pins may or may now as well. Think this is you main problem right now.

  3. #3
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29

    Thank you for fast reply :)

    mjs513,

    Thank you for the fast reply

    I just applied more solder to secure connection then ran the code again.
    Click image for larger version. 

Name:	fix.PNG 
Views:	9 
Size:	310.7 KB 
ID:	21054

    However, I got the same output...
    Click image for larger version. 

Name:	yet....PNG 
Views:	8 
Size:	10.0 KB 
ID:	21055

    I'll try out different version of flash memory.

  4. #4
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    The solder joints do look a lot better

    Just for reference the lib was tested with W25Q128JVSIQ with out an issue. Not an expert, maybe someone else will jump in, but they should be compatible.

    Before you unsolder the chip, the version i think you are using, isn't the latest so cant guarantee all examples or that it still works. The most current branch is: https://github.com/PaulStoffregen/te...FFS-FLASH-ONLY.

    The SPIFFS_t4 library is only works with the FLASH chip while the extRAM_t4 library only works with PSRAM.

  5. #5
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29

    Cool That might be it

    Means a lot to me

    I didn't know extRAM_t4 is only for PSRAM, that might be the issue all along.

    Since you told me W25Q128JVSIQ was used for development, might as well buy one for a back-up plan.

    thank you for your assistance.

  6. #6
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    Just make sure you are using the correct branch - use the link i posted

  7. #7
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29
    Yup, I notice I was using a different version.

    So I erased all existing files in arduino library and replaced with the new files you gave me.

    I ran this example code... https://github.com/PaulStoffregen/te...flashtest6.ino

    Which gave me this result.

    Click image for larger version. 

Name:	unnamed.png 
Views:	31 
Size:	6.2 KB 
ID:	21056

    Now I can confirm it's a flash memory(hardware) side issue.

    I'm going over my soldering again and retry it.

    If it's shows the same result, I will try it with W25Q128JVSIQ once it arrives.

    Since DoD department has a strict policy on any type of external memory coming into the lab, I might have to test it at home... it might take a while.

    If you are interested, I can keep you updated regarding to this issue.

    Again, thank you so much for a kind guidance.

  8. #8
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    Used to work for DoD so I understand.

    But I would get that message when I was not getting a good connection between the Flash or PSRAM chip and board. But yes please let us know what you find. By the way here is what you should see on start up:
    Code:
    D:\Users\Merli\Documents\Arduino\libraries\SPIFFS_t4\examples\flashtest6\flashtest6.ino Jul 20 2020 15:55:09
    PSRAM: 8 MB
    
     Enter 'y' in 6 seconds to format FlashChip - other to skip
    
    Mount SPIFFS:
    Mount ADDR 0x800000 with res: 0
    Write file:
    Hello World! What a wonderful World :)
    
    Directory contents:
    mtpindex.dat [0001] size:384
    my_file1 [0079] size:38
    Read file:
    Hello World! What a wonderful World :)
    
    
        ERAM ========== memory map ===== array* ======== check24() : WRITE !!!!
    		ERAM length 0x7FFFFE element size of 1
    	 took 228569 elapsed us
        ERAM ============================ check24() : COMPARE !!!!
    	 took 225148 elapsed us
    Good, 	Found 24 in ERAM 7FFFFE Times
    
    Mount SPIFFS:
    Mount ADDR 0x800000 with res: 0
    Directory contents:
    mtpindex.dat [0001] size:384
    my_file1 [0079] size:38

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,195
    What was the source of the Winbond chip? Digikey or other reputable supplier hopefully?

    Possible that chip presents alternate interface M versus Q - not sure only worked with Q's. Got some from eBay that failed - may have been the installation soldering - but all from Digikey have worked.

    If liquid/paste flux can be applied and pins reflowed that may assure proper connectivity to all pads that might be a simple test ( after cleaning ) before dumping/replacing the chip. Amazing how flux transfers heat and breaks surface tension beyond what is in the hollow core - with less time on the pad and leg.

    Should have taken a photo but soldering the NAND with side contacts to those same pads - after soldering the cooling solder made tall vertical spires following the soldering iron away from the pads. Then solder paste and heat quickly reformed that to a ball between pad and the chip contact.

  10. #10
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29
    Quote Originally Posted by defragster View Post
    What was the source of the Winbond chip? Digikey or other reputable supplier hopefully?
    Yes, I got it from Mouser.

    Good thing that I bought the W25Q128JVSIQ from Digi-Key today.

  11. #11
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29
    Quote Originally Posted by mjs513 View Post
    But I would get that message when I was not getting a good connection between the Flash or PSRAM chip and board. But yes please let us know what you find.
    Okay

    Since our company bought multiple Teensy 4.1s, I was allowed to try it one more time to reproduce this error using a brand new Teensy4.1 with new W25Q128JVSIM flash memory.

    This time though, to minimize my clumsy mistakes, I requested one of our assemblers to solder it for me.

    He was busy today, so I've schedule my work order for tomorrow.

  12. #12
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    This time though, to minimize my clumsy mistakes, I requested one of our assemblers to solder it for me.
    That should put that question to bed. Can't tell you how many times I had to retouch the solder joints. That's why i got in the habit of testing the flash and ram chips before i put on the headers - made it easier to correct my mistakes

  13. #13
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    Forgot to mention that there is one thing you can try with the T4.1 you already have. The default clock for the flash is set at 88Mhz but the lib changes it to 132Mhz. Wondering if the chip you have is having a problem at 132Mhz. In the spiffs_t4.cpp file if you comment out these lines and give it a try:
    Code:
    	  CCM_CCGR7 |= CCM_CCGR7_FLEXSPI2(CCM_CCGR_OFF);
    	  CCM_CBCMR = (CCM_CBCMR & ~(CCM_CBCMR_FLEXSPI2_PODF_MASK | CCM_CBCMR_FLEXSPI2_CLK_SEL_MASK))
    		  | CCM_CBCMR_FLEXSPI2_PODF(4) | CCM_CBCMR_FLEXSPI2_CLK_SEL(2); // 528/5 = 132 MHz
    	  CCM_CCGR7 |= CCM_CCGR7_FLEXSPI2(CCM_CCGR_ON);
    , about line 149.

  14. #14
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29
    This morning, my work order request got completed and T4.1 was ready to get tested.

    With a brand new T4.1 and a flash memory, it also returned the same result. (Since other T4.1 is in the lab, I wasn't able to capture or take a photo of result screen).

    Either I press 'y' or not I got the same result as "No FLASH INSTALLED!!!!"

    Quote Originally Posted by mjs513 View Post
    Forgot to mention that there is one thing you can try with the T4.1 you already have. The default clock for the flash is set at 88Mhz but the lib changes it to 132Mhz. Wondering if the chip you have is having a problem at 132Mhz.
    I also went over your suggestion for both T4.1s (one for my development board and one for the lab testing).

    I've commented out the code from line 149 to line 152 in spiffs_t4.cpp file, but still got the same result.

    Nevertheless, I'm really grateful that you took your precious time to help me.

    Thank you mjs513

    I'll continue to work on this issue once W25Q128JVSIQ flash memory arrives.

  15. #15
    Senior Member
    Join Date
    Sep 2015
    Posts
    108
    Code:
    Q(5) = Green Package (Lead-free, RoHS Compliant, Halogen-free (TBBA), Antimony-Oxide-free Sb2O3) with QE = 1 (fixed) in Status register-2. Backward compatible to FV family.
    M(6) = Green Package (Lead-free, RoHS Compliant, Halogen-free (TBBA), Antimony-Oxide-free Sb2O3) with QE = 0 (programmable) in Status register-2. New device ID is used to identify JV family
    Have you tried setting QE in SR2? Sounds like that's the only difference between the chips.

  16. #16
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    @ecurtz @Han
    Thanks for checking, I was just about to ask @Han to change the 0 to 1 in the begin to print device address as well:
    Code:
    	#if 0
    	  Serial.print("FLASH ID:");
    	  for (unsigned i = 0; i < sizeof(flashID); i++) Serial.printf(" %02X", flashID[i]);
    	  Serial.printf("\n");
    	  Serial.printf("at 0x %x\n", flashBaseAddr[_spiffs_region]);
    	#endif
    or just comment out the exit(1) in:
    Code:
    	  if(flashID[0] != 0xEF || flashID[1] != 0x40) {
    		  Serial.println("No FLASH INSTALLED!!!!");
    		  exit(1);
    	  }
    It looks for the SIM the ID is probably different: W25Q128JVSIM_ID= 0x7018

  17. #17
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29
    Quote Originally Posted by Han View Post
    P.S. Only one different factor compared to hackster.io is a flash memory, he used W25Q128JVSI'Q' and I'm using W25Q128JVSI'M' as a flash memory.
    Click image for larger version. 

Name:	Capture.PNG 
Views:	16 
Size:	22.8 KB 
ID:	21051
    Oh, so it seems like it does matter.

    I will go ahead and test it out.

  18. #18
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    @Han
    Thanks for testing since I don't have the SIM version. Easy fix if that is the case.

  19. #19
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29
    This is how I did... @mjs513

    Click image for larger version. 

Name:	image.png 
Views:	16 
Size:	20.2 KB 
ID:	21064
    I changed id to mach with W25Q128JVSIM_ID= 0x7018 and change the 0 to 1 as you described.

    Now I'm back to my original question where I'm not able to write or erase memory.
    Click image for larger version. 

Name:	unnamed.png 
Views:	17 
Size:	10.4 KB 
ID:	21065

    But now I know what is going on with spiffs_t4.cpp file.

    Let's see what I can do with it.

  20. #20
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,195
    Wondering if there are any debug print points commented out that might show where the write/erase fail?

    Did you leave out the speed increase to run at the default set on PSRAM startup?

  21. #21
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    @Han wondering 2 things:
    It sounds like that its getting stuck in the waitFlash function, busy bit is not clearing for some reason, at some point during erase since all you are seeing is dots. For me it takes about 27secs to erase the whole chip.

    If you can try 2 things for me:
    1. When you run the sketch don't hit "y" to format.
    2. change this in waitFlash to:
    Code:
     do {
       flexspi_ip_read(8, flashBaseAddr[_spiffs_region], &val, 1 );
        if (timeout && (millis() - t > timeout)) return 1;
      } while  ((val & 0x01) == 1);
    If this don't work i am ordering the same chip for testing.

  22. #22
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29
    @defragster

    I was playing around with the code while reading through it.

    I did print out one debug print points (errorno) by setting _spiffs_region to 1 which was initially 0.
    Click image for larger version. 

Name:	Capture1.PNG 
Views:	13 
Size:	38.3 KB 
ID:	21066

    If I do so, I get this output with "errorno -10010".
    Click image for larger version. 

Name:	Capture (1).PNG 
Views:	9 
Size:	23.6 KB 
ID:	21067

    Yeah, that's what I found out so far... I will let everyone know if I get something.

  23. #23
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    @Han
    Region 1 sets to 8Meg - don't think you want to do that.

  24. #24
    Member
    Join Date
    Jul 2020
    Location
    California
    Posts
    29
    @mjs513

    Okay, I changed waitFlash as you described.
    Click image for larger version. 

Name:	image (1).png 
Views:	9 
Size:	119.0 KB 
ID:	21068

    But still halted on f.writeFile command.
    Click image for larger version. 

Name:	image.png 
Views:	8 
Size:	15.9 KB 
ID:	21069

    I also put region back to 0.

  25. #25
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,551
    Quote Originally Posted by Han View Post
    @mjs513

    Okay, I changed waitFlash as you described.
    Click image for larger version. 

Name:	image (1).png 
Views:	9 
Size:	119.0 KB 
ID:	21068

    But still halted on f.writeFile command.
    Click image for larger version. 

Name:	image.png 
Views:	8 
Size:	15.9 KB 
ID:	21069

    I also put region back to 0.
    Ok - if you make that change to waitFlash then you can attempt to format it again. Think you are getting the error because its not formatted yet.

    Going to have to read the datasheet in detail to see what the problem could be.

Posting Permissions

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