QSPI Flash Help - MIMXRT1050

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

QSPI Flash Help - MIMXRT1050

1,522 Views
kamal1
Contributor III

Hello,

 

I am using the MIMXRT1050 with QSPI flash on Keilv5 IDE. My QSPI flash manual:

https://www.winbond.com/resource-files/w25q256jv%20spi%20revg%2008032017.pdf

 

I am using the flexspi_nor_polling_transfer project from the Keilv5 MDK as a base project to test code to program and erase the QSPI flash.

 

I have found that this flash can only be erased in sectors(4kB), blocks(64kB), or the entire flash. The flash is also programed through pages(256B) using boundaries. If the data being sent to the flash is greater than 256 bytes or doesn't start on a boundary, the data will wrap around the start of the boundary and continue programming until the programming is complete. 

 

Questions:

1) If I want to program a page which was programmed before, do I have to erase the entire sector in which the page is located then program my desired page?

 

2) Can I program a partial page then go back and program the rest of the page without erasing or changing the pages previous data?

 

3) If I only want to change 1 byte of data on a page which is already programmed and leave the rest of the page the same, what is the best way to do so?

 

4) From the manual, "In some cases, less than 256 bytes (a partial page) can be programmed without having any effect on other bytes within the same page. One condition to perform a partial page program is that the number of clocks cannot exceed the remaining page length." Does this mean I don’t have to erase a whole sector just to change the contents of one page? What are the cases?

 

Any help is appreciated, thanks.

Kamal

0 Kudos
7 Replies

1,315 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Kamal,

On RT1050 EVB, Hyper flash and QSPI flash can't work together. You have to do some hardware change if you want to test the on board QSPI flash. Please see the MIMXRT1050 EVK Board Hardware User’s Guide.

Step1:
Removed resistors: R356, R361 - R366.
Step2:
Weld 0Ωresistors: R153 - R158.

Regards,

Jing

0 Kudos

1,315 Views
kamal1
Contributor III

I know about the changes and they have been implemented and are working on my second board. My issue now is that the "flexspi_nor_polling_transfer" project is working fine on the board with Hyperflash and not working on the board with QSPI Flash. I believe it has to do with the example project being set up to work with hyperflash. My QSPI board is working fine with other example projects. 

Do you know of any settings that would need to be changed in code, maybe clock settings or pins?

0 Kudos

1,315 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

I have a RT1050_EVB which use spi NOR flash. It works fine. Sector erase has no problem. It doesn't need any setting change.

Regards,

Jing

0 Kudos

1,315 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Kamal,

1) If I want to program a page which was programmed before, do I have to erase the entire sector in which the page is located then program my desired page?

Yes. Before you write anything to a flash address, you must erase it first. The minimum erase unit is 4k in W25Q256. So, you must erase 4k each time.

 

2) Can I program a partial page then go back and program the rest of the page without erasing or changing the pages previous data?

For example, if you have programmed anything to address 0x20, you can't reprogram here any more without erase. After program 0x20, if you haven't program address 0x1f or 0x21, you can program there.

 

3) If I only want to change 1 byte of data on a page which is already programmed and leave the rest of the page the same, what is the best way to do so?

This is no problem. Using the page program command, following with the byte address, and then one byte data. (WREN before that)

 

4) From the manual, "In some cases, less than 256 bytes (a partial page) can be programmed without having any effect on other bytes within the same page. One condition to perform a partial page program is that the number of clocks cannot exceed the remaining page length." Does this mean I don’t have to erase a whole sector just to change the contents of one page? What are the cases?

Yes, program to the "clean" address is fine.

Regards,

Jing

1,315 Views
kamal1
Contributor III

Hi Jing,

Thanks for answering my questions. I am currently testing programming and erasing the flash using one of the given Keilv5 example projects: "flexspi_nor_polling_transfer". I can program to flash as expected but when I try to erase the flash in the location I programed already, I get errors. 

Erasing the entire flash over flexspi is working fine, but the status of the sector erase function returns "failed" and looking at the flash through the memory window shows the incorrect values such as "0x00" or "0xFE" instead of the correct value of "0xFF". Also the program will hang after failing the erase function and I get stuck in a hard fault. Shown in image 1.

Other debugging runs also hang while trying to print something through the uart. The while loop the program is hanging in is in the "LPUART_WriteBlocking" function. Shown in image 2.

Any idea why programming the flash is working but erasing is not?

Why am I getting stuck in the "LPUART_WriteBlocking" function at random times?

Thanks,

Kamal

nxp1.jpg

nxp2.jpg

0 Kudos

1,315 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

can you share your project?

Regards,

Jing

0 Kudos

1,315 Views
kamal1
Contributor III

Yes, I can. How do I go about sharing my project with you? It is basically the example project from Keilv5 "flexspi_nor_polling_transfer". I just added more print out statement for debugging and erasing a sector after writing to it. 

EDIT: I forgot to include that I am using the QSPI flash setting on my board. I have just tested my example project on the same board which uses hyperflash and it works fine. This leads me to believe that my issues are happening due to the example project expecting a hyperflash not a QSPI flash.

0 Kudos