MIMXRT1021(RT1020), Firmware download using JTAG does not succeed all at once

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

MIMXRT1021(RT1020), Firmware download using JTAG does not succeed all at once

Jump to solution
1,723 Views
stanley-kylee
Contributor II

Hello.
Downloading firmware using JTAG on MIMXRT1021 does not succeed at once.
Details are as follows.

# work environment
  - IDE : MCUXpresso IDE v11.6.0 [Build 8187] [2022-07-13]
  - JTAG : MCU-LINK (r0FF) CMSIS-DAP V2.250
  - Board : Custom
  - Serial Flash : EON EN25QX64A
  - Flash Driver : Custom flash driver(.cfx) for EON EN25QX64A
                           Fixed version related to QE bit, 133Mhz operation
  - Boot Mode : Internal Boot mode (not Serial Download mode)

# JTAG connection status
  - SWDIO(MCU) - SWDIO(JTAG)
  - SWCLK(MCU) - SWCLK(JTAG)
  - 3.3V(MCU) - 3.3V(JTAG)
  - GND(MCU) - GND(JTAG)

# What I want to do
  - I want to download firmware data at once via JTAG (MCU-Link) from a custom board with an unused MCU and Serial Flash installed.

# Problem
  - When downloading firmware data with JTAG, 'error code 70' or 'Timed-out initializing flash' error occurs.
  - The problem above is that if I connect once in 'MCUBootUtility', firmware download proceeds normally with JTAG after that.

# Test progress
  - Test Board 1 : 
     1-1) Attempt to download JTAG after first connection → 'rc -70 error occurred'.
     1-2) But when I tried again after turning the power off and on, it worked fine.

  - Test Board 2 : 
      2-1) Attempt to download JTAG after first connection → 'rc -70 error occurred'.
      2-2) Disconnect and reconnect the board power. And proceed to download firmware with JTAG → Timeout occurred. (File 'xxx.bin' load failure: Ef(34): Timed-out initializing flash.)
      2-3) Power off both JTAG and board, then reconnect → Timeout occurred.
      2-4) Disconnect power after 1 connection to MCUBootUtility. And try downloading with JTAG → It worked fine.

  - Test Board 3 : 
      3-1) Disconnect power after 1 connection to MCUBootUtility. And try downloading with JTAG → rc -70 error occurred
      3-2) Disconnect power and reconnect, then download as JTAG → It worked fine.

  - Test Board 4 :
      4-1) Disconnect power after 1 connection to MCUBootUtility. And try downloading with JTAG → rc -70 error occurred
      4-2) Disconnect power and reconnect, then download as JTAG → Timeout occurred.
      4-3) Disconnect power and reconnect, then download as JTAG → Timeout occurred.
      4-4) Tried several times, but got a timeout error
      4-5) After connecting once in MCUBootUtility, download proceeds as JTAG without reset operation → It worked fine.

  - Test Board 5 :
      5-1) Attempt to download JTAG after first connection → 'rc -70 error occurred'.
      5-2) One-time connection to MCUBootUtility. The capacity information of Serial Flash is recognized as 3.99GB(?)
             --------FlexSPI NOR memory--------
             Page Size = 3.99999999907 GB
             Sector Size = 3.99999999907 GB
             Block Size = 3.99999999907 GB
      5-3) Download as JTAG → It worked fine.
      5-4) After changing Boot Mode to Serial Download mode, connect to MCUBootUtility and check the capacity information of serial flash memory → Recognized as normal size.

 

 

I wonder why it is not downloading all at once.
Why are the downloads working once I connect to the MCUBootUtility?
It seems to be an enable problem of the QE bit, please check which part is the problem.

Thank you.

Labels (1)
0 Kudos
1 Solution
1,646 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @stanley-kylee ,

I tested on my EVK board. I create a project to erase the QE bit. Modify the algorithm to add quad enable to QSPI_init(). Then I made same test like you. First erase the QE bit. Then try to download led_blinky with the original algorithm. It failed. Then use the new algorithm and try again. It can download and run immediately, needn't reset or NXP_MCUbootUtility. I tried several times. It's fine. So, I guess the difference is on the flash.

1. Please add FLEXSPI_SoftwareReset(base) to flexspi_nor_enable_quad_mode(). (But I have to say there is no difference on my side)

2. Try to use single mode page program instead of quad mode.

3. Move the same algorithm workflow to the flexspi_nor_polling_transfer example and see if it can work.

 

Regards,

Jing

View solution in original post

0 Kudos
8 Replies
1,713 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @stanley-kylee ,

I think this is because the flash algrithm(.cfx) will not program bit but MCUBootUtility can. You can make a SRAM base project which can program the QE bit. When starting a new board, MCUXpresso can download this project first to program the QE bit.

 

Regards,

Jing 

0 Kudos
1,710 Views
stanley-kylee
Contributor II

Hello @jingpan .
Thank you for your reply!

- Does it mean that the Flash Driver (.cfx) cannot set the QE bit of Serial Flash Memory?
  (If this is not possible, why does the Flash Driver exist..?)

- If my understanding is correct, does this mean that before downloading the main firmware data, I have to download the firmware that enables the QE bit (running from SRAM) first?

Thanks in advance for your reply.

0 Kudos
1,707 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @stanley-kylee ,

The source code of flash algorithm can be found in MCUXpressoIDE_11.6.0_8187\ide\Examples\Flashdrivers\NXP\iMXRT.

You can create your own algorithm base on this project.

 

Regards,

Jing

0 Kudos
1,705 Views
stanley-kylee
Contributor II

Hello @jingpan 
Thank you for your reply.

I have already modified and applied the Flash Driver.....

However, the firmware download does not happen all at once.

In this state, if I try to download firmware after connecting to MCUBootUtility, it works.

I don't understand this situation.

0 Kudos
1,696 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @stanley-kylee ,

Test Board 1 : 
     1-1) Attempt to download JTAG after first connection → 'rc -70 error occurred'.
     1-2) But when I tried again after turning the power off and on, it worked fine.

I don't know how you modify the flash algorithm. Is that means you've program QE bit successfully? And it need a reset to let flexspi configured to Quad mode?

Regards,

Jing

0 Kudos
1,685 Views
stanley-kylee
Contributor II

Hello @jingpan . Thank you for your reply.

1. I don't know how you modify the flash algorithm.

1.PNG2.PNG

   → QE bit of EON EN25QX64A flash memory is located in bit 1 of 'Status Register 2'.
        Also, Status Register 2 (WRSR2) for Write is 0x31. So I modified it as below. 

3.PNG

4.PNG

2. Is that means you've program QE bit successfully?

   → If I check the QE bit after a successful download, it is enabled.
        Read Status Register 2 of EON EN25QX64A is 0x09 or 0x35. I read it as 0x09 and confirmed that bit 1 is enabled. (0x02 returned)

3. it need a reset to let flexspi configured to Quad mode?

   → I don't understand. After trying to enable QE, the flexspi reset did not proceed. Only the QE related code has been modified. Other contents are the same as the default.

 

I'm attaching the Flash Driver project I'm working on. Any help would be appreciated.

Thank you. Have a happy day always.

0 Kudos
1,647 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi @stanley-kylee ,

I tested on my EVK board. I create a project to erase the QE bit. Modify the algorithm to add quad enable to QSPI_init(). Then I made same test like you. First erase the QE bit. Then try to download led_blinky with the original algorithm. It failed. Then use the new algorithm and try again. It can download and run immediately, needn't reset or NXP_MCUbootUtility. I tried several times. It's fine. So, I guess the difference is on the flash.

1. Please add FLEXSPI_SoftwareReset(base) to flexspi_nor_enable_quad_mode(). (But I have to say there is no difference on my side)

2. Try to use single mode page program instead of quad mode.

3. Move the same algorithm workflow to the flexspi_nor_polling_transfer example and see if it can work.

 

Regards,

Jing

0 Kudos
1,639 Views
stanley-kylee
Contributor II

Hello @jingpan 

Thanks for your kind reply. That issue has been resolved.

I've checked that the /HOLD and /WP pins are either holding low or floating.
So, the error occurred in 'ProgramPage' from the Flash Driver, the QE bit could not be set in the Flash Driver, and other symptoms of not downloading were because /HOLD and /WP were kept close to Low.

When I put a Pull-Up resistor on the /HOLD and /WP pins, everything was normal.
So, I decided to install a pull-up resistor on the two pins or use a serial flash with the QE bit initially enabled. 
(When QE is enabled, /HOLD and /WP are disabled)

Thanks for your interest in this issue.

Thank you. Have a happy day always. Good luck with you.

0 Kudos