Teensy 4.1 external flash memory question.

Status
Not open for further replies.
Just as a FYI - just ordered a few of the SIM version and another T4.1 to test with from Digikey. Have a feeling this is going to come up again.
 
I ran it about 40 minutes for formatting.

It is not able to execute erase command.

Since software is keep printing dots, I think software is forever waiting for hardware signal.

unnamed.png Capture1.PNG

While I'm waiting, I'll keep reading the code alongside with Winbond flash memory instructions.
 
That assessment agrees with what I said in an earlier post.

If i had the same setup I would look at the status registers using the printStatusRegs function call. Would make the follow
Code:
void spiffs_t4::printStatusRegs() {
[COLOR="#FF0000"]#if 1[/COLOR]
  uint8_t val;

  flexspi_ip_read(8, flashBaseAddr[_spiffs_region], &val, 1 );
  Serial.print("Status 1:");
  [COLOR="#FF0000"]Serial.println(val, BIN); //lets me see the bits more easily against the datasheet
[/COLOR]
  // cmd index 9 = read Status register #2 SPI
  flexspi_ip_read(9, flashBaseAddr[_spiffs_region], &val, 1 );
  Serial.print("Status 2:");
  [COLOR="#FF0000"]Serial.println(val, BIN); //lets me see the bits more easily against the datasheet[/COLOR]
#endif
}

I would put it in eraseDevice and watFlash. You may get a lot of spew but you can put a test on it to print it periodically or just pull the usb cable.

Order the SIM chip from digikey earlier today, may have at end of week for testing.

EDIT:
Forgot to add - bits you want to check is that the chip is write enabled (WEL) and no protection bits are set.
 
Last edited:
Ok - think i figured it out.

My fault in reading - While we “Enter QPI (38h)” the QE bit is never actually set which for the "M" chip it needs to be. Saw a note in this note in the lib which i missed:
Code:
	  //TODO!!!!! set QPI enable bit in status reg #2 if not factory set!!!!!
Dang it - should have saw this yesterday!
 
@Han
After the TODO statement can you add this:
Code:
	  if( flashID[1] == 0x70){
		  uint8_t val;
		  flexspi_ip_read(9, flashBaseAddr[_spiffs_region], &val, 1 ); //read status Reg2
		  val |= 1<<1;
		  FLEXSPI2_LUT28 = LUT0(CMD_SDR, PINS1, 0x31) | LUT1(WRITE_SDR, PINS1, 1);
		  flexspi_ip_write(7, flashBaseAddr[_spiffs_region], val, 1);
	  }
think this is correct to set the QE bit which is bit 2 of status register-2. Can you give this a try or make necessary corrections.
 
Last edited:
@mjs513

Sorry about a late reply, I just got back to my office.

I will make the changes you gave me and let you know about it.

Thank you :)
 
So, this is what I did.
image.png

It's currently not taking any characters after making that change.
unnamed.png
 
That assessment agrees with what I said in an earlier post.

If i had the same setup I would look at the status registers using the printStatusRegs function call. Would make the follow
Code:
void spiffs_t4::printStatusRegs() {
[COLOR="#FF0000"]#if 1[/COLOR]
  uint8_t val;

  flexspi_ip_read(8, flashBaseAddr[_spiffs_region], &val, 1 );
  Serial.print("Status 1:");
  [COLOR="#FF0000"]Serial.println(val, BIN); //lets me see the bits more easily against the datasheet
[/COLOR]
  // cmd index 9 = read Status register #2 SPI
  flexspi_ip_read(9, flashBaseAddr[_spiffs_region], &val, 1 );
  Serial.print("Status 2:");
  [COLOR="#FF0000"]Serial.println(val, BIN); //lets me see the bits more easily against the datasheet[/COLOR]
#endif
}

I would put it in eraseDevice and watFlash. You may get a lot of spew but you can put a test on it to print it periodically or just pull the usb cable.

Order the SIM chip from digikey earlier today, may have at end of week for testing.

EDIT:
Forgot to add - bits you want to check is that the chip is write enabled (WEL) and no protection bits are set.

Regarding to this suggestion,

I was able to capture this debug output...
image (4).png
image (3).png

After first 2 loops 1110001 -> 0, register status number is set to 1010101(never change after this).
So status 1 and 2 are the same as 1010101.
If you don't mind it, could you check this one too?
 
Ok thanks for testing. From your last output you can see that the QE bit is not set in status register 2. As for why it hangs must have something wrong with my LUTs and write.
 
