Setting up FlexSPI LUT

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

Setting up FlexSPI LUT

Jump to solution
4,246 Views
dansmithers
Contributor III

Hi,

I am having problems integrating my prototype code to read and write QSPI Flash with the main project.

In my prototype code, I am using the FlexSPI ROM interface to erase, read and write to QSPI Flash. When I have integrated this with the main project, I get 7001 (Invalid LUT sequence) returned when I try to erase.

As far as I can tell, the code is the same. Obviously there is some difference in the setup. Can anyone suggest what might cause this issue, or how to find out why the LUT is no longer compatible?

I am using MCUXpresso 11.1.

thanks

Dan

Labels (1)
0 Kudos
1 Solution
3,774 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Sorry for the reply late, and let me clarify it.
In the below two FlexSPI API, the pointer parameter *dst and *src should point the area in the RAM
flexspi_nor_flash_read(uint32_t instance, flexspi_nor_config_t *config,
uint32_t *dst, uint32_t start, uint32_t bytes)
status_t flexspi_nor_flash_page_program(uint32_t instance, flexspi_nor_config_t
*config, uint32_t dstAddr, const uint32_t *src)

Hope it helps.
Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

View solution in original post

0 Kudos
19 Replies
4,199 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Dan,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
Before answering your question, I hope you can clarify the below inquires.
1) In the prototype code, you can use the FlexSPI ROM API to access the QSPI flash well, however, it doesn't work after porting the prototype code to the current demo project, isn't right?
2) Which board did you test on?


Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
4,166 Views
dansmithers
Contributor III

Hi Jeremy,

sorry for the delay replying.

I am using our own board, but it was based on the MXRT1060 EVK.

Yes, it was working in my prototype code, but not in the full code. The application is XIP in the QSPI flash and that seems to work until the flexSPI erase command that then seems to rewrite the LUT.

 

thanks

dan

0 Kudos
4,125 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Dan,
Sorry for the reply late, I think I need more information about your issue, as I don't have your custom board, so I was wondering if you can share a demo that I can replicate the issue when I run this demo on the MIMXRT1060 board.
Looking forward to your reply.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
4,108 Views
dansmithers
Contributor III

Hi Jeremy,

I am trying to add some code that displays my problem.

It occurs in the ROM code at 0x2115aa when called from the call to g_bootloaderTree->flexSpiNorDriver->erase(instance, config, start, length);

from flexspi_nor_flash_erase();

If you step the assembly to 0x2115ac, the values in the LUT at 0x402a8200 change and become invalid.

I hope this helps you find my problem.

thanks

dan

0 Kudos
4,093 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
Firstly, when I try to debug the project, I find that the code doesn't call the g_bootloaderTree->flexSpiNorDriver->erase actually, as the code won't stop at the breakpoint that as the figure shows.

jeremyzhou_0-1603694183891.png

 


Secondly, I'd highly recommend you upload s simplified version demo, as it can save time to figure the issue out.
Last, you'd better introduce the testing steps to replicate the issue.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
4,067 Views
dansmithers
Contributor III

Hi Jeremy,

Sorry for the delay responding, I have been on vacation.

I have worked out what the problem is. Please try commenting out the line

C4_displayError("EEPROM_Header not found.", C4_ERR_FILE_NOT_FOUND, true);

line 403 in bootloader.c This should allow you to proceed.

I will try to produce a smaller sample, but the problem has only occurred since integrating with FreeRTOS.

thanks

dan

4,042 Views
dansmithers
Contributor III

Hi Jeremy,

have you managed to see my problem?

I have made a smaller test case, that still displays my problem.

I get a still return value of 7001 from the call to flexspi_nor_flash_erase() and the LUT defined from address 0x402A8000.

Thanks for your help

dan

0 Kudos
4,025 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Sorry for the reply late. I've done several rounds of debugging, unfortunately, the code hasn't stopped at calling the g_bootloaderTree->flexSpiNorDriver->erase.
In general, I don't encounter the issue you mentioned.
By the way, I don't think this 'simple version demo' is simple actually and I was wondering if you can introduce the testing process of replicating the issue in detail.
Note: my testing board is the MIMXRT1060 board.
Have a great day,
TIC

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
4,001 Views
dansmithers
Contributor III

Hi Jeremy,

