SPI Peripheral Library Interface for MPLAB® Harmony v2

Detailed descriptions for this library can be found on MPLAB® Harmony v2 Help and Documentation ( found in the <harmony install directory>/doc folder).

General Configurations and Status Functions

Function Name Description
PLIB_SPI_BaudRateClockSelect Selects the type of clock is used by the Baud Rate Generator
PLIB_SPI_BaudRateSet Sets the baud rate to the desired value
PLIB_SPI_ClockPolaritySelect Enables clock polarity
PLIB_SPI_CommunicationWidthSelect Selects the data width for the Serial Peripheral Interface (SPI) communication
PLIB_SPI_Disable Disables the SPI module
PLIB_SPI_Enable Enables the SPI module
PLIB_SPI_ErrorInterruptDisable Disables SPI error interrupts
PLIB_SPI_ErrorInterruptEnable Enables SPI error interrupts
PLIB_SPI_FIFOCountGet Reads the SPI Buffer Element Count bits for either receive or transmit
PLIB_SPI_FIFODisable Disables the SPI enhanced buffer
PLIB_SPI_FIFOInterruptModeSelect Selects the SPI buffer interrupt mode
PLIB_SPI_FIFOShiftRegisterIsEmpty Returns the current status of the SPI shift register
PLIB_SPI_InputSamplePhaseSelect Selects the SPI data input sample phase
PLIB_SPI_IsBusy Returns the current SPI module activity status
PLIB_SPI_MasterEnable Enables the SPI in Master mode
PLIB_SPI_OutputDataPhaseSelect Selects serial output data change
PLIB_SPI_PinDisable Enables the selected SPI pins
PLIB_SPI_PinEnable Enables the selected SPI pins
PLIB_SPI_ReadDataIsSignExtended Returns the current status of the receive (RX) FIFO sign-extended data
PLIB_SPI_SlaveEnable Enables the SPI in Slave mode
PLIB_SPI_SlaveSelectDisable Disables Master mode slave select
PLIB_SPI_SlaveSelectEnable Enables Master mode slave select
PLIB_SPI_StopInIdleDisable Continues module operation when the device enters Idle mode
PLIB_SPI_StopInIdleEnable Discontinues module operation when the device enters Idle mode

Data Transfer Functions

Function Name Description
PLIB_SPI_BufferClear Clears the SPI buffer
PLIB_SPI_BufferRead Returns the SPI buffer value
PLIB_SPI_BufferAddressGet Returns the address of the SPIxBUF (Transmit(SPIxTXB) and Receive (SPIxRXB)) register
PLIB_SPI_BufferRead16bit Returns 16-bit SPI buffer value
PLIB_SPI_BufferRead32bit Returns 32-bit SPI buffer value
PLIB_SPI_BufferWrite Write the data to the SPI buffer
PLIB_SPI_BufferWrite16bit Writes 16-bit data to the SPI buffer
PLIB_SPI_BufferWrite32bit Write 32-bit data to the SPI buffer

Frame Mode Functions

Function Name Description
PLIB_SPI_FramedCommunicationDisable Disables framed SPI support
PLIB_SPI_FramedCommunicationEnable Enables framed SPI support
PLIB_SPI_FrameErrorStatusGet Returns the current status of the SPI frame error
PLIB_SPI_FrameErrorStatusClear Clears the SPI frame error flag
PLIB_SPI_FrameSyncPulseCounterSelect Selects at which character the SPI frame sync pulse is generated
PLIB_SPI_FrameSyncPulseDirectionSelect Selects the frame sync pulse direction
PLIB_SPI_FrameSyncPulseEdgeSelect Selects the frame sync pulse edge
PLIB_SPI_FrameSyncPulsePolaritySelect Selects the frame sync pulse polarity
PLIB_SPI_FrameSyncPulseWidthSelect Sets the frame sync pulse width

Audio Mode Functions

