Configure flash memory for the iMX RT1172 on MCUXpresso project

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

Configure flash memory for the iMX RT1172 on MCUXpresso project

1,401 Views
a_sanchez
Contributor II

Hello everyone, we have been working with iMX RT1024 for some time and now we are moving to the iMX RT1172 for a new project.

With the RT1024, we used to start with a MCUXpresso SDK example for its EVK board. At the beginning we used to run it on the EVK board and later we move it to our hardware by customizing the pinouts of the project, peripherals used, etc. This was quite straightforward.

Now, we have realized that the SDK for the iMX RT1172 has no examples since this MCU hasn't got its own EVK board. We bought the iMX RT1170 EVK, which brings the RT1176. These examples already have all the hardware preconfigured (pinouts, external memories, etc.), and they work very well and are very easy to import.

But I am having problems when trying to build a new project for the RT1172 from scratch and adding manually the external flash memory. The code runs from RAM, but when I try to move it to the QSPI flash, it fails.

Since the RT1172 is mounted on a new prototype that may have some bugs, I decided to use the RT1176 EVK for my tests and try to build a new project from scratch for the EVK board, but using the SDK for the iMX RT1176 processor instead of the SDK for the EVK board. Once I get to build a fully working project with this method, I will follow the same steps for my custom hardware with the RT1172.

These are the steps I do:

  • Create a new project on MCUXpresso, selecting the target MCU and package.
  • Select the SDK components I want to add to the project.
  • Everything goes fine, the project gets configured and compiles ok. For now the project only have RAM memories configured.
  • Then I write the code for a simple led-blink demo. Everything is okay up to this point, the demo runs okay from RAM.
  • Now I add the external flash QSPI memory, from the "MCU settings" screen. I setup its parameters and select the driver "MIMXRT1170_SFDP_QSPI.cfx". Exactly the same values that a SDK example has preconfigured.
  • I also add these preprocessor directives to the project: "XIP_EXTERNAL_FLASH=1" and "XIP_BOOT_HEADER_ENABLE=1".
  • I also double checked that the "XIP Board Driver" is added to the project from the SDK.
  • After that, I can see my demo running from the debugger, but when a power off the board and reboot again, it won't start.

I am stuck at this point, and don't know why my project behaviour is different to the SDK example. I have been navigating through all the configurations screens in MCUXpreeso but I cannot find a big difference between the SDK-example and my own-built-from-scratch project that could explain this. What am I missing?

I am using MCUXpresso IDE v11.8.0 [Build 1165] and SDK 2.14.


Thanks in advance for your help.

Best regards.

Labels (1)
Tags (3)
0 Kudos
7 Replies

1,375 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @a_sanchez ,

Please check FCB and DCD carefully. When start from reset, ROM boot need the data in these field to set the environment. If you can't find the different, you can share your project here.

 

Regards,

Jing  

0 Kudos

1,367 Views
a_sanchez
Contributor II

Hi @jingpan,

Thanks for your quick response. DCD is disabled in both projects (SDK example and mine). Anyway I added "XIP_BOOT_HEADER_DCD_ENABLE=1" to preprocessor with no changes on the behaviour. My project still runs okay when using the debugger, but when I unplug the board and boot again, it doesn't run anymore. I am using boot mode "10" (internal boot).

Attached I send my project, maybe you can find some mistake. I will keep on studying the FCB and DCD.

Thanks for your help!

Best regards,
Antonio

0 Kudos

1,361 Views
a_sanchez
Contributor II

Hi again. Update:

The project for the RT1176 is now working. It turns out that the "xip_device" driver was missing. I had added only the "xip_board" driver (located in Board Components > Board Support > SDK Drivers > xip_board). So now, I added "xip_device" driver (located on Drivers > SDK Drivers > xip_device) and my project now runs always. This driver adds the "fsl_flexspi_nor_boot" (.c and .h files) to the project, which provide the IVT needed to find the ResetISR on boot.

Now I start with the second part of my problem: I want to follow these steps with my iMX RT1172 custom board. The first issue I have found is that the "xip_board" and "xip_device" drivers are not available in this processor's SDK. Is this okay? How should I proceed in this case? I have checked that I downloaded the full SDK for this processor, including all the items.

Regards,
Antonio

0 Kudos

1,340 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @a_sanchez ,

Just add these files to your project. They are needed for XIP.

jingpan_0-1692261580887.png

 

Regards,

Jing

0 Kudos

1,330 Views
a_sanchez
Contributor II

Hi @jingpan,

Thanks, we already did that, hopefully it should work. However we still didn't manage to flash our i.MX RT1172 board. Due to lack of free pins, we had to connect the QSPI flash to FlexSPI2 (using pins GPIO_SD_B1_[00:05], which belong to secondary pin group).

