External Flash for Custom Board based on iMX RT 1021

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

External Flash for Custom Board based on iMX RT 1021

13,857 Views
Dipak01
Contributor II

Hi, We are designing a custom board using iMX RT 1021 MCU. As this MCU does not have internal flash, we are using external flash of Microchip (SST26VF032BA-104I/MF) over same SPI interface which is used by MiMX RT1020 EVK for external flash interface.

Is there something we need to consider for programming or booting from this particular external flash?

Do we need LinkServer Flash driver specific to Microchip Flash?

What modification we might need to do regarding flash? How can we program external flash?

are there any utilities available that we can use?

We do have provisioned for JTAG interface and LPUART1.

Regards,

Dipak Sharma

Labels (1)
0 Kudos
Reply
39 Replies

5,835 Views
AlexChar
Contributor I

@Dipak01Any update?

0 Kudos
Reply

5,835 Views
AlexChar
Contributor I

@jeremyzhouAny update on this?
@nxpAny idea what's going on

0 Kudos
Reply

8,942 Views
Dipak01
Contributor II

Hello,

As earlier mentioned, we are running SST26VF032B-BA external QSPI NOR on MiMX RT1020 EVK.

SST26VF032B-BA  Datasheet : (http://ww1.microchip.com/downloads/en/devicedoc/20005218e.pdf)

I am running iblinky led example and have made following changes in qspi nor configuration structure.

const flexspi_nor_config_t qspiflash_config = {

   .memConfig =

   {

      .tag = FLEXSPI_CFG_BLK_TAG,

      .version = FLEXSPI_CFG_BLK_VERSION,

      .readSampleClksrc=kFlexSPIReadSampleClk_LoopbackFromDqsPad,

      .csHoldTime = 3u,

      .csSetupTime = 3u,

      .sflashPadType = kSerialFlash_1Pad, //Updated to 1Pad

      .serialClkFreq = kFlexSpiSerialClk_100MHz,

      .sflashA1Size = 4u * 1024u * 1024u,

      .deviceType = kFlexSpiDeviceType_SerialNOR,

      .lutCustomSeqEnable = 0,

      .lookupTable =

      {

// Read LUTs

      FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x0B, RADDR_SDR,       FLEXSPI_1PAD, 0x18),//Updated to 1Pad

      FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_1PAD, 0x08, READ_SDR,       FLEXSPI_1PAD, 0x04),//Updated to 1Pad

   },

},

   .pageSize = 256u,

   .sectorSize = 4u * 1024u,

   .blockSize = 64u * 1024u,

   .isUniformBlockSize = false,

};

With above changes highlighted, I have tried to program the flash using Segger J-Link Probes(Only available JTAG for now). I got success and program is running. See attached screenshot 1. Also, I can see the led blinking.

But, when I power cycle/reboot the device, board is not booting up. led is not blinking.

Now I am confused, why board is not booting after power cycle?

Questions:

Why is the board not booting after power cycle?
With Link server(SWD), the flashing is not working and the logs for failure is provided in previous post.
With MCUBoot utility device is detected but the flashing over UART gives the error as per attached screenshot. (Screenshot 2 - MCUBootUtility)

Goal:
Our goal is to use i.MXRT1021 in our custom board with external QSPI flash (SST26VF032B-BA).
We will use MCUBoot Utility over UART for factor programming in production. JTAG or SWD is for development and debug purpose. ​


Regards,
Dipak Sharma

0 Kudos
Reply

9,211 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
1) Is there something we need to consider for programming or booting from this particular external flash?
-- Firstly, we need to consider the hardware connection and please refer to MIMXRT1020 to design the circuit.
Secondly, it needs to modify the qspiflash_config struct which resides in the evkmimxrt1020_flexspi_nor_config.c to fit SST26VF032BA.
2) Do we need LinkServer Flash driver specific to Microchip Flash?
-- Before answering this question, I'd like to know what IDE and debug tool you use to develop.
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
Reply

9,201 Views
Dipak01
Contributor II

