Unable to write image into the flash

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

Unable to write image into the flash

2,758 Views
Alessandro_Alpi
Contributor II

Hi, I've been trying to write an image into my board but I'm not able to.
I've tried various configurations but I always end up in an error.
I'm currently using MCUXpresso Secure Provisioning Tool v8.0, I'm connected via UART, I'm using a imxrt1060, my flash memory is a W25Q512JV.
I've read that it is suggested to offset the flash location from 0x60000000 to 0x60002000

Alessandro_Alpi_0-1709307887137.png

And to set XIP_BOOT_HEADER_ENABLE as 0

Alessandro_Alpi_1-1709307988752.png

 

But this way SPT (secure provisioning tool) doesn't get automatically the FCB configuration and the DCD.

Alessandro_Alpi_2-1709308093441.png

This means that I have to manually configure the boot memory type, but mine is not one of the Predefined Templates and I can't figure out a configuration that passes the test, always ending up in "FlexSPINOR: SFPD Not Found"

Alessandro_Alpi_3-1709308263277.png

Meanwhile, keeping the memory address as 0x60000000 and XIP_BOOT_HEADER_ENABLE as 1 I'm able to successfully build an image, but, when I try to write the image, I get the error "20106 FlexSPINOR: Command Failure"

Alessandro_Alpi_4-1709308426518.png

I don't know if I'm missing something or if it is a problem of my board.
If you have any suggestion on how to solve this problem I'd be glad if you could share it.
Thank you for the support.

 

 

Labels (1)
0 Kudos
Reply
10 Replies

2,722 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Alessandro_Alpi ,

    Thank you for your interest in the NXP MIMXRT product, I would like to provide service for you.

  Which board you are using? The NXP MIMXRT-EVK1060-EVK board or your customer board?

 If you are using the flash W25Q512JV, whether it is the new chip, if yes, you need to enable the quad mode at first.

 Please download this code in the RAM:

kerryzhou_0-1709527245010.png

 

https://mcuxpresso.nxp.com/en/builder?hw=MIMXRT1060-EVKC

SDK_2_14_1_MIMXRT1060-EVKC\boards\evkmimxrt1060\driver_examples\flexspi\nor\polling_transfer

Make sure the external windbond flash erase, read, write all works OK at first, after it works, then you can try the SEC tool connection in the serial download mode.

If this operation have issues with the RAM code to do the flash operation, you need to check your hardware situation.

 

Please try it at first.

If you still have question about it, please kindly let me know.

Best Regards,

Kerry

 

 

2,707 Views
Alessandro_Alpi
Contributor II

Hi, thank you for the fast response.
I'm currently using my customer board.
From what I understand my flash memory should have the quad mode enabled by default, since its the 25Q512JVBQ (if I understood correctly the "BQ" in the name means that quad mode is enabled by default).
I tried using the polling_transfer project that you suggested and it gave me this response:

Screenshot 2024-03-04 104708.png

Does this mean that it's an hardware problem? Or does it not work because I'm not using the original imxrt-1060-evk?

Thank you again for your help and I hope to hear from you soon.

0 Kudos
Reply

2,692 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Alessandro_Alpi ,

  Just to confirm, do you use the mimxrt1060-evkc sdk demo?

  As this evkc demo is using the winbond flash chip, the evk is using the issi flash, the LUT is not the same.

  Please help double confirm your used project, you can share one screen about it, I mean this code:

kerryzhou_0-1709606535742.png

Make sure the LUT related command is the same as your used flash, otherwise it will also have erase, write issues.

Another point, do you leave the DQS pin as floating? This is important, as this will influence the communication frequency.

Please help to confirm it, if all the above point is correct, it may be related to the hardware, you need to check the QSPI flash connection.

 

Wish it helps you!
If you still have question about it, pelase kindly let me know.

Best Regards,

Kerry

 

2,640 Views
Alessandro_Alpi
Contributor II

Hi Kerry,
I'm sorry for spamming replies on this thread but, after some analysis, I discovered that only write commands are getting that error (write, erase ecc...) and I've noticed that the W25Q512JV requires a write enable command to, like the name suggests, enable write commands.

I'm not sure how to send that though, since blhost doesn't have that function (as far as I'm aware).
I feel like it shouldn't be that hard but I just can't figure it out. Am I missing something?
Thank you again for the support and I hope to hear from you soon.

0 Kudos
Reply

2,597 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Alessandro_Alpi 

Write enable commander is 0X06, I find your LUT already contains it.

You don't need to try the blhost at first, you need to make your flexSPI polling code works at first, as until now, your flash operation still have issues, even with the code situation.

Do you still have issues with the flexSPI_nor_polling demo after your above LUT commander? I find that commander is matching your datasheet.

Best Regards,

Kerry

0 Kudos
Reply

2,588 Views
Alessandro_Alpi
Contributor II

Hi @kerryzhou,
The flexSPI_nor_polling demo works as intended now (loaded via MCU-link debug probe).

Screenshot 2024-03-05 104557.png

But even after matching its LUT the problem still remains:

>blhost.exe -p COM8,115200 -- flash-erase-region 0x60000000 4989372 0
Ping responded in 1 attempt(s)
Inject command 'flash-erase-region'
Response status = 20106 (0x4e8a) kStatus_FlexSPINOR_CommandFailure.

Write operations work fine, flash-erase-region seems to be the only problem.
I've noticed that the datasheet talks about sector and block erase rather then region erase but I don't know if it's relevant.

About the DQS pin issue, I set it up like this:

Screenshot 2024-03-08 104326.png

But it still gives me the same error.
May it be a flashloader issue of some kind? Maybe it gets generated wrong for some reason.
Maybe I should replace the instruction bytes with their "4-byte address" equivalent?
If anything comes to mind please let me know.

0 Kudos
Reply

2,496 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Alessandro_Alpi ,

  Do you have the USB interface for the blhost?

  I suggest you also try the blhost with USB method, just like the EVK, I don't know, whether it related to your UART, whether your UART get properity works or not?

 

Best Regards,

kerry

0 Kudos
Reply

2,653 Views
Alessandro_Alpi
Contributor II

Hi, I think that it is correct but just to be sure I'll also send you my look up table.

.lookupTable =

{

// Read LUTs

[0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),

[1] = FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),

 

// Read Status LUTs

[4 * 1 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x05, READ_SDR, FLEXSPI_1PAD, 0x04),

 

// Write Enable LUTs

[4 * 3 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x06, STOP, FLEXSPI_1PAD, 0x0),

 

// Erase Sector LUTs

[4 * 5 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x20, RADDR_SDR, FLEXSPI_1PAD, 0x18),

 

// Erase Block LUTs

[4 * 8 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xD8, RADDR_SDR, FLEXSPI_1PAD, 0x18),

 

// Pape Program LUTs

[4 * 9 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x02, RADDR_SDR, FLEXSPI_1PAD, 0x18),

[4 * 9 + 1] = FLEXSPI_LUT_SEQ(WRITE_SDR, FLEXSPI_1PAD, 0x04, STOP, FLEXSPI_1PAD, 0x0),

 

// Erase Chip LUTs

[4 * 11 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x60, STOP, FLEXSPI_1PAD, 0x0),

},


0 Kudos
Reply

2,682 Views
Alessandro_Alpi
Contributor II

Thank you for letting me know about that detail, I didn't notice it when I first tried.
I tested the right program this time (the one from the evkc) and it worked.

Screenshot 2024-03-05 104557.png

I loaded it via mcuXpresso though. I tried doing it via Secure Provisioning Tool but it gave me the same error as always (20106 (0x4e8a) FlexSPINOR: Command Failure).

About the DQS pin, I'm not 100% sure but I think it is not floating. Do you think this is what may be causing the problem?
Thank you again for your help.

0 Kudos
Reply

2,600 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @Alessandro_Alpi ,

 Yes, if your DQS pin is not floating, you need to set the flexSPI frequency to 60Mhz:

kerryzhou_0-1709879160395.png

 

And Dummy read strobe generated by FlexSPI controller and looped back internally
(FlexSPIn_MCR0[RXCLKSRC] = 0x0).

You can try the 60Mhz in Secure Provisioning Tool at first, whether you can finish the connecting and code downloading.

If you still have issues about it, please kindly let me know.

Best Regards,

Kerry

0 Kudos
Reply