The problem now is that our debugger cannot access the flash memory to program it, it seems that the boot process is not activating the FlexSPI2 correctly.

Things we have done:

  • Configure the flash start address to 0x60000000 in the MCUXpresso project.
  • Burn the fuse BT_FUSE_SEL = 1 (to use internal fuses)
  • Burn the fuse FLEXSPI_INSTANCE = 1 (to activate FlexSPI2)
  • Burn the fuse FLEXSPI_PIN_GROUP_SEL = 1 (to activate the secondary pin group for the FlexSPI2)

Anyway the flash is not being programmed. We are monitoring the SS0 and other QSPI signals with an oscilloscope but we see the MCU is not communicating to the memory.

I have seen this other post in the forums with a similar problem.

This is the console output of the MCU-LINK debugger when trying to program the flash:

 

============= SCRIPT: RT1170_connect_M7.scp =============
RT1170 Connect M7 Script
DpID = 6BA02477
APID = 0x84770001
View cores on the DAP AP
TAP 0: 6BA02477 Core 0: M7  APID: 84770001 ROM Table: E00FD003*
============= END SCRIPT ================================
Probe Firmware: MCU-LINK (r0FF) CMSIS-DAP V3.122 (NXP Semiconductors)
Serial Number:  HUR2XJC031I2S
VID:PID:  1FC9:0143
USB Path: 0003:000d:00
Using memory from core 0 after searching for a good core
( 30) Emulator Connected
( 40) Debug Halt
( 50) CPU ID
debug interface type      = CoreSight DP (DAP DP ID 6BA02477) over SWD TAP 0
processor type            = Cortex-M7 (CPU ID 00000C27) on DAP AP 0
number of h/w breakpoints = 8
number of flash patches   = 0
number of h/w watchpoints = 4
Probe(0): Connected&Reset. DpID: 6BA02477. CpuID: 00000C27. Info: <None>
Debug protocol: SWD. RTCK: Disabled. Vector catch: Disabled.
Content of CoreSight Debug ROM(s):
RBASE E00FD000: CID B105100D PID 000008E88C ROM (type 0x1)
ROM 1 E00FE000: CID B105100D PID 04000BB4C8 ROM (type 0x1)
ROM 2 E00FF000: CID B105100D PID 04000BB4C7 ROM (type 0x1)
ROM 3 E000E000: CID B105E00D PID 04000BB00C Gen SCS (type 0x0)
ROM 3 E0001000: CID B105E00D PID 04000BB002 Gen DWT (type 0x0)
ROM 3 E0002000: CID B105E00D PID 04000BB00E Gen (type 0x0)
ROM 3 E0000000: CID B105E00D PID 04000BB001 Gen ITM (type 0x0)
ROM 2 E0041000: CID B105900D PID 04001BB975 CSt ARM ETMv4.0 type 0x13 Trace Source - Core
ROM 2 E0042000: CID B105900D PID 04004BB906 CSt type 0x14 Debug Control - Trigger, e.g. ECT
ROM 1 E0043000: CID B105900D PID 04001BB908 CSt CSTF type 0x12 Trace Link - Trace funnel/router
NXP: MIMXRT1172xxxxx
DAP stride is 1024 bytes (256 words)
Inspected v.2 External Flash Device on SPI using SFDP JEDEC ID MIMXRT1170_SFDP_QSPI.cfx
Image 'iMXRT1170_SFDP_FlexSPI1_A_QSPI Jul 25 2023 09:11:32'
Opening flash driver MIMXRT1170_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 MIMXRT1170_SFDP_QSPI.cfx

 

 

Maybe this should go in a different post.

Any help or ideas you can give us will be very welcome. Thanks!

 

Regards,
Antonio

0 Kudos

1,307 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @a_sanchez ,

Yes, you should create a new ticket.

As to your problem, you can try to use MCUBootUtility according to Jay's suggestion. After you get the correct option0 and option1, you should update the download algorithm(MIMXRT1170_SFDP_QSPI.cfx). The source code is in C:\NXP\MCUXpressoIDE_11.8.0_1125_prc1\ide\Examples\Flashdrivers\NXP\iMXRT.

Replace CONFIG_OPTION0 and CONFIG_OPTION1 in FlashConfig.h with the new value.

 

Regards,

Jing

0 Kudos

647 Views
cstrahan
Contributor I

Did something change recently, or are the paths different on macOS, or...?

I figured the path would be:

/Applications/MCUXpressoIDE_11.9.0_2144/ide/Examples/Flashdrivers/NXP/iMXRT

But there is no Flashdrivers directory -- the only directories under Examples:

CMSIS_DSPLIB  CodeBundles  Legacy  LPCOpen  Misc

0 Kudos