Hi,

Thanks for the information.

Do we need modification of any other struct or source in addition to qspiflash_config struct?

We are using MCUXpresso IDE v11.3.0 for development and debug purpose.

Regards,

Dipak Sharma

0 Kudos
Reply

9,196 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Do we need modification of any other struct or source in addition to qspiflash_config struct?
-- No.
In addition, I'd like to know what debug tool you use, Jlink or other tools.
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
Reply

9,192 Views
Dipak01
Contributor II

Hi,

We are using SEGGER JLink Probes provided within MCUXpresso for debug purpose.

Regards,

Dipak Sharma

0 Kudos
Reply

9,181 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply。
For the MCUXpresso IDE, it'll use Jlink's flash program algorithm instead of its own flash program algorithm when using the Jlink tool.
In another word, it needs the developer to modify Jlink's flash program algorithm to fit a particular QSPI flash. And it's a bit complicated to do that.
So I'd like to suggest you use the DAP-CMSIS type of debugging tool to develop, such as LPC-link2, MCU-link, etc, then you can use the MCUXpresso IDE own flash program algorithm.
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
Reply

9,163 Views
Dipak01
Contributor II

Hi,

Thanks for the information. Can't we use Segger JLINK EDU with NXPxpresso IDE for programming an external QFlash?

can you share any reference or document related to "DAP-CMSIS" type of debugging tool so we can look in that direction.

Segger J-LINK EDU (https://www.segger.com/products/debug-probes/j-link/models/j-link-edu/)

Regards,

Dipak Sharma

0 Kudos
Reply

8,760 Views
Masmiseim
Senior Contributor I

Hello Dipak01,

 

your Seger J-Link Adapter can now behave like a CMSIS-DAP adapter. Compare: https://www.segger.com/news/segger-j-link-now-supports-cmsis-dap/

with this you should be able to use it with MCUXpresso and also use the own flash program algorithm of MCUXpresso.

However, if you like to use this flash - which is quite exotic - it may be better to develop you own flash program algorithm / loader to have full control over it.

 

Best Regards

0 Kudos
Reply

9,161 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
As I mentioned above, it's a bit complicated to modify Jlink's flash program algorithm to fit a particular QSPI flash, so I don't suggest you do that.
NXP provides two "DAP-CMSIS" types of debugging tools, they're LPC-link2, MCU-link and you can consider them for a try.
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
Reply

9,158 Views
Dipak01
Contributor II

Hi,


Thanks for your reply.
I will look into the "DAP-CMSIS" types of debugging tools and will get back to you soon.

Regarding modification in qspiflash_config struct to fit particular flash, can you provide any reference document or more details?

Regards,

Dipak Sharma

0 Kudos
Reply

9,100 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) Regarding modification in qspiflash_config struct to fit particular flash, can you provide any reference document or more details?
-- Please refer to Table 8-14. FlexSPI Configuration block and Table 8-17. Serial NOR configuration block in the RM.
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
Reply

9,091 Views
Dipak01
Contributor II

Hey,

Sorry for being late.