Function Name Description
PLIB_SPI_AudioCommunicationWidthSelect Selects the data width for the SPI audio communication
PLIB_SPI_AudioErrorDisable Disables the SPI error
PLIB_SPI_AudioErrorEnable Enables the SPI error
PLIB_SPI_AudioProtocolDisable Audio protocol is disabled
PLIB_SPI_AudioProtocolEnable Audio protocol is enabled
PLIB_SPI_AudioProtocolModeSelect Selects the Audio Protocol mode
PLIB_SPI_AudioTransmitModeSelect Selects the transmit audio data format

Transmitter Functions

Function Name Description
PLIB_SPI_TransmitBufferIsEmpty Returns the current status of the transmit buffer
PLIB_SPI_TransmitBufferIsFull Returns the current transmit buffer status of the SPI module
PLIB_SPI_TransmitUnderRunStatusGet Returns the current status of the transmit underrun
PLIB_SPI_TransmitUnderRunStatusClear Clears the SPI transmit underrun flag

Receiver Functions

Function Name Description
PLIB_SPI_ReceiverBufferIsFull Returns the current status of the SPI receive buffer
PLIB_SPI_ReceiverFIFOIsEmpty Returns the current status of the SPI receive FIFO
PLIB_SPI_ReceiverHasOverflowed Returns the current status of the SPI receiver overflow
PLIB_SPI_ReceiverOverflowClear Clears the SPI receive overflow flag

Feature Existence Functions

Function Name Description
PLIB_SPI_ExistsAudioCommunicationWidth Identifies whether the AudioCommunicationWidth feature exists on the SPI module
PLIB_SPI_ExistsAudioErrorControl Identifies whether the AudioErrorControl feature exists on the SPI module
PLIB_SPI_ExistsAudioProtocolControl Identifies whether the AudioProtocolControl feature exists on the SPI module
PLIB_SPI_ExistsAudioProtocolMode Identifies whether the AudioProtocolMode feature exists on the SPI module
PLIB_SPI_ExistsAudioTransmitMode Identifies whether the AudioTransmitMode feature exists on the SPI module
PLIB_SPI_ExistsBaudRate Identifies whether the BaudRate feature exists on the SPI module
PLIB_SPI_ExistsBaudRateClock Identifies whether the BaudRateClock feature exists on the SPI module
PLIB_SPI_ExistsBuffer Identifies whether the Buffer feature exists on the SPI module
PLIB_SPI_ExistsBusStatus Identifies whether the BusStatus feature exists on the SPI module
PLIB_SPI_ExistsClockPolarity Identifies whether the ClockPolarity feature exists on the SPI module
PLIB_SPI_ExistsCommunicationWidth Identifies whether the CommunicationWidth feature exists on the SPI module
PLIB_SPI_ExistsEnableControl Identifies whether the EnableControl feature exists on the SPI module
PLIB_SPI_ExistsErrorInterruptControl Identifies whether the ErrorInterruptControl feature exists on the SPI module
PLIB_SPI_ExistsFIFOControl Identifies whether the FIFOControl feature exists on the SPI module
PLIB_SPI_ExistsFIFOCount Identifies whether the FIFOCount feature exists on the SPI module
PLIB_SPI_ExistsFIFOInterruptMode Identifies whether the FIFOInterruptMode feature exists on the SPI module
PLIB_SPI_ExistsFIFOShiftRegisterEmptyStatus Identifies whether the FIFOShiftRegisterEmptyStatus feature exists on the SPI module
PLIB_SPI_ExistsFramedCommunication Identifies whether the FramedCommunication feature exists on the SPI module
PLIB_SPI_ExistsFrameErrorStatus Identifies whether the FrameErrorStatus feature exists on the SPI module
PLIB_SPI_ExistsFrameSyncPulseCounter Identifies whether the FrameSyncPulseCounter feature exists on the SPI module
PLIB_SPI_ExistsFrameSyncPulseDirection Identifies whether the FrameSyncPulseDirection feature exists on the SPI module
PLIB_SPI_ExistsFrameSyncPulseEdge Identifies whether the FrameSyncPulseEdge feature exists on the SPI module
PLIB_SPI_ExistsFrameSyncPulsePolarity Identifies whether the FrameSyncPulsePolarity feature exists on the SPI module
PLIB_SPI_ExistsFrameSyncPulseWidth Identifies whether the FrameSyncPulseWidth feature exists on the SPI module
PLIB_SPI_ExistsInputSamplePhase Identifies whether the InputSamplePhase feature exists on the SPI module
PLIB_SPI_ExistsMasterControl Identifies whether the MasterControl feature exists on the SPI module
PLIB_SPI_ExistsOutputDataPhase Identifies whether the OutputDataPhase feature exists on the SPI module
PLIB_SPI_ExistsPinControl Identifies whether the PinControl feature exists on the SPI module
PLIB_SPI_ExistsReadDataSignStatus Identifies whether the ReadDataSignStatus feature exists on the SPI module
PLIB_SPI_ExistsReceiveBufferStatus Identifies whether the ReceiveBufferStatus feature exists on the SPI module
PLIB_SPI_ExistsReceiveFIFOStatus Identifies whether the ReceiveFIFOStatus feature exists on the SPI module
PLIB_SPI_ExistsReceiverOverflow Identifies whether the ReceiverOverflow feature exists on the SPI module
PLIB_SPI_ExistsSlaveSelectControl Identifies whether the SlaveSelectControl feature exists on the SPI module
PLIB_SPI_ExistsStopInIdleControl Identifies whether the StopInIdle feature exists on the SPI module
PLIB_SPI_ExistsTransmitBufferEmptyStatus Identifies whether the TransmitBufferEmptyStatus feature exists |on the SPI module
PLIB_SPI_ExistsTransmitBufferFullStatus Identifies whether the TransmitBufferFullStatus feature exists on the SPI module
PLIB_SPI_ExistsTransmitUnderRunStatus Identifies whether the TransmitUnderRunStatus feature exists on the SPI module
PLIB_SPI_Exists16bitBuffer Identifies whether the Buffer16bit feature exists on the SPI module
PLIB_SPI_Exists32bitBuffer Identifies whether the Buffer32bit feature exists on the SPI module