@Han
Sorry for the delay in getting back to you but got sidetracked. Can you give this a try, it doesn't hang my T4.1
Code:
	  if( flashID[1] == 0x70){
		[COLOR="#FF0000"]uint8_t val[0];[/COLOR]
		flexspi_ip_read(9, flashBaseAddr[_spiffs_region], &val, 1 );	

		[COLOR="#FF0000"]val[0] |= 1<<1;[/COLOR]

[COLOR="#FF0000"]		FLEXSPI2_LUT28 = LUT0(CMD_SDR, PINS1, 0x50);
		flexspi_ip_command(7, flashBaseAddr[_spiffs_region]);[/COLOR]

		  FLEXSPI2_LUT28 = LUT0(CMD_SDR, PINS1, 0x31) | LUT1(WRITE_SDR, PINS1, 1);
		  flexspi_ip_write(7, flashBaseAddr[_spiffs_region], val, 1);
	  }

Changes highlighted in Red
 
Code:
C:\Users\issac\OneDrive\Documents\Arduino\libraries\SPIFFS_t4\examples\flashtest6\flashtest6.ino Jul 22 2020 11:42:10

PSRAM: 8 MB

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

Status 1:1010000

Status 2:1010000

Status 1:1010101

Status 2:1010101

Status 1:10000

Status 2:1010111

Erasing... (may take some time)


Chip erased in 0 seconds.


Mount SPIFFS:

Status 1:1010000

Status 2:1010111

Status 1:1010101

Status 2:1010101

Status 1:1010000

Status 2:1010111

Mount ADDR 0x800000 with res: 0
Write file:

Hello World! What a wonderful World :)

errno -10010


Directory contents:

Read file:

errno -10010





    ERAM ========== memory map ===== array* ======== check24() : WRITE !!!!
ERAM length 0x7FFFFE element size of 1
took 241413 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:

It's no longer holding but it shows errorno -10010

@Han
Sorry for the delay in getting back to you but got sidetracked. Can you give this a try, it doesn't hang my T4.1

Your T4.1 set up with W25Q128JVSIM running without a problem?
 
Thanks. Looks something wit erase. But chip has life since check 24 isn’t throwing errors. QE bit is set so that’s a good sign. This would be easier when I get thE q chip to test with.
 
@Han
Yep my SIM chip is running without problems and believe me I am abusing it with all the dev work I did with it. Wonder if you could do me one mre thing. I am attaching a copy of my spiffs_t4 library that I am using. Was wondering if you could give it a try with flashtest6. Just replace your current folder with the attached. Just want to make sure we are at the same version with all the things we have been trying.
 

Attachments

  • SPIFFS_t4.zip
    257.9 KB · Views: 88
It is but we were making changes to our local copies so just want to make sure we are both on the same page. Once we get th Q version working I will push the update to github

Mike
 
Code:
C:\Users\issac\OneDrive\Documents\Arduino\libraries\SPIFFS_t4\examples\flashtest6\flashtest6.ino Jul 22 2020 12:41:10

PSRAM: 8 MB

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

Status 1:1110001

Status 2:1110001

Status 1:10000

Status 2:10010

Status 1:10000

Status 2:10010

Erasing... (may take some time)

...............................................................
Chip erased in 31 seconds.


Mount SPIFFS:

Status 1:1010000

Status 2:1010010

Status 1:1010000

Status 2:1010010

Status 1:1010000

Status 2:1010010

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 232263 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

It's working!
 
It is but we were making changes to our local copies so just want to make sure we are both on the same page. Once we get th Q version working I will push the update to github

Mike

I see, I was confused for a moment.

M version is working without a problem now.

Was it a QE bit all along?
 
Yep! Was the we bit all along! Sorry it took so long to register with me otherwise would have had you up and running a couple if days ago
 
Yes, I'm very glad that you shared with me XD

If I had to work this out alone, it could've took me months to just to understand what is really going on between T4.1 and flash memory.

I did see the difference from Q version but I had no idea I'm even guessing it right.

I don't know what to say to tell you my full gratitude. All I can say is thank you in a formal way :)
 
No need for thanks. Glad you tried it with the 'Q' version. Was bound to happen sooner or later, so appreciate letting us know that we could work out the issue. Will do some clean up and then push the changes to Github. Hope it helps your project.
 
Oh - you might want to check out this thread on MTP Responder for SPIFFS. It setup up T4.1 to look like a USB drive in Windows so you can pull your spiff files off the flash and onto the PC.

It is based on the MTP Responder which allows you to pull files from the SD Card to the PC and vice-versa.
 
It was my honor working with you.

And I can assure you that T4.1 will be the heart of our project.

Can't wait to see the official update.

Sincerely,

Alex Han
 
Alex - just pushed the update to GITHUB - same link you posted. No real changes.

Been fun - hope you can share your project at some point. Everyone is always interested - been some interesting projects out there.
 
Status
Not open for further replies.
Back
Top