imx rt 1024: flexpi clock when flash supposed to run 60 MHz?

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

imx rt 1024: flexpi clock when flash supposed to run 60 MHz?

350 Views
bp1979
Senior Contributor I

We have a custom board where we can't use the DQS pad for flexspi port A, and thus we can only run flash at a max speed of 60 MHz.

In the nor polling SDK example, I made the following changes in system_MIMX1024.c (called from startup code) to accommodate for the 60 MHz requirement.

    /* Configure FLEXSPI_A_DQS */
    // CHANGE #1: Disabled, we don't have DQS pad available
    // IOMUXC -> SW_MUX_CTL_PAD[86] = IOMUXC_SW_MUX_CTL_PAD_MUX_MODE(1) | IOMUXC_SW_MUX_CTL_PAD_SION(1);

    /* Disable I cache */
    if (SCB_CCR_IC_Msk == (SCB_CCR_IC_Msk & SCB->CCR))
    {
        SCB_DisableICache();
    }

    /* Re-Configure FLEXSPI NOR via ROM API, for details please refer to the init function of ROM FLEXSPI NOR flash
       driver which is in fsl_romapi.h and fsl_romapi.c in the devices\${soc}\drivers directory of SDK package */
    uint8_t flexspi_nor_config[512];
    memcpy((void *)flexspi_nor_config, (void *)FLASH_CONFIG_ADDRESS, sizeof(flexspi_nor_config));
    //flexspi_nor_config[12] = 1U;  /* kFLEXSPIReadSampleClk_LoopbackFromDqsPad */
    //flexspi_nor_config[70] = 7U;  /* kFLEXSPISerialClk_133MHz */
    flexspi_nor_config[12] = 0U;  /* CHANGE #2: kFLEXSPIReadSampleClk_LoopbackInternally */
    flexspi_nor_config[70] = 3U;  /* CHANGE #3: kFLEXSPISerialClk_60MHz */

    flexspi_nor_init_t  flash_init = (flexspi_nor_init_t)ROM_FLASH_INIT_ADDRESS;
    flash_init(0U, flexspi_nor_config);

 

But, I also see that this SDK example configures the FlexSPI clock (app.h, flexspi_clock_init):

    /* Switch to PLL2 for XIP to avoid hardfault during re-initialize clock. */
    CLOCK_InitSysPfd(kCLOCK_Pfd2, 24);    /* Set PLL2 PFD2 clock 396MHZ. */
    CLOCK_SetMux(kCLOCK_FlexspiMux, 0x2); /* Choose PLL2 PFD2 clock as flexspi source clock. */
    CLOCK_SetDiv(kCLOCK_FlexspiDiv, 2);   /* flexspi clock 133M. */

 

Can I leave the FlexSPI clock running at 133 MHz when flash is supposed to run at 60 MHz?

Or do I need to reconfigure clocks to get a FlexSPI clock frequency that is exactly 60 MHz?

 

Does the FlexSPI clock frequency need to correspond with the configured flash speed?

 

 

0 Kudos
5 Replies

329 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @bp1979 ,

  Please check the content from the RT1024, you will get the answer:

kerryzhou_0-1704362713457.png

kerryzhou_1-1704362719290.png

 

ROM didnt use the DQS, so the FCB limit to the 60Mhz.

But in the code, if you enable the DQS, then you change to more than 60Mhz, it's OK to use.

 

Best Regards,

Kerry

 

 

0 Kudos

319 Views
bp1979
Senior Contributor I

@kerryzhou 

The question is not how I can get a faster flash speed. The question is what is the relation between the FlexSPI clock and the frequency that flash is running at.

I have done some testing, and it seems to work in either case. When I set FlexSPI clock to 133 MHz, or when I comment out the code completely (leaving the FlexSPI in default state set by ROM?)

Also when I try different values for the divider, flash on port A and port B seem to work just fine.

So how does the flash device know on which frequency it should operate? Is this defined by the FlexSPI clock or something else?

0 Kudos

314 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @bp1979 ,

 Please check the datasheet, you will find the flexSPI clock max situation with the DQS method:

kerryzhou_0-1704445466781.png

 

Best Regards,

kerry

 

0 Kudos

309 Views
bp1979
Senior Contributor I

@kerryzhou 

So you say that settings MCR0[RXCLKSRC] = 0x0 will set the FlexSPI clock in 60 MHz?

So what does this do then:

bp1979_0-1704449084569.png

 

0 Kudos

253 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @bp1979 ,

  You misunderstand me, let me share more details.

1. 60Mhz,  MCR0[RXCLKSRC] = 0x0, is the default for the XIP FCB.

kerryzhou_0-1704699423652.png

Reason: The FLEXSPI_A_DQS pad is not supported by ROM
natively in RT1024, which restricts the maximum FLASH
frequency to 60MHz.

 

2. To your mentioned, it is the SDK flexspi_nor_polling_transfer project.

In the code, you can use higher than 60Mhz if you init the DQS pin, please check the pin_mux.c, you will find it.

kerryzhou_1-1704699654311.png

kerryzhou_2-1704699660640.png

Then, you can use the code to set more than 60Mhz:

kerryzhou_3-1704699705491.png

kerryzhou_4-1704699723641.png

 

All the reason is determined by you define the DQS pin or not.

 

Wish it helps you!

Best Regards,

Kerry

 

 

 

0 Kudos