Teensy 4.1 + PSRAM + Winbond 25Q128JVSQ: Flash memory tests not working

Status
Not open for further replies.

edamas

Member
Hi,

I have a Teensy 4.1 that works perfectly and today I have soldered the PSRAM and the Winbond 25Q128JVSQ flash memory to it.

I've checked my PSRAM IC with this test:

https:/github.com/PaulStoffregen/teensy41_psram_memtest/blob/master/teensy41_psram_memtest.ino

everything works smoothly and after 36.66 seconds I see "All memory tests passed" but checking the flash memory is working properly has not been possible.

At first I have downloaded and installed these libraries:

https://github.com/PaulStoffregen/teensy41_extram

then tried some of the flashtests and, for example, with flashtest4.ino I got some warnings when compiling:

Code:
WARNING: Category 'Memory' in library extRAM_t4 is not valid. Setting to 'Uncategorized'
WARNING: library SPIFFS_t4 claims to run on (Teensy) architecture(s) and may be incompatible with your current board which runs on (avr) architecture(s).
flashtest4: In function 'void loopTest2()':
flashtest4:135: warning: unused variable 'szLen' 
   int szLen;

       ^

flashtest4:136: warning: unused variable 'xData2' 
   char xData[12048], xData1[12048], xData2[26];

                                     ^

In file included from flashtest4.ino:14:0:

extRAM_t4.h: At global scope:

extRAM_t4.h:63:14: warning: 'flashID' defined but not used [-Wunused-variable]

  static char flashID[8];

              ^

and the results try to erase the flash memory,

Code:
  Enter 'y' in 6 seconds to format FlashChip - other to skip
 hardware initialized
 ERAM ID: 0D 5D 5F FF FF EF B7 69
 at 0x 7000000
 Device found!
 FLASH ID: EF 40 18 00 00 00 00 00
 at 0x 1000000
 Erasing... (may take some time)
 ..................................................................................................................................................................................................................................................................................................................................................

or to write something on it are not the expected ones.

Code:
 Enter 'y' in 6 seconds to format FlashChip - other to skip

Mount SPIFFS:
hardware initialized
ERAM ID: 0D 5D 5F FF FF FF B7 69
at 0x 7000000
Device found!
FLASH ID: EF 40 18 00 00 00 00 00
at 0x 1000000
Mount ADDR 0x1000000 with res: 0
Write file:
Hello World! What a wonderful World :) Hello World! What a wonderful World :) Hello World! What a wonderful World :) Hello World! What a wonderful World :)  Hello World! What a wonderful World :) Hello World! What a wonderful World :

it seems the erase/write processes won't ever end. I'd appreciate any hint about how to solve this mess. ;)

Thanks in advance
 
There are other other postings - one that seems similar - is that when the solder joints were retouched and the connections made clean a chip passing the initial test - then worked properly for other usage, but failed before.

Better to look around or ping post like above - and add information - like add closeup photos of the connections ...

Maybe this has been done - but it isn't noted ...

Add a touch of flux and a reheat each pin to a clean finish - initial solder on here had long hairs where solder followed the iron off the joint. Applied flux paste and touches each and the solder rolled into a ball on the chip contact and the PCB trace. Then washed with 90% Isopropyl and dried for good connections free of flux.
 
I have tried the libraries recommended by @mjs513,

https://github.com/PaulStoffregen/teensy41_extram/tree/SPIFFS-FLASH-ONLY

and the example sketch, flashtest6.ino and, to begin with, there are many warnings (which I guess it means that may be something wrong),

Code:
flashtest6: In function 'void loopTest2()':
flashtest6:112: warning: unused variable 'szLen' 
   int szLen;
       ^

flashtest6:113: warning: unused variable 'xData2' 
   char xData[12048], xData1[12048], xData2[26];
                                     ^

flashtest6: In function 'void loopTest()':
./SPIFFS_t4/examples/flashtest6/flashtest6.ino:161:49: warning: format '%c' expects argument of type 'int', but argument 4 has type 'const char*' [-Wformat=]

   sprintf(erName, "%s%c", "F_" ,__TIME__, fIdx++);
                                                 ^

flashtest6:161: warning: too many arguments for format 
./SPIFFS_t4/examples/flashtest6/flashtest6.ino:161:49: warning: format '%c' expects argument of type 'int', but argument 4 has type 'const char*' [-Wformat=]

flashtest6:161: warning: too many arguments for format 
Sketch uses 57776 bytes (0%) of program storage space. Maximum is 8126464 bytes.
Global variables use 82612 bytes (15%) of dynamic memory, leaving 441676 bytes for local variables. Maximum is 524288 bytes.

anyway this test compiled and uploaded to my Teensy 4.1 but both the flash erasing process and the flash memory test itself, runs indefinitely and never end.

Code:
flashtest6.ino
PSRAM: 8 MB
Enter 'y' in 6 seconds to format FlashChip - other to skip
Erasing... (may take some time)
......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

Code:
flashtest6.ino
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 :)

Teensy 4.1 PSRAM & Flash memory (0001).jpgTeensy 4.1 PSRAM & Flash memory (0002).jpg

Add a touch of flux and a reheat each pin to a clean finish - initial solder on here had long hairs where solder followed the iron off the joint. Applied flux paste and touches each and the solder rolled into a ball on the chip contact and the PCB trace. Then washed with 90% Isopropyl and dried for good connections free of flux.
I did it twice but no luck.

Anyway, thank you for your quick reply!
 
Those first 2 warnings may be nothing - some alternate tests had vars used in another test but not removed ... flashtest6 evolved from prior versions since modified or abandoned.

Though the sprintf and format warnings may be a bad indication.

Finding recent posts might help - that is weeks back, but last seen. It point to the proper BRANCH and github - though that looks to be the last edited branch.

Too late to test here now - Do a forum search on 'flashtest6' - it shows a couple of threads - one is August the other July that have most recent - some of which might apply usefully.

@mjs513 touched it last and reply may be forthcoming in a couple of hours if he sees this.
 
I have just changed the 0 to 1 in this line of the library:
Code:
	#if 0
	  Serial.print("FLASH ID:");
and the flash ID I got is 0xEF40180000000000. May be my flash memory chip is not the right type?

P.S. Following the advise of mjs513 I have tried commenting out these lines but it doesn't work yet.
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);
 
Check those other threads. SPIFFS on PSRAM may no longer fully supported perhaps - it is on the Winbond Flash, but after testing on PSRAM it was ignored/backed out to some degree. See if any of the exmaples are PSRAM only at this point without SPIFFS.
 
@edamas - @defragster
Good Morning - On the east coast its about 8am so there is a bit of a time lag on my end.

The warning and error won't affect the ability to use the chip - I just corrected the sketch to get rid of the warnings and will push that change up.

Anyway back to the issue, I just retested the flashtest6.ino sketch from the SPISS_t4 library and I couldn't repeat your problem with the "Q" version of the chip:

Code:
C:\Users\Merli\AppData\Local\Temp\arduino_modified_sketch_421752\flashtest6.ino Sep  2 2020 07:33:40

PSRAM: 8 MB

 Enter 'y' in 6 seconds to format FlashChip - other to skip

Erasing... (may take some time)

.....................................................
Chip erased in 26 seconds.


Mount SPIFFS:

Mount ADDR 0x800000 with res: 0
Write file:
Hello World! What a wonderful World :)

Directory contents:
my_file1 [0001] size:38
Read file:

Hello World! What a wonderful World :)


    ERAM ========== memory map ===== array* ======== check24() : WRITE !!!!
		ERAM length 0x7FFFFE element size of 1
	 took 230780 elapsed us
    ERAM ============================ check24() : COMPARE !!!!
	 took 225149 elapsed us
Good, 	Found 24 in ERAM 7FFFFE Times


Mount SPIFFS:

Mount ADDR 0x800000 with res: 0
Directory contents:
my_file1 [0001] size:38
The last set of changes that we made were to add support for the "M" variant of the chip.

