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
I want to use it at 60 MHz
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);
Solved! Go to Solution.
Hi @bp1979 ,
Your understand is correct.
Just this one, div should be 7, not 8:
CLOCK_SetDiv(kCLOCK_FlexspiDiv, 7);
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
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
Hi @bp1979 ,
Your understand is correct.
Just this one, div should be 7, not 8:
CLOCK_SetDiv(kCLOCK_FlexspiDiv, 7);
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
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
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
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
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