Teensy 4.1 external flash memory question.

Status
Not open for further replies.

Han

Active member
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-more-ram-and-flash-to-the-teensy-4-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.

20200717_155040.jpg

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

a.PNG Code section.PNG
Attempts to write a buffer to memory, but halted indefinitely.

y.png
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.
Capture.PNG

Best,

Alex Han
 
@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:
20200717_155040.jpg

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.
 
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.
fix.PNG

However, I got the same output...
yet....PNG

I'll try out different version of flash memory.
 
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/teensy41_extram/tree/SPIFFS-FLASH-ONLY.

The SPIFFS_t4 library is only works with the FLASH chip while the extRAM_t4 library only works with PSRAM.
 
That might be it

Means a lot to me :eek:

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.
 
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/t.../SPIFFS_t4/examples/flashtest6/flashtest6.ino

Which gave me this result.

unnamed.png

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.
 
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
 
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.
 
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.
 
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 :)
 
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.
 
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!!!!"

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.
 
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.
 
@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
 
This is how I did... @mjs513

image.png
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.
unnamed.png

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

Let's see what I can do with it.
 
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?
 
@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.
 
@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.
Capture1.PNG

If I do so, I get this output with "errorno -10010".
Capture (1).PNG

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

Okay, I changed waitFlash as you described.
image (1).png

But still halted on f.writeFile command.
image.png

I also put region back to 0.
 
Status
Not open for further replies.
Back
Top