Professional Documents
Culture Documents
Infineon-AN238230 - Quad SPI Master Emulation Using AURIX TM GTM-ApplicationNotes-V01 00-En
Infineon-AN238230 - Quad SPI Master Emulation Using AURIX TM GTM-ApplicationNotes-V01 00-En
Intended audience
This document is intended for engineers who are familiar with Infineon AURIX™ GTM and want to use Infineon
QSPI flash devices in Quad SPI mode with AURIX™ MCU.
Application note Please read the sections “Important notice” and “Warnings” at the end of this document 002-38230 Rev. **
www.infineon.com 2023-07-18
Quad SPI master emulation using AURIX™ GTM
Table of contents
Table of contents
About this document ....................................................................................................................... 1
Table of contents ............................................................................................................................ 2
1 Introduction .......................................................................................................................... 3
2 Quad SPI signals and protocol ................................................................................................. 4
2.1 QSPI flash Quad SPI signals .................................................................................................................... 4
2.2 Quad SPI protocol ................................................................................................................................... 4
3 Signal mapping between Quad SPI flash and AURIX™ GTM .......................................................... 7
4 Quad SPI master emulation ..................................................................................................... 8
4.1 Required resources ................................................................................................................................. 8
4.2 Test conditions and limitations .............................................................................................................. 8
4.3 Test setup ................................................................................................................................................ 9
4.4 Emulation overview ................................................................................................................................ 9
4.5 GTM control flow ................................................................................................................................... 10
4.6 Software control flow ............................................................................................................................ 10
4.7 QSPI IOx emulation ............................................................................................................................... 12
4.8 ARU configuration ................................................................................................................................. 13
4.9 FIFO handling ........................................................................................................................................ 13
5 Conclusion ...........................................................................................................................14
References ....................................................................................................................................15
Revision history.............................................................................................................................16
Disclaimer.....................................................................................................................................17
Introduction
1 Introduction
The AURIX™ SPI controller supports only single SPI protocol (queued SPI). However, it is possible to emulate
Quad SPI master with AURIX™ GTM so that users can use external QSPI flash with AURIX™ in Quad SPI mode to
achieve better read performance. This will improve the read performance by a factor of four.
Infineon Application Engineering team has implemented the emulation and verified with Infineon QSPI flash on
Infineon AURIX™ evaluation board.
The emulation is implemented and tested with Infineon AURIX™ TC375 Lite Kit board. Infineon S25FL-L series
QSPI flash and S25HL-T SEMPER™ Flash are tested. It can also be a reference for users who want to use other
Infineon QSPI flash devices in Quad SPI mode with AURIX™.
Figure 3 shows the Quad I/O command in QPI mode. The gray bits are optional, and the host does not have to
drive bits during that cycle. The instruction is transferred from the host to the flash device on IO0~IO3.
All communication between the host system and the QSPI flash device is in the form of units called commands.
All commands begin with an 8-bit instruction that selects the type of information transfer or device operation
to be performed. Commands may also have an address, latency period, data transfer to the flash, or data
transfer from the flash. All instruction, address, and data information are transferred sequentially between the
host system and flash device.
Quad SPI commands are structured as follows:
• Each command begins with CS# going LOW and ends with CS# returning HIGH. The flash device is selected
by the host driving the Chip Select (CS#) signal LOW throughout a command.
• The serial clock (SCK) marks the transfer of each bit or group of bits between the host and flash device.
• Each command begins with an eight-bit (byte) instruction. The instruction transfers occur on SCK rising
edges.
• The instruction may be stand alone or may be followed by address bits to select a location within the flash
device. The address transfers occur on SCK rising edge in SDR commands.
• The transfers following the instruction (i.e., address, data) are in 4-bit groups per transfer on the IO0-IO3
signals. Within the 4-bit groups, the least significant bit is on IO0. More significant bits are placed in
significance order on each higher numbered IO signal. Single bits or parallel bit groups are transferred in
most to LSb order.
• The address may be followed by write data to be stored in the flash device or by a read latency period before
read data is returned to the host.
• Write data bit transfers occur on SCK rising edge in SDR commands.
• SCK continues to toggle during any read access latency period. The latency may be zero to several SCK
cycles. At the end of the read latency cycles, the first read data bits are driven from the outputs on SCK
falling edge at the end of the last read latency cycle. The first read data bits are considered transferred to the
host on the following SCK rising edge. Each following transfer occurs on the next SCK rising edge in SDR
commands.
• If the command returns read data to the host, the flash device continues sending data transfers until the
host takes the CS# signal high. The CS# signal can be driven high after any transfer in the read data
sequence. This will terminate the command.
• At the end of a command that does not return data, the host drives the CS# input HIGH. The CS# signal must
go HIGH after the eighth bit of a standalone instruction or, of the last write data byte that is transferred.
Therefore, the CS# signal must be driven HIGH when the number of bits after the CS# signal was driven LOW
is an exact multiple of eight bits. If the CS# signal does not go HIGH exactly at the eight-bit boundary of the
instruction or write data, the command is rejected and not executed.
Application note 5 002-38230 Rev. **
2023-07-18
Quad SPI master emulation using AURIX™ GTM
• All instruction addresses are shifted into the flash device with the MSb first. The data bits are shifted in and
out of the flash device MSb first. All data is transferred in byte units with the lowest address byte sent first.
Following bytes of data are sent in lowest to highest byte address order i.e., the byte address increments.
Note:
1. I/O type is in term of flash device. E.g., Input means input for flash device
2. in is in terms of GTM, i.e., input for GTM
3. out is in terms of GTM, i.e., output for GTM
FIFO TIM
SDIO0
FIFO ATOM
RX DMA
FIFO TIM
SDIO1
FIFO ATOM
FIFO TIM
SDIO2
FIFO ATOM
TX DMA
FIFO TIM
SDIO3
FIFO ATOM
ATOM SCK
ATOM CS
SPI output: ATOM in serial shift out mode with data read from FIFOs through the ARU
• SPI input: TIM in serial shift in mode with data send to FIFOs through the ARU
• SPI clock: ATOM in PWM mode (clock continuous waveform)
• SPI CS: ATOM in PWM mode (single waveform)
• SPI transfer: ATOM in PWM mode and MCS
• Buffer management
− Adapting to GTM format (24-bit words) and byte order
− Merging and splitting bits into lanes through TriCore™ instructions (BSPILT and BMERGE)
• Bidirectional pins
− Output drivers are enabled and disabled through software
− Clock is stopped until output drivers are disable
• DMA
− DMA relives the CPU from expansive GTM accesses
MCS AGC
6. Read data from FIFO or DMA buffer and place it into read buffer
− Quad RX transfers use optimized BMERGE instruction to merge data from 4 lanes
Software can run in FIFO mode or DMA mode for both RX and TX.
Bitcounter interrupt for port direction change with high priority is enabled if needed (Quad RX).
FIFO0_CH0 ATOMx_Chy
IOx
ARU
FIFO0_CH1 TIMx_CHy
• To emulate IOx, ATOMx_Chy, and TIMx_CHy with common pin Pa.b are used. The input from the pin is
always connected to the TIM channel and the output from the ATOM channel is enabled via software to align
with the Quad SPI protocol, otherwise the output is disabled.
• For output, ATOMx_Chy is set to SOMS mode with ARU_EN =1. Command, ADDR and data to be transmitted
is stored in the corresponding FIFO channel. The output is clocked with CMU_CLK1 running at SCK
frequency. CMU_CLK1 is not used for SCK generation to adjust to internal delay but a dedicated ATOM
channel running with CMU_CLK0 (CMU_CLK0 > CMU_CLK1).
• For input capture of data transmitted from memory, TIMx_CHy is set to TSSM mode with ARU _EN =1 (to
enable data transfer to FIFO). Data incoming from memory is captured in burst of 24 bits into GPR0 register
and then automatically transferred to the corresponding FIFO channel. As capture clock a dedicated bit
clock generate via an ATOM channel in SOMP mode and sourced via the CMU_CLK7 is used. This clock can
also be used to adjust the sample point in 5 ns steps. The bit clock is enabled at the time where the first bit is
received to align the incoming data to the 24-bit of the TIM channel.
Conclusion
5 Conclusion
Although AURIX™ SPI controller supports only a single SPI protocol, it is possible to emulate Quad SPI protocol
with AURIX™ GTM so that users can use external QSPI flash with AURIX™ in Quad SPI mode to achieve better
read performance. The read throughput is improved from 6.25 MB/s to 25 MB/s at 50 MHz SDR.
The AURIX™ TC375 Lite kit board and Quad SPI master emulation software source codes are available upon
request. Please contact Infineon local sales office for more details.
References
References
Flash datasheets
[1] 002-00124: S25FL128L, S25FL256L, 128 Mb (16 MB)/256 Mb (32 MB) FL-L Flash SPI Multi-I/O, 3.0 V
[2] 002-12345: S25HS256T, S25HS512T, S25HS01GT, S25HL256T, S25HL512T, S25HL01GT, 256 Mb/512 Mb/
1 Gb SEMPER™ Flash Quad SPI, 1.8 V/3.0 V
Revision history
Revision history
Document Date Description of changes
revision
** 2023-07-18 Initial release
Trademarks
All referenced product or service names and trademarks are the property of their respective owners.