The flash id looks correct, "flash ID I got is 0xEF4018", is the same as mine.

As @defragseter stated SPIFFS are not supported on the PSRAM. Also, the only time I have seen issues, at least with me, is because of the soldering but I don't see anything obvious in your photos that I can point to. Don't know when you downloaded the lib but you might want to try and reinstall the library and give it another shot.
 
Thank you for your reply.

The flash id looks correct, "flash ID I got is 0xEF4018", is the same as mine.

I'm glad to hear that. In the last hour I was trying some small modifications I have found in another related threads but, as I have no luck, even after redownload the mentioned library, I have desoldered the flash memory chip:

Teensy4.1.jpg

I have tested the desoldered Winbond 25Q128JVSQ in a TL866II+ programmer and it actually seems to be working smoothly,

FlashTest.jpg

so I have erased the whole memory using the programmer then resoldered it in my Teensy 4.1. As I was still having the same (wrong) results, I have double checked the flash memory pins, reheat them, etc. but no luck yet. when flashtest6.ino try to erase the flash memory the process never ends, if I choose not to erase the flash memory the test enters in a endless loop.

P.S. I have 5 Winbod W25Q128FVSG chips at hand, my programmer detects them as ID 0xEF4018, are they (FVSG no JVSQ) compatible with Teensy 4.1 and this library? Although I suspect it wouldn't be worth it, I could give them a try, how does it sound?
 
Last edited:
Not sure what to say since i can not duplicate with my flash chip.

As for the "W25Q128FVSG " I can't say for sure as I have not gone through the spec sheet and compared them. You could give it a try but not sure what errors is any you would get?
 
Thank you for your reply.

First of all, to be 100% sure that the problem is not due to errors in the soldering, I have directly checked the continuity of each pin of the chip with its corresponding via and pad in the PCB and it looks like the 8 pins are well soldered. In the attached image you can see the correspondence between each pin of the chip and its via in the exact places I have used to check the continuity.

Teensy 4.1 Flash memory pin checking.jpg

Now the problem is that once desoldered the flash memory, checked and erased with the external programmer, resoldered in the PCB of the Teensy 4.1 and the continuity of every pin checked, I can't think of what could go wrong.
 
FWIW: I'm having the same problem with Winbond 25Q128JVSQ on the T4.1 and also occasionally have had it happen on the T3.6. Can't figure out what's wrong. I'm hoping you come up with a solution!

Pete
 
No help here ... This is a post for the 'gosh my desk is a mess thread'/'unorganized piles' - I cannot find my T_4.1 with the Flash (PJRC supplied Beta board) on, it is somewhere with my new 7" display ... - I have 3 others with PSRAM and the NOR Flash on in some combination ...

The Unending Format '... ...' seems like I saw that some time back at least once ... but that went away - don't recall the events/cause - but that would be the same unit @mjs513 has working now.
 
Sorry the others have played with these a lot more than I have. And I think it is a long shot, but might check there are not some soldering issues with the PSRAM as they share all of the same IO pins except they both have their own FlexSPI CS pins.

Also as these are accessed using SPI4 communications, wonder if your programmer does that or only one data pin? Again all long shots.
 
Thank you for your reply.

First of all, to be 100% sure that the problem is not due to errors in the soldering, I have directly checked the continuity of each pin of the chip with its corresponding via and pad in the PCB and it looks like the 8 pins are well soldered. In the attached image you can see the correspondence between each pin of the chip and its via in the exact places I have used to check the continuity.


Now the problem is that once desoldered the flash memory, checked and erased with the external programmer, resoldered in the PCB of the Teensy 4.1 and the continuity of every pin checked, I can't think of what could go wrong.

Pretty much at a loss here. You can try commenting out the lines in post #5 again and give it a try.

Only time i experienced a problem like this was because of my soldering but that doesn't seem to be the case here.

BTW. What version Teensyduino are you using, up to 1.53 now and that has been what i am using to test.
 
FWIW: I'm having the same problem with Winbond 25Q128JVSQ on the T4.1 and also occasionally have had it happen on the T3.6. Can't figure out what's wrong. I'm hoping you come up with a solution!
I hope so! Thanks

The Unending Format '... ...' seems like I saw that some time back at least once ... but that went away - don't recall the events/cause - but that would be the same unit @mjs513 has working now.

If you finally remember something, I look forward to the details.

And I think it is a long shot, but might check there are not some soldering issues with the PSRAM
I have to check it but, as it seems it uses to happen, the PSRAM test works smoothly.

Pretty much at a loss here. You can try commenting out the lines in post #5 again and give it a try.
I have tried it and still the same results, endless format and stuck as soon flashtest6 try to write.

BTW. What version Teensyduino are you using, up to 1.53 now and that has been what i am using to test.
I have replicated the test on a Windows and a Linux computer with Teensyduino 1.53 both with a fresh Arduino IDE installation.

Anyway, and although I haven't had time to study the code of the SPIFFS_t4 library yet, isn't it strange that in the example flashtest6 the commands to obtain the FLASH ID work well while any other attempt of the communication with the flash memory fails?
 
IIRC - and it applies to this chip - Paul noted the FLASH ID is read while in normal SPI mode before transition to QSPI mode. Once in QSPI that command isn't available/honored.

That would go back to KurtE's note about the external Flash tester - if it only does SPI not QSPI interface it could be a bad chip.

I saw a pile that might have my FLASH T_4.1 in but hands were full so didn't dig in - but if I did all right it would duplicate the results of mjs513. I could solder up another - but that would take more time and a task for 'later'.

As far as the unending format "... ..." - that was likely early during Beta testing when the code was changing ... QSPI setup and speed settings in flux so not likely to recur here in use, or personal recall :(
 
IIRC - and it applies to this chip - Paul noted the FLASH ID is read while in normal SPI mode before transition to QSPI mode. Once in QSPI that command isn't available/honored.
That is interesting.

That would go back to KurtE's note about the external Flash tester
I think the external programmer, a XGecu TL866IIplus, uses only SPI to erase, read or write the chip.

if it only does SPI not QSPI interface it could be a bad chip.
I will get some others 25Q128JVSQ just to check it out.
 
defragster said:
As far as the unending format "... ..." - that was likely early during Beta testing when the code was changing ... QSPI setup and speed settings in flux so not likely to recur here in use, or personal recall
Just for reference the last time we saw this was when another user was using the "M" variant of the chip as opposed the "Q" which the library was originally designed around.

I will get some others 25Q128JVSQ just to check it out.
Got mine from https://www.digikey.com/product-detail/en/winbond-electronics/W25Q128JVSIQ/W25Q128JVSIQ-ND/5803943

The only other comment i had based on Kur's comment and your test results is that it sounds like the chip isn't supporting QSPI mode only SPI mode.
 
Thanks!

Just for reference the last time we saw this was when another user was using the "M" variant of the chip as opposed the "Q" which the library was originally designed around.

Interesting. Do you know what would be the FLASH ID for the "M" variant of the chip?


I wish I could order it there just to make sure they are the right ones but the shipping and customs costs are really crazy.

The only other comment I had based on Kur's comment and your test results is that it sounds like the chip isn't supporting QSPI mode only SPI mode.

Mine is a Winbond 25Q128JVSQ and according to the table at Winbond's website, if I'm not wrong, it should support QSPI:

https://www.winbond.com/hq/product/...nor-flash/?__locale=en&selected=128Mb#Density
Winbond 128Mb flash memory.png

but, anyway and just for the sake of testing this hypothesis, is there a (quick) way to modify the library to use only SPI mode?
 
Interesting. Do you know what would be the FLASH ID for the "M" variant of the chip?
Believe its EF70 vs EF40.

Mine is a Winbond 25Q128JVSQ and according to the table at Winbond's website, if I'm not wrong, it should support QSPI:
Agree it should be but for some reason doesn't appear to be entering QSPI mode.

but, anyway and just for the sake of testing this hypothesis, is there a (quick) way to modify the library to use only SPI mode?
Unfortunately no, only supports QSPI. @KurtE mentioned something about SPI4 but not sure the pin outs for that so you can use a serFlash library. However, with that said, I noticed when you were testing it in a ZIF socket you had an adapter. You could use that adapter to attach it to a SPI pins and test it using a SerFlash library.
 
Believe its EF70 vs EF40.

Great, thanks.

Agree it should be but for some reason doesn't appear to be entering QSPI mode.

I have just modified my setup in order to get a platform to easily test multiple flash memory chips.

Teensy 4.1 Flash Adapter 0001.jpgTeensy 4.1 Flash Adapter 0002.jpg

after the changes, the PSRAM tests works but the flash memory tests show same results. In that sense there is no change but at least I know that this makeshift adapter works, it does not cause problems and it will be easier for me to try different chips.

However, with that said, I noticed when you were testing it in a ZIF socket you had an adapter. You could use that adapter to attach it to a SPI pins and test it using a SerFlash library.

Well, my final aim was test the library itself as the flash memory was tested with the external programmer using SPI and it works smoothly.

Maybe sounds weird but regarding the source code in post #5, do you know what number base was used for "528/5 = 132 MHz"? I don't get it. The single/dual/quad SPI clock for 25Q128JVSQ is 133MHz while for 25Q128FVSG is 104MHz. I'm trying to understand how to modify the clock frequency in that source code in order to test both types of flash memory chips.
 
Last edited:
Great, thanks.



I have just modified my setup in order to get a platform to easily test multiple flash memory chips.


after the changes, the PSRAM tests works but the flash memory tests show same results.



Well, my final aim was test the library itself as the flash memory was tested with the external programmer using SPI and it works smoothly.

Maybe sounds weird but regarding the source code in post #5, do you know what number base was used for "528/5 = 132 MHz"? I don't get it. The single/dual/quad SPI clock for 25Q128JVSQ is 133MHz while for 25Q128FVSG is 104MHz.

Very cool setup, for testing flash chips was thinking a doing something similar. Thanks for the photo.

As to your last question, its not really about the base but about the clock selected (CCM_CBCMR_FLEXSPI2_CLK_SEL(2)) and the divisor ( CCM_CBCMR_FLEXSPI2_PODF(4)). So for selected clock of (2) [528Mhz] and a divisor of CCM_CBCMR_FLEXSPI2_PODF(4) [5-1] per the RM you would get about 132Mhz.

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);

Be forewarned the same clock is used for the PSRAM. Right now it defaults to 88Mhz in the core. We changed it in the FLASH library so you get a higher clock.

Here is a little table that @Frank B had tested during the beta testing for the Flash and PSRAM

Code:
SEL: 0  DIV: 7 = 49.50000 MHz ok
SEL: 0  DIV: 6 = 56.57143 MHz ok
SEL: 0  DIV: 5 = 66.00000 MHz ok
SEL: 0  DIV: 4 = 79.20000 MHz ok
SEL: 0  DIV: 3 = 99.00000 MHz ok
SEL: 0  DIV: 2 = 132.00000 MHz
SEL: 0  DIV: 1 = 198.00000 MHz
SEL: 0  DIV: 0 = 396.00000 MHz
SEL: 1  DIV: 7 = 90.00000 MHz ok
SEL: 1  DIV: 6 = 102.85714 MHz ok
SEL: 1  DIV: 5 = 120.00000 MHz
SEL: 1  DIV: 4 = 144.00000 MHz
SEL: 1  DIV: 3 = 180.00000 MHz
SEL: 1  DIV: 2 = 240.00000 MHz
SEL: 1  DIV: 1 = 360.00000 MHz
SEL: 1  DIV: 0 = 720.00000 MHz
SEL: 2  DIV: 7 = 83.07750 MHz ok
SEL: 2  DIV: 6 = 94.94572 MHz ok
SEL: 2  DIV: 5 = 110.77000 MHz ok
SEL: 2  DIV: 4 = 132.92400 MHz
SEL: 2  DIV: 3 = 166.15500 MHz
SEL: 2  DIV: 2 = 221.53999 MHz
SEL: 2  DIV: 1 = 332.31000 MHz
SEL: 2  DIV: 0 = 664.62000 MHz
SEL: 3  DIV: 7 = 66.00000 MHz ok
SEL: 3  DIV: 6 = 75.42857 MHz ok
SEL: 3  DIV: 5 = 88.00000 MHz ok
SEL: 3  DIV: 4 = 105.60000 MHz ok
SEL: 3  DIV: 3 = 132.00000 MHz
SEL: 3  DIV: 2 = 176.00000 MHz
SEL: 3  DIV: 1 = 264.00000 MHz
SEL: 3  DIV: 0 = 528.00000 MHz
 
