How to use configCmdArgs in flexspi_mem_config_t

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

How to use configCmdArgs in flexspi_mem_config_t

1,124 Views
espp
Contributor I

Hello,

We are currently using XIP from external flash in OPI mode, and need to write to the configuration register of the external flash controller before XIP starts.

I'm looking at the flexspi_mem_config_t struct on how to perform device configuration. Currently we are using deviceModeSeq to configure the flash controller in OPI mode, so I cannot use that field to configure the configuration register.

However, I noticed that you can seemingly configure additional configuration sequences under the configCmdSeqs field. Am I correct in that? The documentation is lacking on this specific field, however, I've set it to the following:

.configCmdEnable = 1,
.configModeType = {
  [0] = kDeviceConfigCmdType_Generic,
},
.configCmdSeqs = {
  [0] = {
    .seqNum = 1,
    .seqId = 10, // See Lookup table for more details
    .reserved = 0,
  },
},
.configCmdArgs = {
  [0] = (0x00 << 0) | (0x2 << 8),
},

and the LUT table is populated with the following command at index 10:

.lookupTable = {
  // Other commands omitted
  [4 * 10 + 0] = FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0x01, WRITE_SDR, FLEXSPI_1PAD, 0x02),
},

But it seems like this doesn't work. 

Do I need to execute a write enable command in the sequence table before executing the config command sequence?

0 Kudos
4 Replies

1,091 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi,

You are correct, configCmdSeqs is the Sequence info for Device Configuration command. Write enable command is not needed, the ROM does that for you.

Best regards,

Felipe

1,080 Views
espp
Contributor I

Hi Felipe,

Thanks, good to know!

In which order is deviceModeSeq and configCmdSeqs? deviceModeSeq first, then configCmdSeqs, or vice versa?

0 Kudos

969 Views
samrg123
Contributor I

From probing the SPI bus of a RT1176 it looks like deviceModeSeq is sent first

0 Kudos

1,058 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi,

I am not sure if I am understanding correctly. You can check the flash configuration block in the RM to see the appropriate offset. ROM will save all LUT items provided by user and then load it into LUT registers.

Best regards,

Felipe

0 Kudos