Interrupts - NXP Semiconductors MKL27Z128VFM4 Reference Manual

Table of Contents

Advertisement

Chapter 35 Serial Peripheral Interface (SPI)

35.5.13 Interrupts

The SPI originates interrupt requests only when the SPI is enabled (the SPE bit in the
SPIx_C1 register is set). The following is a description of how the SPI makes a request
and how the MCU should acknowledge that request. The interrupt vector offset and
interrupt priority are chip dependent.
Four flag bits, three interrupt mask bits, and one interrupt vector are associated with the
SPI system. The SPI interrupt enable mask (SPIE) enables interrupts from the SPI
receiver full flag (SPRF) and mode fault flag (MODF). The SPI transmit interrupt enable
mask (SPTIE) enables interrupts from the SPI transmit buffer empty flag (SPTEF). The
SPI match interrupt enable mask bit (SPIMIE) enables interrupts from the SPI match flag
(SPMF). When one of the flag bits is set, and the associated interrupt mask bit is set, a
hardware interrupt request is sent to the CPU. If the interrupt mask bits are cleared,
software can poll the associated flag bits instead of using interrupts. The SPI interrupt
service routine (ISR) should check the flag bits to determine which event caused the
interrupt. The service routine should also clear the flag bit(s) before returning from the
ISR (usually near the beginning of the ISR).
35.5.13.1 MODF
MODF occurs when the master detects an error on the SS pin. The master SPI must be
configured for the MODF feature (see the description of the C1[SSOE] bit). Once MODF
is set, the current transfer is aborted and the master (MSTR) bit in the SPIx_C1 register
resets to 0.
The MODF interrupt is reflected in the status register's MODF flag. Clearing the flag also
clears the interrupt. This interrupt stays active while the MODF flag is set. MODF has an
automatic clearing process that is described in the SPI Status Register.
35.5.13.2 SPRF
SPRF occurs when new data has been received and copied to the SPI receive data buffer.
In 8-bit mode, SPRF is set only after all 8 bits have been shifted out of the shift register
and into SPIx_DL. In 16-bit mode, SPRF is set only after all 16 bits have been shifted out
of the shift register and into SPIx_DH:SPIx_DL.
KL27 Sub-Family Reference Manual , Rev. 5, 01/2016
Freescale Semiconductor, Inc.
603

Advertisement

Table of Contents
loading

Table of Contents