@Harry_Zhang
The FLEXSPI cannot receive data to RXFIFO and transmit data from TXFIFO at the same time. For full SPI operation this is an issue, but in our case we can limit our driver to only RX or only TX in a single sequence.
I am now trying to make this work. I created a custom LUT which I load with fsl_flexspi.c FLEXSPI_UpdateLUT.
#define LUT_SEQUENCE_SIZE_WORDS
enum {
LUT_SEQ_IDX_WRITE = 0,
LUT_SEQ_IDX_READ = 1,
};
//this LUT only supports a simple read and a simple write
const uint32_t customLUT[] = {
[LUT_SEQUENCE_SIZE_WORDS * LUT_SEQ_IDX_WRITE] =
FLEXSPI_LUT_SEQ(kFLEXSPI_Command_WRITE_SDR, kFLEXSPI_1PAD, 0, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0),
[LUT_SEQUENCE_SIZE_WORDS * LUT_SEQ_IDX_READ] =
FLEXSPI_LUT_SEQ(kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0, kFLEXSPI_Command_STOP, kFLEXSPI_1PAD, 0),
};
My first operation that I need to get working is a read of the chip id. The operation consists of transmitting 1 byte and then reading 3 bytes.
During testing with the debugger I see that the DMA operation for the initial transmit completes. My code then configures and starts the receive operation. After this the code waits for the indication from the RX DMA however it never gets the interrupt with complete status.
I also noticed when viewing the LUT values with the debugger (using the svd) for this chip that the LUT values are updated but do not match the values that I downloaded.
I use DMA channel 2 for the rx operation. I see in EDMA (DMA0 in peripherals) that ERQ is enabled for channel 2.




The LUT shows unexpected values that do not match the data sent:
