Problem with flashloader on FLEXSPI2 Instance B

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

Problem with flashloader on FLEXSPI2 Instance B

Jump to solution
1,224 Views
Stulinaz
Contributor II

I have a problem with Flashloader for IMXRT1176 on Flexspi2 Instance B.

I have designed my custom board with QSPI flash on the following pins:

FLEXSPI.PNG

Following the Reference Manual at page 266 and a lot of topics in this forum related on the same flash problems, those pins are related to FLEXSPI2 intsance B.

 

flexspi2.PNG

Very good. Now its fuse problem time.

I have plugged via Jtag my board and with NXP-MCUBootUtility.exe i have read the default value of fuses that are the following ones.

Cattura.PNG

I need to modify only the follwing fuses to get the bootloader working on those pins:
FLEXSPI_INSTANCE fuse to 1 (pag 266 RM)
FLEXSPI_PIN_GROUP_SEL fuse bit to 0.  (pag 266 RM)
FLASH_CONNECTION_SEL to a value of 2.
I have stuff connected on GPIO BOOT PIN so i need also to modify the BT_FUSE_SEL fuse bit.

Cattura1.PNG

And here are the fuse bit updated via serial dowloader mode.

I restarted the board and in BOOT FROM FUSES MODE (BOOT_MODE[1:0] = 00b) and i correctly see bootloader try to boot from FLEXSPI2 PORT B (i see the CS going down and clock at 30 Mhz).

Now the are missing the 512 byte of data at address 0x200 of Flash memory so i need to modify the iMXRT117x_FlexSPI_SFDP project present at the path C:\nxp\MCUXpressoIDE_11.6.1_8255\ide\Examples\Flashdrivers\NXP\iMXRT.

HERE COMES THE PROBLEM:

I have modify the booloader project with only the instance of 2.
codeCattura.PNG
When testing with oscilloscope,
i notice that the clock is not present on the pin GPIO_EMC_B2_09 (here is my qspi connected - flexspi2 instance B) but its present on the pin GPIO_EMC_B2_10 (Thats' FLEXSPI 2 Instance A).

Do i miss something?
Why is the bootloader correctly probe the flexspi at position B(FLEXSPI2 Instance B) but when i try the flashloader project it swaps to FLEXSPI2 Instance A?
It seems to me that the bootloader skips the CONNECTION_SEL fuse bit.

@jingpan@jay_heng
Thank You all for the help.

Labels (1)
0 Kudos
Reply
1 Solution
1,147 Views
Stulinaz
Contributor II

I have solved the problem but i am not sure if its the proper way.


STEP0.0)
Burn the fuses via NXP-MCUBootUtility.exe.
Cattura1.PNG

STEP 0.1)
You need to modify in some project the const flexspi_nor_config_t qspiflash_config data structure present in "evkmimxrt1170_flexspi_nor_config.c" according to your memory. in particular change the .sflashA1Size field to .sflashB1Size.
I have made a blinky project for this test purpose.
Compile and generate HEX file with the new 512byte of memory configuration data that will be written at address 0x60000400.
Set your custom board to serial downloader mode and via NXP-MCUBootUtility.exe and connect to flashloader.
nor config.PNG

STEP 0.2)
In "Boot Device Memory" page, browse your HEX file and put the data into qspi memory present at FLEXSPI2 instance B port.
from this point if you put your bord into "boot from fuses mode", and reset it, it should start blink.

0x60000000.PNG

BACK TO FLASHLOADER USED FOR DEBUG WITH MCU IDE
You need to build it, there's no way to use existing ones. You MUST to do point 0.0 and 0.1 because the ROM API needs to find those 512 bytes at adress 0x60000400 or debugger will give the following error:

"Flash variant 'iMXRT1170_SFDP_FlexSPI2_A_QSPI Aug 3 2023 11:35:30' detected (0B = at 0x60000000)
driver describes no sectors starting at 0x60000000
Flash Driver V.2 startup failed"

Unzip the iMXRT117x_FlexSPI_SFDP.zip and open in workspace the project iMXRT117x_FlexSPI_SFDP and the LPCXFlashDriverLib.
You fill find them in C:\nxp\MCUXpressoIDE_11.6.1_8255\ide\Examples\Flashdrivers\NXP\iMXRT.
Use an existing build configuration (for example the MIMXRT1170_FlexSPI2_A_SFDP_QSPI) and build it.
if you get some errors fix the linker settings as follow:

FD0.PNG

Steps to modify the FLASHLOADER:

1) in test_main.c uncomment the line 63 "uint32_t FlashSize = flashConfig.memConfig.sflashB1Size;" and cooment  the line 62 "uint32_t FlashSize = flashConfig.memConfig.sflashA1Size;"

2) FLEXSPI_NOR_INSTANCE must be 2 and FLASH_BASE_ADDR must be 0x60000000

3) Change the #define CONFIG_OPTION0 and #define CONFIG_OPTION1 to #define CONFIG_OPTION0 0xC1000000 and #define CONFIG_OPTION1 0x20000000. Those fields may change according to your memory - look  at page 366 of processor reference manual

4) In FlashPrg.c lines 217-221 you need to modify the 
FlashDevice.szDev = flashConfig.memConfig.sflashA1Size;
to
FlashDevice.szDev = flashConfig.memConfig.sflashB1Size;
Important: Dont try to define PORT_B or somehow the flashloader will crash telling you that it does not recognise the version.
1234.png


5) Compile the flashloader.

6) Put your .axf file to your project folder and rename it to "somethingyouwant".cfx (the flashloader is recognized only as .cfx file).

7)
In your project set the flash to 0x60000000 Location (That's FLEXSPI2 address) and change the flashloader to what you have created before.

Debug the project. In my case there's an error that i need still to investigate but click ok and go over.


5678.png

Now you have the control of the debug procedure with standard breakpoint at main.

console.PNG

I hope that this helps you to get out of the imxrt flashloaders and spi alternative boot hell.

View solution in original post

0 Kudos
Reply
3 Replies
1,148 Views
Stulinaz
Contributor II

I have solved the problem but i am not sure if its the proper way.


STEP0.0)
Burn the fuses via NXP-MCUBootUtility.exe.
Cattura1.PNG

STEP 0.1)
You need to modify in some project the const flexspi_nor_config_t qspiflash_config data structure present in "evkmimxrt1170_flexspi_nor_config.c" according to your memory. in particular change the .sflashA1Size field to .sflashB1Size.
I have made a blinky project for this test purpose.
Compile and generate HEX file with the new 512byte of memory configuration data that will be written at address 0x60000400.
Set your custom board to serial downloader mode and via NXP-MCUBootUtility.exe and connect to flashloader.
nor config.PNG

STEP 0.2)
In "Boot Device Memory" page, browse your HEX file and put the data into qspi memory present at FLEXSPI2 instance B port.
from this point if you put your bord into "boot from fuses mode", and reset it, it should start blink.

0x60000000.PNG

BACK TO FLASHLOADER USED FOR DEBUG WITH MCU IDE
You need to build it, there's no way to use existing ones. You MUST to do point 0.0 and 0.1 because the ROM API needs to find those 512 bytes at adress 0x60000400 or debugger will give the following error:

"Flash variant 'iMXRT1170_SFDP_FlexSPI2_A_QSPI Aug 3 2023 11:35:30' detected (0B = at 0x60000000)
driver describes no sectors starting at 0x60000000
Flash Driver V.2 startup failed"

Unzip the iMXRT117x_FlexSPI_SFDP.zip and open in workspace the project iMXRT117x_FlexSPI_SFDP and the LPCXFlashDriverLib.
You fill find them in C:\nxp\MCUXpressoIDE_11.6.1_8255\ide\Examples\Flashdrivers\NXP\iMXRT.
Use an existing build configuration (for example the MIMXRT1170_FlexSPI2_A_SFDP_QSPI) and build it.
if you get some errors fix the linker settings as follow:

FD0.PNG

Steps to modify the FLASHLOADER:

1) in test_main.c uncomment the line 63 "uint32_t FlashSize = flashConfig.memConfig.sflashB1Size;" and cooment  the line 62 "uint32_t FlashSize = flashConfig.memConfig.sflashA1Size;"

2) FLEXSPI_NOR_INSTANCE must be 2 and FLASH_BASE_ADDR must be 0x60000000

3) Change the #define CONFIG_OPTION0 and #define CONFIG_OPTION1 to #define CONFIG_OPTION0 0xC1000000 and #define CONFIG_OPTION1 0x20000000. Those fields may change according to your memory - look  at page 366 of processor reference manual

4) In FlashPrg.c lines 217-221 you need to modify the 
FlashDevice.szDev = flashConfig.memConfig.sflashA1Size;
to
FlashDevice.szDev = flashConfig.memConfig.sflashB1Size;
Important: Dont try to define PORT_B or somehow the flashloader will crash telling you that it does not recognise the version.
1234.png


5) Compile the flashloader.

6) Put your .axf file to your project folder and rename it to "somethingyouwant".cfx (the flashloader is recognized only as .cfx file).

7)
In your project set the flash to 0x60000000 Location (That's FLEXSPI2 address) and change the flashloader to what you have created before.

Debug the project. In my case there's an error that i need still to investigate but click ok and go over.


5678.png

Now you have the control of the debug procedure with standard breakpoint at main.

console.PNG

I hope that this helps you to get out of the imxrt flashloaders and spi alternative boot hell.

0 Kudos
Reply
1,192 Views
Stulinaz
Contributor II

You need to reconfigure the following defines in Flashprg.c line 189-190:


configOption.option0.U = CONFIG_OPTION0;
configOption.option1.U = CONFIG_OPTION1;

from


#define CONFIG_OPTION0 0xC0000007

#define CONFIG_OPTION1 0x00000000

to

#define CONFIG_OPTION0 0xC1000007

#define CONFIG_OPTION1 0x2000000

after doing this, the flexspi2 instance B correctly probe the memory.

i have compiled the new flashloader but when trying to use it, the debugger crash with the following error:

errno.PNG





0 Kudos
Reply
1,162 Views
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, my name is Pavel, and I will be supporting your case, I review your information, but I review your pins for FlexSPI 2 Secondary Group Pin, I do not know how you got this info I suggest review the reference manual.

Pavel_Hernandez_0-1691106043868.png

The SCK is in the GPIO_SD_B1_01.

Pavel_Hernandez_1-1691106154575.png

Could you try to do a mass erase for the last error.
RT board recovery for debugger connect issues - NXP Community

Best regards,
Pavel

 

0 Kudos
Reply