Serial Peripheral Interface Module

In Full Chip Simulation (FCS) mode, this module simulates all functionality of the Serial Peripheral Interface (SPI) module including:

FCS mode uses the buffered input/output structure to simulate SPI inputs. You can queue up to 256 data values into the input buffer. The output buffer of the SPI module can also hold 256 output values. To queue the SPI Input Data, use the SPDI <n> command at the command prompt. If <n> (the data parameter) is given, the value is placed into the next slot in the input buffer.

Otherwise a window is displayed with the input buffer values. You can enter input values while the window is open. An arrow points to the next input value to the SPI. The data from the SPI input buffer is written to the SPI data register once the SPI module is turned on and is properly configured for receiving data from an external serial device. Once the simulation of the data transmission is over, the arrow moves to the next value in the SPI IN Buffer.

Figure 1. SPI IN Buffer Display
SPI IN Buffer Display

SPI data output buffer simulation lets you gain access to the past 256 SPI data values transmitted out of the module. To bring up the SPI OUT buffer dialog box, use the SPDO command.

Figure 2. SPI OUT Buffer Display
SPI OUT Buffer Display

The SPCLR command may be used at any point to flush the input and output SPI buffers. After the SPI simulated input is received, the first queued value is passed from the data buffer into the SPI data register. It can be observed in the Memory Window by displaying the memory location corresponding to the SPI data register.

Figure 3. Memory Component Window
Memory Component Window

You can also observe different SPI flags in the Memory window. If the module is run in Flag Polling mode, poll the flag corresponding to the expected SPI event. If the SPI interrupts are enabled, the FCS jumps to an appropriate subroutine as long as the SPI channel interrupt vectors are properly defined.

To simulate the frequency of the SPI slave input clock, use the SPFREQ <n> command. If the SPI is configured for slave mode, this command let you enter the number of cycles <n> in the period of the input clock. If the SPFREQ command is not used, then clocking is set by the SPI control register.

Note: For more information on how to configure the SPI module for desired operation, refer to the Freescale user manual for your microprocessor.