Steps to Operating FLEXPI2 as an Independent Device on 'iMXRT1064

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

Steps to Operating FLEXPI2 as an Independent Device on 'iMXRT1064

Jump to solution
2,312 Views
mjpovi
Contributor III

I'm attempting to test a FlexSPI2 memory device on my custom 1064 MCU based board using NXP's 'evkmimxrt1064_flexspi_nor_polling_transfer' example...

the example code works and I can access an external NOR flash device okay modifying the example code's clock, pin-mux configuration and LUT, etc. to match my FlexSpiA flash device's pin and LUT.

But when I try to modify the example code to use FlexSpi B instead of FlexSpi A to access another memory device on the FlexSpi B bus, the code crashes when the FlexSpi2 Clock Mux and/or Clock Div are configured.  I suspect the problem I am having has to do with the clock setup/configuration (clock_config.c) because the code crashes when the FlexSpi2 (B) clock is configured, even before the FlexSpi driver API is initialized (crash happens in red colored code, below).

mjpovi_0-1649367006818.png

 

/* Disable Flexspi clock gate. */
CLOCK_DisableClock(kCLOCK_FlexSpi);
/* Set FLEXSPI_PODF. */
CLOCK_SetDiv(kCLOCK_FlexspiDiv, 2);
/* Set Flexspi clock source. */
CLOCK_SetMux(kCLOCK_FlexspiMux, 2);
/* In SDK projects, external flash (configured by FLEXSPI2) will be initialized by dcd.
* With this macro XIP_EXTERNAL_FLASH, usb1 pll (selected to be FLEXSPI2 clock source in SDK projects) will be left unchanged.
* Note: If another clock source is selected for FLEXSPI2, user may want to avoid changing that clock as well.*/
#if   //////// !(defined(XIP_EXTERNAL_FLASH) && (XIP_EXTERNAL_FLASH == 1))
/* Disable Flexspi2 clock gate. */
CLOCK_DisableClock(kCLOCK_FlexSpi2);
/* Set FLEXSPI2_PODF. */
CLOCK_SetDiv(kCLOCK_Flexspi2Div, 3);
/* Set Flexspi2 clock source. */
CLOCK_SetMux(kCLOCK_Flexspi2Mux, 3);
#endif

I've configured the FlexSpi2 clock to be sourced identically as FlexSpi1 clock, but still crash.

What's unusual is that if leave my FlexSpi configuration alone except for changing the FlexSpi port in the FlexSpi configuration to PortB1, I am able to operate to my (FRAM) device in single SPI mode okay.

In the modified example code, I am only attempting to access one or the other device only, not both at the same time.

What step(s) might I be missing to successfully setup both FlexSPIA and FlexSPIB to operate one independent memory device each ?  What clock-mux or other settings for the FlexSpi2 clock are missing, and in general what steps are needed to setup both FlexSPI A and FlexSpi B ?  (I have started with the polling example but will migrate to the eDMA method).

0 Kudos
Reply
1 Solution
2,252 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) If DQS pin is routed internally, does this take care of your point regarding lack of an external DQS pin in my application?
-- Frankly, I'm not very clear with the question, whether you can clarify it again.
2) If I wish to configure FLEXSPI to work with both my devices on Port A1 and Port B1 (ref. my attached schematic in previous post). So based on your response to use only FLEXSPI, would the follow code below be a possible method of configuring the FLEXSPI driver to operate devices on both Port A1 and Port B1 (one access at a time to each device only)?
-- Yes.
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.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
8 Replies
2,287 Views
mjpovi
Contributor III

Adding pin mux and clock config...

0 Kudos
Reply
2,295 Views
mjpovi
Contributor III

Device seems to crash when the clock for FlexSPI2 is turned on.

0 Kudos
Reply
2,295 Views
mjpovi
Contributor III

To clarify, one device is connected to FlexSPIA, and the other to FlexSPIB.

 

0 Kudos
Reply
2,282 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Firstly, the RT1064 runs code in the internal Flash which connects the FlexSPI2, so it should forbid executing the code below code.
Secondly, it needs to configure the pin as the FLEXSPI_DQS besides the FLEXSPI_DATA, FLEXSPI_CLK, FLEXSPI_SS.
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
2,255 Views
mjpovi
Contributor III

Hi, and thanks for the clarification.

If DQS pin is routed internally, does this take care of your point regarding lack of an external DQS pin in my application ?

If I wish to configure FLEXSPI to work with both my devices on Port A1 and Port B1 (ref. my attached schematic in previous post).  So based on your response to use only FLEXSPI, would the follow code below be a possible method of configuring the FLEXSPI driver to operate devices on both Port A1 and Port B1 (one access at a time to each device only)?

    FLEXSPI_GetDefaultConfig(&config);
    [...]
    FLEXSPI_Init(base, &config);

    /*Get FLEXSPI default settings and configure the flexspi. */
    FLEXSPI_GetDefaultConfig(&config);
    /*Set AHB buffer size for reading data through AHB bus. */
    config.ahbConfig.enableAHBPrefetch    = true;
    [...]
    FLEXSPI_Init(base, &config);

    /* Configure flash settings according to serial flash feature (port A1) */
    FLEXSPI_SetFlashConfig(base, &deviceconfig_portA, kFLEXSPI_PortA1);
    /* Configure flash settings according to SPI memory device (port B1) */
    FLEXSPI_SetFlashConfig(base, &deviceconfig_portB, kFLEXSPI_PortB1);
    /* Update LUT table. (supports both Port A1 and Port B1 SPI Commands) */
    FLEXSPI_UpdateLUT(base, 0, customLUT, CUSTOM_LUT_LENGTH);
 
     /* Now perform a transfer to device on Port A 1 */

    flashXfer.deviceAddress = xxxxx;
    flashXfer.port = kFLEXSPI_PortA1
    flashXfer.cmdType = kFLEXSPI_Command;
    flashXfer.SeqNumber = 1;
    flashXfer.seqIndex = XXXXXXXXXX;

    status = FLEXSPI_TransferBlocking(base, &flashXfer);

 

     /* Now perform a transfer to device on Port B 1 */

    flashXfer.deviceAddress = xxxx;
    flashXfer.port = kFLEXSPI_PortB1
    flashXfer.cmdType = kFLEXSPI_Command;
    flashXfer.SeqNumber = 1;
    flashXfer.seqIndex = XXXXXXXXXX;

    status = FLEXSPI_TransferBlocking(base, &flashXfer);

0 Kudos
Reply
2,253 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
1) If DQS pin is routed internally, does this take care of your point regarding lack of an external DQS pin in my application?
-- Frankly, I'm not very clear with the question, whether you can clarify it again.
2) If I wish to configure FLEXSPI to work with both my devices on Port A1 and Port B1 (ref. my attached schematic in previous post). So based on your response to use only FLEXSPI, would the follow code below be a possible method of configuring the FLEXSPI driver to operate devices on both Port A1 and Port B1 (one access at a time to each device only)?
-- Yes.
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
2,295 Views
mjpovi
Contributor III

 

mjpovi_1-1649382790225.png

 

0 Kudos
Reply
2,300 Views
jeremyzhou
NXP Employee
NXP Employee

Hi @mjpovi ,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
According to your statement, your customize board contains two external QSPI which connect to the FlexSPI2, and it's able to access one, but, fails to access another, is my understanding right?
To be prudent, I was wondering if you can share the schematic of the board.
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