I realise that my simple solution is not very simple, but the problem only occurs in the complex case.

We have got two revisions of the MIMXRT1050 EVK that were used for initial development.

Please can you tell me whether these would be suitable for checking this problem.

Please can you confirm that you are using the MIMXRT1060 EVK board and I will look into getting a similar test set up here.

Thanks for your patience.

Dan

0 Kudos
3,990 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
Yes, my testing board is the MIMXRT1060-EVK board as the below figure shows.

jeremyzhou_0-1605591900481.png

 


Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
3,866 Views
dansmithers
Contributor III

Hi Jeremy,

I got an MIMXRTR1060-EVK and set it up today.

I have created a project based on the hello world provided with the SDK. I added the flexspi nor driver files and I am still seeing the problem. The erase function returns 7001 when called and if I step through the code the LUT at 0x402A_8000 gets changed.

I hope that this is more understandable.

thanks for your patience and help.

dan

0 Kudos
3,832 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Sorry for the reply late.
I've replicated your issue, and I also figure the issue out.
Regarding flexspi_nor_flash_eras API, the start parameter means the address in the QSPI instead of the MIMXRT1060, so the code line should be corrected below.
status_t status = flexspi_nor_flash_erase(C4_FLASH_INSTANCE, &sFlashConfig, 0x100000, 4096);
Hope it helps.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
3,792 Views
dansmithers
Contributor III

Hi Jeremy,

Many thanks for your help and patience with this problem.

Actually my code was writing correctly to the address in flash (0x100000 instead of 0x60100000).

Your response did help me to find the real problem - read and write addresses need to be 32-bit aligned. In addition, I have found that it's not possible to use this method to copy from one region in flash to another.

e.g. 0, sFlashCinfig0x112000,

status_t status = flexspi_nor_flash_page_program(C4_FLASH_INSTANCE, &sFlashConfig, 0x100000, 0x60011b1c);

dan

0 Kudos
3,775 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Sorry for the reply late, and let me clarify it.
In the below two FlexSPI API, the pointer parameter *dst and *src should point the area in the RAM
flexspi_nor_flash_read(uint32_t instance, flexspi_nor_config_t *config,
uint32_t *dst, uint32_t start, uint32_t bytes)
status_t flexspi_nor_flash_page_program(uint32_t instance, flexspi_nor_config_t
*config, uint32_t dstAddr, const uint32_t *src)

Hope it helps.
Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

 

0 Kudos
3,846 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
Ok, I'll try it soon later.
Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
4,231 Views
dansmithers
Contributor III

7001 is an error code returned from flexspi_nor_flash_erase(uint32_t instance, flexspi_nor_config_t *config, uint32_t start, uint32_t length), which calls the ROM function

g_bootloaderTree->flexSpiNorDriver->erase(instance, config, start, length);

The return value (7001) is described in Table 8-54 of the IMXRT1060RM Reference Manual.

thanks for a quick reply.

Dan

0 Kudos
4,231 Views
dansmithers
Contributor III

Further developments.

I was tracing through the program and watching the LUT and in the integrated code, the value of LUT[1] at 0x402A_8210 changes from 0x24010405 to 0x00000406 when the g_bootloaderTree->flexSpiNorDriver->erase(instance, config, start, length); function is called.

0 Kudos
4,163 Views
mjbcswitzerland
Specialist V

Dan

I never used the Flash interface in the ROM Loader but instead developed a set controlled by the application. The problem with the ones in the ROM loader is that if anything doesn't work as expected it is difficult to find out why because the code is probably not made available and deficiencies become chip errata that may or may not be solved in future (silicon) versions.

Basically black boxes can be useful for initial steps but they are frightening to have in the development loop in mission critical situations...

Regard

Mark

 

0 Kudos
4,238 Views
mjbcswitzerland
Specialist V

Hi

What is the 7001 - is it an error code form a routine or a value in a status register?

Does the following help in any way (general details about setting up LUTs)?

https://community.nxp.com/t5/i-MX-RT/Extending-Flash-Driver-to-Write-Protect-Sectors/td-p/1156970

Regards

Mark
[uTasker project developer for Kinetis and i.MX RT]
Contact me by personal message or on the uTasker web site to discuss professional training, solutions to problems or product development requirements

 

0 Kudos