We had done rework on MiMX RT1020 EVK. We removed board flash ISSI IS25LP064A (https://www.issi.com/WW/pdf/25LP032-64A-B.pdf) and in place of that we have placed SST26VF032BA (http://ww1.microchip.com/downloads/en/devicedoc/20005218e.pdf).

I am trying to program the flash using MCUXpresso IDE LinkServer but I am not able to program as I am getting following error.

"Inspected v.2 External Flash Device on SPI using SFDP JEDEC ID MIMXRT1020_SFDP_QSPI.cfx
Image 'iMXRT1020_SFDP_QSPI Dec 17 2020 10:05:09'
Opening flash driver MIMXRT1020_SFDP_QSPI.cfx
Sending VECTRESET to run flash driver
Flash variant 'JEDEC_SFDP_Device' detected (4MB = 64*64K at 0x60000000)
Closing flash driver MIMXRT1020_SFDP_QSPI.cfx
Connected: was_reset=false. was_stopped=true
Awaiting telnet connection to port 3330 ...
GDB nonstop mode enabled
Opening flash driver MIMXRT1020_SFDP_QSPI.cfx (already resident)
Sending VECTRESET to run flash driver
Flash variant 'JEDEC_SFDP_Device' detected (4MB = 64*64K at 0x60000000)
Writing 19816 bytes to address 0x60000000 in Flash
ProgramPage (0x60000000, 0x20005810, 0x4000) status 0x1 - driver reported driver error - EXTSPIJ driver rc -1 (0xFFFFFFFF)
Sectors written: 1, unchanged: 0, total: 1
Closing flash driver MIMXRT1020_SFDP_QSPI.cfx
Target error from Commit Flash write: Ef(49): Flash driver operation gave error.
GDB stub (crt_emu_cm_redlink) terminating - GDB protocol problem: Pipe has been closed by GDB."

I have tried programming the flash using Segger J-Link Probes. In this case flash in programmed successfully as I did not get any error message. But, board is not booting correctly. (See attached screenshot 1)

After that, I have tried flashloader utility. I have performed below steps to load flashloader and it is successfully done.

1. sdphost.exe -p COM6 -- error-status

2. sdphost.exe -p COM5 -- write-file 0x20208000 "..\..\mfgtools-rel\Profiles\MXRT102X\OS Firmware\ivt_flashloader.bin"

3. sdphost.exe -p COM5 -- jump-address 0x20208400

I have verified that flashloader is programmed using  "blhost.exe -d -p COM5 -- get-property 1". (Refer Screenshot 2)

Now, I have configured the memory using following commands.

- blhost.exe -p COM5 -- fill-memory 0x2000 0x4 0xC0000006
- blhost.exe -p COM5 -- configure-memory 0x9 0x2000

After doing above steps using flashloader I have again loaded an binary using MCUXpresso Segger J-Link Probes and this timer firmware is booted. (Attached screenshot 3). The LED is blinking on the EVK board.

Now, if I reboot the device the firmware is not running again. LED is not blinking on the EVK.

I have below queries

Why I am not able to program using LinkServer
Why firmware is not booting up if programmed using Segger J-Link Probes?
Why firmware is running if I configure memory using blhost utility and then flash using Segger J-Link Probes?
Why firmware is not booting up after reboot?
Please suggest and let me know if you need more information.

Regards,
Dipak Sharma

 

0 Kudos
Reply

9,052 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for the reply.
As I mentioned before, it needs the developer to modify Jlink's flash program algorithm to fit a particular QSPI flash, so I'd like to suggest you use the onboard debug interface Open-SDA instead of J-link to debug.
Next, I'd like to suggest you use the flexspi_nor_polling_transfer demo which resides in the SDK library to operate the SST26VF032BA to check the hardware connection.
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
Reply

9,048 Views
Dipak01
Contributor II

Hi,

Thanks for the information.

As I mentioned in previous reply that I tried to program the flash using MCUXpresso IDE Link Server (CMSIS-DAP) probes but did not get any success. I am getting following error. This is what you mean by Open-SDA, right? correct me if I am wrong.

"Inspected v.2 External Flash Device on SPI using SFDP JEDEC ID MIMXRT1020_SFDP_QSPI.cfx
Image 'iMXRT1020_SFDP_QSPI Dec 17 2020 10:05:09'
Opening flash driver MIMXRT1020_SFDP_QSPI.cfx
Sending VECTRESET to run flash driver
Flash variant 'JEDEC_SFDP_Device' detected (4MB = 64*64K at 0x60000000)
Closing flash driver MIMXRT1020_SFDP_QSPI.cfx
Connected: was_reset=false. was_stopped=true
Awaiting telnet connection to port 3330 ...
GDB nonstop mode enabled
Opening flash driver MIMXRT1020_SFDP_QSPI.cfx (already resident)
Sending VECTRESET to run flash driver
Flash variant 'JEDEC_SFDP_Device' detected (4MB = 64*64K at 0x60000000)
Writing 19816 bytes to address 0x60000000 in Flash
ProgramPage (0x60000000, 0x20005810, 0x4000) status 0x1 - driver reported driver error - EXTSPIJ driver rc -1 (0xFFFFFFFF)
Sectors written: 1, unchanged: 0, total: 1
Closing flash driver MIMXRT1020_SFDP_QSPI.cfx
Target error from Commit Flash write: Ef(49): Flash driver operation gave error.
GDB stub (crt_emu_cm_redlink) terminating - GDB protocol problem: Pipe has been closed by GDB."

Regards,
Dipak Sharma

0 Kudos
Reply

9,057 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
I was wondering if you can record a video of the testing process, as I'm a bit confused about your issue now.
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
Reply

9,049 Views
Dipak01
Contributor II

Hey,

Let me explain. I have MiMX RT1020-EVK (https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/i-mx-rt1020-eva...)

Now, I have performed following actions.
1. Removed QSPI flash "ISSI IS25LP064A" from MiMX RT1020-EVK and soldered other QSPI flash "SST26VF032BA".
2. Exported example project from SDK "iled_blink" in MCUXpresso IDE.
3. Now, I am trying to debug that project using "MCUXpresso IDE Link Server (CMSIS-DAP) probes" within MCUXpresso (Shown in Screenshot)


I am getting following errors while performing debug as step.

"Inspected v.2 External Flash Device on SPI using SFDP JEDEC ID MIMXRT1020_SFDP_QSPI.cfx
Image 'iMXRT1020_SFDP_QSPI Dec 17 2020 10:05:09'
Opening flash driver MIMXRT1020_SFDP_QSPI.cfx
Sending VECTRESET to run flash driver
Flash variant 'JEDEC_SFDP_Device' detected (4MB = 64*64K at 0x60000000)
Closing flash driver MIMXRT1020_SFDP_QSPI.cfx
Connected: was_reset=false. was_stopped=true
Awaiting telnet connection to port 3330 ...
GDB nonstop mode enabled
Opening flash driver MIMXRT1020_SFDP_QSPI.cfx (already resident)
Sending VECTRESET to run flash driver
Flash variant 'JEDEC_SFDP_Device' detected (4MB = 64*64K at 0x60000000)
Writing 19816 bytes to address 0x60000000 in Flash
ProgramPage (0x60000000, 0x20005810, 0x4000) status 0x1 - driver reported driver error - EXTSPIJ driver rc -1 (0xFFFFFFFF)
Sectors written: 1, unchanged: 0, total: 1
Closing flash driver MIMXRT1020_SFDP_QSPI.cfx
Target error from Commit Flash write: Ef(49): Flash driver operation gave error.
GDB stub (crt_emu_cm_redlink) terminating - GDB protocol problem: Pipe has been closed by GDB."

As of now, I can not record a video for the same.

Regards,
Dipak Sharma

0 Kudos
Reply

9,010 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
Whether you can share the qspiflash_config struct.
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
Reply

9,007 Views
Dipak01
Contributor II

Hi,

As requested, please find qspiflash_config struct below.

const flexspi_nor_config_t qspiflash_config = {
.memConfig =
{
.tag = FLEXSPI_CFG_BLK_TAG,
.version = FLEXSPI_CFG_BLK_VERSION,
.readSampleClksrc=kFlexSPIReadSampleClk_LoopbackFromDqsPad,
.csHoldTime = 3u,
.csSetupTime = 3u,
.sflashPadType = kSerialFlash_4Pads,
.serialClkFreq = kFlexSpiSerialClk_100MHz,
.sflashA1Size = 4u * 1024u * 1024u,
.lookupTable =
{
// Read LUTs
FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
},
},
.pageSize = 256u,
.sectorSize = 4u * 1024u,
.blockSize = 64u * 1024u,
.isUniformBlockSize = false,
};

Regards,
Dipak Sharma

0 Kudos
Reply