imx rt 1024: how to set flexspi clock to 60 MHz

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

imx rt 1024: how to set flexspi clock to 60 MHz

跳至解决方案
586 次查看
bp1979
Senior Contributor I

In nor polling SDK example the flexspi clock is set to 133 MHz.

We want to use flash at 60 MHz, but it is very hard to understand what exactly needs to happen.

In app.h this code is generated:

#if defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1)
    /* 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. */
#else

In the clock tool I can configure the clock to 133 MHz

bp1979_0-1704454076067.png

I want to use it at 60 MHz

bp1979_1-1704454120061.png

Can you please tell me how to adapt the code in app.h to use the flexspi clock at 60 MHz?

    CLOCK_InitSysPfd(kCLOCK_Pfd3 ???, ???); // No clue what I fill in here
    CLOCK_SetMux(kCLOCK_FlexspiMux, 0x2); // Should this be 0x3???
    CLOCK_SetDiv(kCLOCK_FlexspiDiv, 8);

 

 

0 项奖励
1 解答
561 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @bp1979 ,

  Your understand is correct.

Just this one, div should be 7, not 8:

CLOCK_SetDiv(kCLOCK_FlexspiDiv, 7);

kerryzhou_0-1704702679151.png

kerryzhou_1-1704702688943.png

BTW, I don't think you need to use the 60Mhz in the code, if you still can use the DQS pin.

Just when you can't use the DQS pin, then you need to use the 60MHz.

Best Regards,

Kerry

 

在原帖中查看解决方案

6 回复数
573 次查看
bp1979
Senior Contributor I

I think I figured it out

 

can you confirm that this is correct?

#if defined(flash_60MHz)
    CLOCK_InitSysPfd(kCLOCK_Pfd3, 24);    /* Set PLL3 PFD2 clock 480MHz (I guess??) . */
    CLOCK_SetMux(kCLOCK_FlexspiMux, 0x1); /* Choose PLL3 PFD2 clock as flexspi source clock. */
    CLOCK_SetDiv(kCLOCK_FlexspiDiv, 8);   /* Divide 480 by 8 to get flexspi clock 60MHz. */
#else
    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. */
#endif
0 项奖励
562 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @bp1979 ,

  Your understand is correct.

Just this one, div should be 7, not 8:

CLOCK_SetDiv(kCLOCK_FlexspiDiv, 7);

kerryzhou_0-1704702679151.png

kerryzhou_1-1704702688943.png

BTW, I don't think you need to use the 60Mhz in the code, if you still can use the DQS pin.

Just when you can't use the DQS pin, then you need to use the 60MHz.

Best Regards,

Kerry

 

558 次查看
bp1979
Senior Contributor I

Oh.... my.... god... really?

I will test this this evening. But the traditional off-by-one is kind of painful in this case ;-).

Thx, this makes perfect sense anyway

0 项奖励
555 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

In face, our flexSPI is very flex, don't worry, no matter 60M or more, eg. 133Mhz, it is supported.

Just use the related configuration code.

Best Regards,

Kerry

0 项奖励
553 次查看
bp1979
Senior Contributor I

Right, I noticed that it indeed super flexible, which makes it pretty complicated. But I am hopeful again that things might finally come together now.

Just to be clear: we can't use DQS (we assigned that pin to something else in our hardware design, unfortunately), so I need to get flash running at max 60MHz. And I just learned from you that I THOUGHT I was running the flexspi clock at 60MHz, but I wasn't. 

I hope that this solves some other weird behavior I am experiencing with my second flash. I will let you know

0 项奖励
548 次查看
kerryzhou
NXP TechSupport
NXP TechSupport

Hi @bp1979 ,

  This is also easy to handle.

  Set the flexSPI freq to 60Mhz+

config.rxSampleClock = EXAMPLE_FLEXSPI_RX_SAMPLE_CLOCK;

#define EXAMPLE_FLEXSPI_RX_SAMPLE_CLOCK kFLEXSPI_ReadSampleClkLoopbackInternally

Best Regards,

Kerry

0 项奖励