QSPI Flash not detected on 2nd FlexSPI pinmux (i.MX RT 1021)

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

QSPI Flash not detected on 2nd FlexSPI pinmux (i.MX RT 1021)

8,658 Views
bbenj
Contributor III

Hello,

I'm trying to get working a custom board with a MIMXRT1021DAG5A which has a QSPI Flash (IS25LP128F-JBLE) on the 2nd pinmux option (BOOT_CFG[3:1] = 111), but I can't get the flash to be detected.

With boot config set to FlexSPI NOR on the secondary pinmux and internal boot, I tried the flexspi_nor_polling_transfert example (changing the pinmux to the 2nd flexspi option, using MCUxpresso config tools), running in RAM, but it gets stuck in flexspi_nor_enable_quad_mode (in a wait idle loop). I tried to change other config values, for which it doesn't get stuck, but the reads are wrong.

I also tried lowering the clock with no effects. Even at a low FlexSPI clock speed (36MHz) I can see that the CS line is pulsed low for less than 250ns, which doesn't seems right?

I also tested the example with the EVK and it's working with it (with the original pinmux).

I also tried MCU Boot Utility v2.0.0 (via USB), working on the EVK, but with my board it can't find the flash. Strangely, there is no activity on the 2nd flexspi pinmux option, but there is some on the default pinmux, which suggests that it doesn't use the right pins?

I'm a bit stuck right now, so any help would be welcomed.

First time using the i.MX RT but I didn't expect it would be so hard to get it working! I specifically used the same flash "model" of the EVK (just with more memory) to not have to deal with custom flash config and such.

I joined some schematics and the flexspi_nor_polling_transfert code I used.

All power lines are good, everything runs off 3V3, flash is powered, etc. The default FlexSPI pinmux is used for ethernet.

Thanks,

Benjamin

Labels (1)
0 Kudos
46 Replies

2,555 Views
bbenj
Contributor III

 Hi kerryzhou‌,

Yes, can't read/write/erase with MCU Boot Utility. Still don't work today, same error.

Can debug with CMSIS-DAP, but "Mass erase" or "Erase by sector" from GUI Flash Tool doesn't work. I don't know how to to erase without this tool.

Capture d’écran 2019-11-12 à 10.51.25.png

I joined the flexspi_QSPI_flash.h/.c & .cfx files from the Flash driver, where I did changes.

Basically I replaced the existing LUT with the LUT from the polling example, and there are differences on the NOR_CMD_LUT_SEQ_IDX_xx between the 2.

Thank you,

Benjamin

0 Kudos

2,548 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Benjamin Balga,

  Thanks for your updated information.

  What about the flexspi RAM project( flexspi_nor_polling_transfert ) for "Mass erase" or "Erase by sector"? Whether that can do the erase or mass erase with RAM debug code?

Have a great day,
Kerry

 

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

2,549 Views
bbenj
Contributor III

Hi kerryzhou

The polling example works, including the erase by sector (flexspi_nor_flash_erase_sector). The "erase chip" (NOR_CMD_LUT_SEQ_IDX_ERASECHIP) doesn't work but probably because the command isn't supported (didn't find it in the command table of the flash).

0 Kudos

2,549 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Benjamin Balga,

   If you can use the polling code to erase the sector, please erase the sectors from 0X60000000, then use the MCUbootUtility, set the max frequency to 80 Mhz, and test it again.

Have a great day,
Kerry

 

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

2,549 Views
bbenj
Contributor III

Hi kerryzhou

I erased the whole flash from RAM sector by sector with the polling code, and tested again at 80MHz and I get the same error.

Also tested at 100, 50 and 30MHz, with and without the "Enable second pinmux", but nothing better.

Capture d’écran 2019-11-14 à 11.25.33.png

Capture d’écran 2019-11-14 à 11.25.43.png

0 Kudos

2,549 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Benjamin Balga,

  Your second picture is wrong, you didn't enable Has option1, and enable second pinmux.

  Please select option1, and enable second pinmux.

Have a great day,
Kerry

 

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

2,549 Views
bbenj
Contributor III

Hi kerryzhou

That setting don't change anything. When it was working, it was not enabled but it worked anyway.

I tried anyway, same deal (error 20106).

Capture d’écran 2019-11-15 à 10.07.24.png

0 Kudos

2,549 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Benjamin Balga,

Ok, I will help to you to check it with our related department, because I don't have the board which can connect the secondary pinmux, then I can't test it directly.

Please keep patient, I will try to find some way to guide you get out.

Have a great day,
Kerry

0 Kudos

2,549 Views
bbenj
Contributor III

Hi kerryzhou

Ok, thank you. I would say it's not really urgent, as I can program and debug, erase is not absolutely needed right now. However I'm struggling with the ethernet, if you have any idea to help, thanks in advance (I opened a new post) :smileywink:

Have a nice day,

Benjamin

0 Kudos

2,553 Views
bbenj
Contributor III

Hello kerryzhou‌,

About the MCU Boot Utility:

I did exactly as in your image. Boot config is set to 111, I checked directly on the IC. Is there a way to check the boot config values used at startup?

I can boot with serial downloader, via USB. That works, but at the step to configure the external memory, it fails.

For debugging:

I did set the right .cfx file. I can program, verify and erase the flash via the debugger and the Flash GUI.

Boot config still to BOOT_CFG[3:1] = 111. BOOT_MODE to Internal boot.

I tried to burn the fuses to boot the second spi, then booted from fuses (boot_mode = 00) with my CMSIS-DAP interface, and I have the same issue (runs at a wrong address).

Also tried to boot from fuses with USB connected, and the serial downloader boots, which suggests that it fails to connect to the flash, BUT there is still no activity whatsoever on any of the flash I/Os! I also check for activity on the first FlexSPI, but nothing either. There should at least be something pulsing just a bit these IOs?! Every power supply is good (and I tested these I/Os with a program from RAM).

If I set the BOOT_CFG to the first FlexSPI, I see activity on the I/Os.

Output from MCU Boot Utility:

--------MCU device eFusemap--------

(0x450) BOOT_CFG0 = 0xe

(0x460) BOOT_CFG1 = 0x0

(0x470) BOOT_CFG2 = 0x0

BT_FUSE_SEL = 1'b0

On the EVK I see activity on the flash I/Os. If I set the boot cfg to 111 on the EVK, it boots the serial downloader (with BOOT_MODE to 10 (internal boot)) and there is no activity on the secondary pinmux I/Os.

Is the secondary SPI supposed to work at all? I am missing something??

Thanks,

Benjamin

0 Kudos

2,553 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Benjamin,

    Thanks a lot for your effort, with MCUBootUtility, please try this configuration:

pastedImage_1.png

Just enable the QE bit again.

In factory, the BOOT_CFG in default use the external GPIO pin, you don't need to modify the fuse bit,

The related pins are:

pastedImage_2.png

If you want to boot from fuse, you need to burn the fuse BT_FUSE_SEL = 1, but I am not recommend to modify the fuse in the experimental phase.

Wish it helps you!

Have a great day,
Kerry

 

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

2,553 Views
bbenj
Contributor III

Hi kerryzhou‌,

Thanks. Tried your config, doesn't work. I burned the fuses to rule out any GPIO config level issues. I known it's not "recommended", but I have nothing else to boot from anyway and nothing else worked, so gotta try everything.

The main issue here is that I don't see any activity AT ALL on the flash I/Os !! EVEN ON THE EVK!

How could it work if it doesn't even TRY to connect to the flash...

Is the second flexspi boot option even supposed to work at all?? I'm starting to question it.

Thanks,

Benjamin

0 Kudos

2,553 Views
bbenj
Contributor III

Ok, yet again, I test one day later after fiddling with it all yesterday morning, and things starts to "kinda" work.

This morning I have signals on the flash I/Os, as expected. Still no boot, but it actually boots the serial downloader, that's why it runs as 0x200000. I'm using Internal Boot.

So something goes wrong while loading the flash I guess... or some program verification failure.

Still investigating...

EDIT: And MCU Boot Utility works now, it detects the flash. "What the f*** ", but at least it's progress...

Benjamin

2,553 Views
bbenj
Contributor III

Ok, issue is, the flexspi configuration block in the bin file is wrong. How do I configure it? I edited it manually to check and got it to boot the flash correctly.

Still need to check the flash driver for the corrupted uploads. I got MCU Boot Utility to upload correctly without errors, in the end. At one point it decided to be cooperative...

0 Kudos

2,554 Views
bbenj
Contributor III

Reading flash with MCU Boot Utility shows some differences between the bin file and the content of the flash.

There are byte and half-byte offsets. Something's wrong with the flash driver I guess.

Writing with MCU Boot Utility sometimes works, other times it raises an error code 20106. (I did erase the flash first)

When writing works, I still get byte offsets.

0 Kudos

2,553 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Benjamin Balga,

   Thanks for your updated information, and sorry for my later reply.

  That's very good to hear you have make the MCUBootUtility sometimes works.

   When it works, your boot app totally work, right?

   About the error code 20106, I will help you to check it with our related department, do you mean, if you erase the flash at first, then you won't meet the 20106 error code problem, right?

  Next time, please insert your picture to the post directly, not just the attachment, then I can see it more easily.

Wish it helps you!

Have a great day,
Kerry

 

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

2,555 Views
bbenj
Contributor III

Hi kerryzhou

I had the error 20106 even if I erased first.

I posted a message below, that is not yet released from moderation, where I said that I got MCU Boot Utility to work finally without error (could read & write, was working great every time), but today, it don't want to! For whatever reason. Hardware didn't changed, but now it can't properly read the flash parameters (block size & others), I get garbage when reading, and writing returns and error code 20106.

And after trying several times, now it can't even detect the flash... :smileyangry:

But I can still upload with my CMSIS-DAP (I fixed the flash block config issue I had, modifying the flexspi_nor_config.c file). However, if I try to do a mass erase with the Flash GUI, I get an error:

Opening flash driver workspace/iMXRT1020_QSPI/iMXRT1020_QSPI/builds/MIMXRT1020-IS25LP128-FLEXSPI2.cfx

Sending VECTRESET to run flash driver

Flash device supported (16MB = 4096*4K at 0x60000000)

Mass Erase flash at 0x60000000

EraseChip (0x0, 0x0, 0x0) status 0x1 - driver reported driver error - EXTSPI driver rc 7002 (0x1B5A)

Closing flash driver iMXRT1020_QSPI/iMXRT1020_QSPI/builds/MIMXRT1020-IS25LP128-FLEXSPI2.cfx

Failed to erase flash: Ef(49): Flash driver operation gave error.

(100) Target Connection Failed

Unable to perform operation!

Command failed with exit code 1

Here is a screen capture of the issues I had this morning with MCU Boot Utility:

At first the memory sizes were wrong (3GB, should be 256B, 4k and 256KB I think) and reading returns error -4:

Capture d’écran 2019-11-11 à 11.18.25.png

Then, after a flash memory erase, no more details but I can read garbage, but erase and write doesn't work (error 20106):

Capture d’écran 2019-11-11 à 11.45.00.png

And now the flash isn't detected at all. Debugging via CMSIS-DAP works though.

I'm getting really tired of things suddenly working, then not, then a bit... I'll see tomorrow I suppose

At least I can debug code on the flash now, at last I'm able to work.

0 Kudos

2,553 Views
bbenj
Contributor III

Hi kerryzhou‌,

I modified the flash driver to match the polling example. I changed the sector size to 4K, copied the LUT from the polling example as they differs quite a bit, and other things.

Right now I can upload code to the flash with my CMSIS-DAP adapter, and the GUI Flash Tool works too.

BUT, the code don't boot at the right address, it runs at 0x200000 or so and stalls there.

The debug output prints: "Note - system reset leaves VTOR at 0x200000 (not 0x60000000 which a booted image might assume)"

I tried with the EVK and it also prints the same message, actually. But runs fine.

Any idea? Some project settings I am missing, or is it linked to the flash driver in some way?

Thanks,

Benjamin

0 Kudos

2,553 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Benjamin Balga,

   If you want to debug the code in XIP, please check the hardware:

   BOOT_CFG[10:8]=111

   BOOT_MODE = 10; Internal boot.

   The  const struct flexspi_nor_config_s flash_config need to use your QSPI configuration.

  You can refer to :

RT1050 - Debugging with QSPI flash on secondary pinmux 

  correct answer.

  In your project, please check the memory detail:

pastedImage_2.png

Do you modify the .cfx driver as your secondary pinmux?

 

Wish it helps you!

Have a great day,
Kerry

 

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

2,553 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Benjamin Balga,

 If it is your first time use the RT chip, why you don't connect the  qspi flash to FlexSPI1? They will be more easy to get start, in factor the secondary pinmux just used as the backup memory.

  If you use the lexspi_nor_polling_transfert  run in RAM also can't make your external QSPI works, I think the hardware or your modified code still has problems.

  From the RT102X RAM, your connected pins is correct.

pastedImage_1.png

So, now, can you test the FlexSPI1 secondary bus,whether there has the related QSPI wave or not?

Any updated information, please kindly let me know.

 

Have a great day,
Kerry

 

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

2,553 Views
bbenj
Contributor III

Hi Kerry,

Thank you for your help.

I couldn't route properly the flash to the first FlexSPI on the PCB (lots of other stuff around) and as I saw on this forum that using the second FlexSPI was supposed to be as easy as using the right boot configuration, I went for it.

As a new check for hardware I decided after your post to test the GPIOs with a "blinky" example code, from RAM, to verify that the I/O are working. Test ok, all GPIOs blinks correctly.

Then I run again the flexspi polling example, without any changes, and to my surprise, it worked. I really don't know why and it bothers me quite a bit. Something changed, but I don't know what.

The only thing I did last with MCU Boot Utility was to burn fuses for the secondary pinmux, as a last resort in my attempts to get the flash to work. But I'm not booting from fuses and the boot config I/O have the right levels....

I also tried with another "fresh" board that I only tested with MCU Boot Utility, and the same flexspi polling example works too.

Anyway... the polling example now works, but I still cannot upload to flash with my debugger.

There is activity on the flash I/Os when I try to debug: pulse on CS, clock on SCLK and some data on D0 & D1 (D2&D3 at 0). Unfortunately my scope isn't fast enough to read any meaningful value.

Here are the outputs with the 2 flash drivers:

Opening flash driver MIMXRT1020-EVK_IS25LP064.cfx

Sending VECTRESET to run flash driver

Flash device supported (8MB = 128*64K at 0x60000000)

Writing 32692 bytes to address 0x60000000 in Flash

ProgramPage (0x60000000, 0x20002260, 0x4000) status 0x1 - driver reported driver error - EXTSPI driver rc -2 (0xFFFFFFFE)

Closing flash driver MIMXRT1020-EVK_IS25LP064.cfx

Target error from Commit Flash write: Ef(49): Flash driver operation gave error.

Inspected v.2 External Flash Device on SPI using SFDP JEDEC ID MIMXRT1020_SFDP_QSPI.cfx

Image 'iMXRT1020_SFDP_QSPI Aug 27 2019 15:38:40'

Opening flash driver MIMXRT1020_SFDP_QSPI.cfx

Sending VECTRESET to run flash driver

Driver V.2 dynamic startup failed - driver Init provided no flash parameters

Flash Driver V.2 startup failed - rc Ef(55): Dynamic flash driver startup failed to provide flash parameters.

Terminate (0x0, 0x0, 0x0) status 0x40 - driver reports init failure - EXTSPIJ driver rc 20107 (0x4E8B)

chip initialization failed - Ef(55): Dynamic flash driver startup failed to provide flash parameters.

failed to initialize flash driver MIMXRT1020_SFDP_QSPI.cfx

Could these error codes hint to something?

Thanks,

Benjamin

0 Kudos