Data Types and Constants

Name Description
SPI_AUDIO_COMMUNICATION_WIDTH Defines the list of SPI audio communication width
SPI_AUDIO_ERROR Defines the list of SPI audio error
SPI_AUDIO_PROTOCOL Data type defining the audio protocol mode
SPI_AUDIO_TRANSMIT_MODE Defines the list of SPI transmit audio mode format
SPI_BAUD_RATE_CLOCK Defines the list of SPI Baud Rate Generator (BRG)
SPI_CLOCK_POLARITY Defines the list of SPI clock polarity
SPI_COMMUNICATION_WIDTH Defines the list of SPI communication width
SPI_DATA_TYPE Data type defining the SPI data size
SPI_ERROR_INTERRUPT Defines the list of SPI error interrupts
SPI_FIFO_INTERRUPT Defines the list of SPI Buffer Interrupt mode
SPI_FIFO_TYPE Defines the list of SPI buffer mode
SPI_FRAME_PULSE_DIRECTION Defines the list of SPI frame sync pulse direction
SPI_FRAME_PULSE_EDGE Defines the list of SPI frame sync pulse edge
SPI_FRAME_PULSE_POLARITY Defines the list of SPI frame sync pulse polarity
SPI_FRAME_PULSE_WIDTH Defines the list of SPI frame sync pulse width
SPI_FRAME_SYNC_PULSE Data type defining the frame sync pulse counter values
SPI_INPUT_SAMPLING_PHASE Defines the list of SPI data input sample phase
SPI_MODULE_ID Identifies the supported SPI modules
SPI_OUTPUT_DATA_PHASE Defines the list of SPI serial output data changes
SPI_PIN Data type defining the SPI pin
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.