Very cool setup, for testing flash chips was thinking a doing something similar.
Thank you. As soon as I receive the new batch of flash memories I ordered, I will use it to check one by one if they work with Teensy 4.1

Thanks for the photo.
You are very welcome.

As to your last question, its not really about the base but about the clock selected
Thanks. Glad to know it, it was weird because 528/5=105.6!=132 and I thought it should say 665/5=133 (since selected clock of (2) = 664.62MHz).

Here is a little table that @Frank B had tested during the beta testing for the Flash and PSRAM
I wish I had it before, it'd be very useful. Thank you very much.

And I think it is a long shot, but might check there are not some soldering issues with the PSRAM as they share all of the same IO pins except they both have their own FlexSPI CS pins.
I just did the test (flashtest6.ino) after desoldering the PSRAM and same results, the flash memory format and writing operations never end.
 
Last edited:
Just FYI,

I have two Teensy 4.1 boards with that exact setup. So I gave flashtest6.ino a try (with the #if 0 changed to 1 in spiffs_t4.cpp as noted in post #5).
Here is what I got (framed by asterisks since I don't how to frame it):

**************************************************************************************************************************
/Users/x/Documents/Arduino/libraries/SPIFFS_t4/examples/flashtest6/flashtest6.ino Sep 3 2020 11:21:24
PSRAM: 8 MB

Enter 'y' in 6 seconds to format FlashChip - other to skip

Mount SPIFFS:
FLASH ID: EF 40 18 00 00 00 00 00
at 0x 800000
Mount ADDR 0x800000 with res: 0
Write file:
Hello World! What a wonderful World :)

Directory contents:
data.csv [0079] size:256
my_file1 [0001] size:38
Read file:
Hello World! What a wonderful World :)


ERAM ========== memory map ===== array* ======== check24() : WRITE !!!!
ERAM length 0x7FFFFE element size of 1
took 222266 elapsed us
ERAM ============================ check24() : COMPARE !!!!
took 516428 elapsed us
Good, Found 24 in ERAM 7FFFFE Times

Mount SPIFFS:
Mount ADDR 0x800000 with res: 0
Directory contents:
data.csv [0079] size:256
my_file1 [0001] size:38


***************************************************************************************************************************

So apparently it can work just fine. I hope some cause is found. This is the kind of thing that tends to reappear at inopportune times.
Thanks for sharing this issue.
 
I have two Teensy 4.1 boards with that exact setup. So I gave flashtest6.ino a try (with the #if 0 changed to 1 in spiffs_t4.cpp as noted in post #5).
Thank you for capturing the serial monitor output for this test. It is identical to the one I had seen in other threads and the one that, at the moment, is impossible for me to obtain with my current configuration. I hope the new flash memories I ordered will finally work the magic.

Here is what I got (framed by asterisks since I don't how to frame it):
To frame the text, you can use the BBCode
Code:
 command (for example, [b][[/b][b]code][/b]text[b][[/b][b]/code][/b]) or click the [b]#[/b] icon in Advanced editing mode.
 
Status
Not open for further replies.
Back
Top