SDAA529 September   2026 MSPM33C321A

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
  5. 2Detailed Description
    1. 2.1 QSPI Controller Overview
    2. 2.2 Hardware Connection to External NOR Flash
    3. 2.3 Software Configuration
      1. 2.3.1 Driver Initialization and Flash Identification
      2. 2.3.2 Enabling Quad Mode and Programming the Flash
      3. 2.3.3 DMA-Based Quad Read
    4. 2.4 Measured Performance: Flash Read With SPI Streaming
    5. 2.5 Application Use Cases
      1. 2.5.1 Optical Modules
      2. 2.5.2 Display Applications
      3. 2.5.3 Audio Storage and Playback
  6. 3Summary
  7. 4References

DMA-Based Quad Read

The read path is the performance-critical direction for the streaming use case in this document. The example configures a quad I/O read with the dummy-cycle count required by the fast-read command, selects a 16-bit FIFO word size to halve the number of DMA transactions, and hands the transfer to QSPIFLASH_readDMA():

commandConfig.instruction = QUAD_IO_READ_CMD;

commandConfig.addressSize = QSPIFLASH_ADDRESS_SIZE_3BYTE;

commandConfig.address = ADDRESS;

commandConfig.dummyCycles = DUMMY_CYCLES_QUAD_IO_READ;

commandConfig.transferMode = QSPIFLASH_TRANSFER_MODE_QPI;

dmaConfig.startDMA = startDMARxTransfer;

dmaConfig.dmaCompleteFlag = &gDMARXDataTransferred;

DL_QSPI_setWordSize(QSPI, DL_QSPI_WORD_SIZE_16);

status = QSPIFLASH_readDMA(&handle, readback_data, sizeof(readback_data), &commandConfig, &dmaConfig);

The driver does not own the DMA channel; instead, the application supplies a start callback so the same code works with any channel assignment. The callback points the channel at the QSPI RX data register, sets the transfer size in 16-bit words, and enables the channel:

void startDMARxTransfer(const void *destAddr, uint32_t sizeBytes)

{

*(dmaConfig.dmaCompleteFlag) = false;

DL_QSPI_enableInterrupt(QSPI_0_INST, DL_QSPI_INTERRUPT_DMA_DONE_RX);

DL_DMA_setSrcAddr(DMA0, DMA0_CH0_CHAN_ID, (uint32_t)(&(QSPI->RXDATA)));

DL_DMA_setDestAddr(DMA0, DMA0_CH0_CHAN_ID, (uint32_t) destAddr);

DL_DMA_setTransferSize(DMA0, DMA0_CH0_CHAN_ID, sizeBytes / sizeof(uint16_t));

DL_DMA_enableChannel(DMA0, DMA0_CH0_CHAN_ID);

}

Completion is signaled by the QSPI DMA_DONE_RX interrupt (QSPI0, interrupt line 47). The handler sets the completion flag polled by the driver and disables the interrupt until the next transfer, a pattern that keeps the interrupt service routine to a few instructions. The write direction mirrors this structure on a second DMA channel targeting the QSPI TX data register.

Three practical notes from the example apply to any application built on this driver:

  • Select DL_QSPI_WORD_SIZE_16 when the transfer length is even and the DMA moves 16-bit words; fall back to 8-bit word size for odd byte counts
  • Re-arm the DMA_DONE interrupt inside the start callback and disable it in the handler, so a stale interrupt cannot fire between transfers
  • After streaming completes, QSPIFLASH_disableQuadMode() and QSPIFLASH_deinit() return the flash to SPI mode, which keeps the device recoverable by standard tools and bootloaders

The example verifies the readback buffer word-for-word against the programmed pattern and reports pass/fail on the LaunchPad LEDs, providing a self-checking starting point before the application replaces the test pattern with real asset data.