MCBSP Module¶
The Multichannel Buffered Serial Port (McBSP) API provides a set of functions to configure device’s McBSP module. The driver provides functions to initialize the module, configure module Transmitter, Receiver and Sample Rate Generator, obtain status/error information and to manage interrupts. APIs are also available to configure McBSP in SPI mode.
-
group
mcbsp_api
Defines
-
MCBSP_XCR1_M
(MCBSP_XCR1_XWDLEN1_M| \
MCBSP_XCR1_XFRLEN1_M)¶
-
MCBSP_RCR1_M
(MCBSP_RCR1_RWDLEN1_M| \
MCBSP_RCR1_RFRLEN1_M)¶
-
MCBSP_XCR2_M
(MCBSP_XCR2_XWDLEN2_M| \
MCBSP_XCR2_XFRLEN2_M)¶
-
MCBSP_RCR2_M
(MCBSP_RCR2_RWDLEN2_M| \
MCBSP_RCR2_RFRLEN2_M)¶
-
MCBSP_RX_NO_ERROR
0x0U¶ No error.
-
MCBSP_RX_BUFFER_ERROR
0x4U¶ Buffer Full.
-
MCBSP_RX_FRAME_SYNC_ERROR
0x8U¶ Frame sync error.
-
MCBSP_RX_BUFFER_FRAME_SYNC_ERROR
0xCU¶ Buffer and frame sync error.
-
MCBSP_TX_NO_ERROR
0x0U¶ No error.
-
MCBSP_TX_BUFFER_ERROR
0x4U¶ Buffer overrun.
-
MCBSP_TX_FRAME_SYNC_ERROR
0x8U¶ Frame sync error.
-
MCBSP_TX_BUFFER_FRAME_SYNC_ERROR
0xCU¶ Buffer and frame sync error.
-
MCBSP_ERROR_EXCEEDED_CHANNELS
0x1U¶ Exceeded number of channels.
-
MCBSP_ERROR_2_PARTITION_A
0x2U¶ Error in 2 partition A setup.
-
MCBSP_ERROR_2_PARTITION_B
0x4U¶ Error in 2 partition B setup.
-
MCBSP_ERROR_INVALID_MODE
0x8U¶ Invalid mode.
Enums
-
enum
McBSP_RxSignExtensionMode
¶ Values that can be passed to McBSP_setRxSignExtension() as the mode parameters.
Values:
-
enumerator
MCBSP_RIGHT_JUSTIFY_FILL_ZERO
= 0x0000U¶ Right justify and zero fill MSB.
-
enumerator
MCBSP_RIGHT_JUSTIFY_FILL_SIGN
= 0x2000U¶ Right justified sign extended into MSBs.
-
enumerator
MCBSP_LEFT_JUSTIFY_FILL_ZER0
= 0x4000U¶ Left justifies LBS filled with zero.
-
enumerator
-
enum
McBSP_ClockStopMode
¶ Values that can be passed to McBSP_setClockStopMode() as the mode parameter.
Values:
-
enumerator
MCBSP_CLOCK_MCBSP_MODE
= 0x0000U¶ Disables clock stop mode.
-
enumerator
MCBSP_CLOCK_SPI_MODE_NO_DELAY
= 0x1000U¶ Enables clock stop mode.
-
enumerator
MCBSP_CLOCK_SPI_MODE_DELAY
= 0x1800U¶ Enables clock stop mode with half cycle delay.
-
enumerator
-
enum
McBSP_RxInterruptSource
¶ Values that can be passed to McBSP_setRxInterruptSource() as the interruptSource parameter.
Values:
-
enumerator
MCBSP_RX_ISR_SOURCE_SERIAL_WORD
= 0x0000U¶ Interrupt when Rx is ready.
-
enumerator
MCBSP_RX_ISR_SOURCE_END_OF_BLOCK
= 0x0010U¶ Interrupt at block end.
-
enumerator
MCBSP_RX_ISR_SOURCE_FRAME_SYNC
= 0x0020U¶ Interrupt when frame sync occurs.
-
enumerator
MCBSP_RX_ISR_SOURCE_SYNC_ERROR
= 0x0030U¶ Interrupt on frame sync error.
-
enumerator
-
enum
McBSP_EmulationMode
¶ Values that can be passed to McBSP_setEmulationMode() as the emulationMode parameter.
Values:
-
enumerator
MCBSP_EMULATION_IMMEDIATE_STOP
= 0x0000U¶ McBSP TX and RX stop when a breakpoint is reached.
-
enumerator
MCBSP_EMULATION_SOFT_STOP
= 0x0100U¶ McBSP TX stops after current word transmitted.
-
enumerator
MCBSP_EMULATION_FREE_RUN
= 0x0200U¶ McBSP TX and RX run ignoring the breakpoint.
-
enumerator
-
enum
McBSP_TxInterruptSource
¶ Values that can be passed to McBSP_setTxInterruptSource() as the interruptSource parameter.
Values:
-
enumerator
MCBSP_TX_ISR_SOURCE_TX_READY
= 0x0000U¶ Interrupt when Tx Ready.
-
enumerator
MCBSP_TX_ISR_SOURCE_END_OF_BLOCK
= 0x0010U¶ Interrupt at block end.
-
enumerator
MCBSP_TX_ISR_SOURCE_FRAME_SYNC
= 0x0020U¶ Interrupt when frame sync occurs.
-
enumerator
MCBSP_TX_ISR_SOURCE_SYNC_ERROR
= 0x0030U¶ Interrupt on frame sync error.
-
enumerator
-
enum
McBSP_DataPhaseFrame
¶ Values that can be passed to to McBSP_setTxDataSize() and McBSP_setRxDataSize() as the dataFrame parameter.
Values:
-
enumerator
MCBSP_PHASE_ONE_FRAME
= 0x0000U¶ Single Phase.
-
enumerator
MCBSP_PHASE_TWO_FRAME
= 0x0001U¶ Dual Phase.
-
enumerator
-
enum
McBSP_DataBitsPerWord
¶ Values that can be passed as of McBSP_setTxDataSize() and McBSP_setRxDataSize() as the bitsPerWord parameter.
Values:
-
enumerator
MCBSP_BITS_PER_WORD_8
= 0x0000U¶ 8 bit word.
-
enumerator
MCBSP_BITS_PER_WORD_12
= 0x0020U¶ 12 bit word.
-
enumerator
MCBSP_BITS_PER_WORD_16
= 0x0040U¶ 16 bit word.
-
enumerator
MCBSP_BITS_PER_WORD_20
= 0x0060U¶ 20 bit word.
-
enumerator
MCBSP_BITS_PER_WORD_24
= 0x0080U¶ 24 bit word.
-
enumerator
MCBSP_BITS_PER_WORD_32
= 0x00A0U¶ 32 bit word.
-
enumerator
-
enum
McBSP_CompandingMode
¶ Values that can be passed to McBSP_setTxCompandingMode() and McBSP_setRxCompandingMode() as the compandingMode parameter.
Values:
-
enumerator
MCBSP_COMPANDING_NONE
= 0x0000U¶ Disables companding.
-
enumerator
MCBSP_COMPANDING_NONE_LSB_FIRST
= 0x0008U¶ Disables companding and Enables 8 bit LSB first data reception.
-
enumerator
MCBSP_COMPANDING_U_LAW_SET
= 0x0010U¶ U-law companding.
-
enumerator
MCBSP_COMPANDING_A_LAW_SET
= 0x0018U¶ A-law companding.
-
enumerator
-
enum
McBSP_DataDelayBits
¶ Values that can be passed to McBSP_setTxDataDelayBits() and McBSP_setRxDataDelayBits() as the delayBits parameter.
Values:
-
enumerator
MCBSP_DATA_DELAY_BIT_0
= 0x0000U¶ O bit delay.
-
enumerator
MCBSP_DATA_DELAY_BIT_1
= 0x0001U¶ 1 bit delay.
-
enumerator
MCBSP_DATA_DELAY_BIT_2
= 0x0002U¶ 2 bit delay.
-
enumerator
-
enum
McBSP_SRGRxClockSource
¶ Values that can be passed for SRG for McBSP_setRxSRGClockSource() as the clockSource parameter.
Values:
-
enumerator
MCBSP_SRG_RX_CLOCK_SOURCE_LSPCLK
= 0x0001U¶ LSPCLK is SRG clock source.
-
enumerator
MCBSP_SRG_RX_CLOCK_SOURCE_MCLKX_PIN
= 0x0003U¶ MCLKx is SRG clock source.
-
enumerator
-
enum
McBSP_SRGTxClockSource
¶ Values that can be passed for SRG to McBSP_setTxSRGClockSource() as the clockSource parameter.
Values:
-
enumerator
MCBSP_SRG_TX_CLOCK_SOURCE_LSPCLK
= 0x0001U¶ LSPCLK is SRG clock source.
-
enumerator
MCBSP_SRG_TX_CLOCK_SOURCE_MCLKR_PIN
= 0x0002U¶ MCLKris SRG clock source.
-
enumerator
-
enum
McBSP_TxInternalFrameSyncSource
¶ Values that can be passed to McBSP_setTxInternalFrameSyncSource() as the syncMode parameter.
Values:
-
enumerator
MCBSP_TX_INTERNAL_FRAME_SYNC_DATA
= 0x0000U¶ sync source.
Data is frame
-
enumerator
MCBSP_TX_INTERNAL_FRAME_SYNC_SRG
= 0x1000U¶ sync source.
SRG is frame
-
enumerator
-
enum
McBSP_MultichannelPartition
¶ Values that can be passed to McBSP_setRxMultichannelPartition() and McBSP_setTxMultichannelPartition() as the MultichannelPartition parameter.
Values:
-
enumerator
MCBSP_MULTICHANNEL_TWO_PARTITION
= 0x0000U¶ Two partition.
-
enumerator
MCBSP_MULTICHANNEL_EIGHT_PARTITION
= 0x0200U¶ Eight partition.
-
enumerator
-
enum
McBSP_PartitionBlock
¶ Values that can be passed to McBSP_setRxTwoPartitionBlock() and McBSP_setTxTwoPartitionBlock() as the block parameter.
Values:
-
enumerator
MCBSP_PARTITION_BLOCK_0
= 0x0000U¶ Partition block 0.
-
enumerator
MCBSP_PARTITION_BLOCK_1
= 0x0001U¶ Partition block 1.
-
enumerator
MCBSP_PARTITION_BLOCK_2
= 0x0002U¶ Partition block 2.
-
enumerator
MCBSP_PARTITION_BLOCK_3
= 0x0003U¶ Partition block 3.
-
enumerator
MCBSP_PARTITION_BLOCK_4
= 0x0004U¶ Partition block 4.
-
enumerator
MCBSP_PARTITION_BLOCK_5
= 0x0005U¶ Partition block 5.
-
enumerator
MCBSP_PARTITION_BLOCK_6
= 0x0006U¶ Partition block 6.
-
enumerator
MCBSP_PARTITION_BLOCK_7
= 0x0007U¶ Partition block 7.
-
enumerator
-
enum
McBSP_RxChannelMode
¶ Values that can be passed to McBSP_setRxChannelMode() as the channelMode parameter.
Values:
-
enumerator
MCBSP_ALL_RX_CHANNELS_ENABLED
= 0x0000U¶ All Channels are enabled.
-
enumerator
MCBSP_RX_CHANNEL_SELECTION_ENABLED
= 0x0001U¶ Selected channels enabled.
-
enumerator
-
enum
McBSP_TxChannelMode
¶ Values that can be passed to McBSP_setTxChannelMode() as the channelMode parameter.
Values:
-
enumerator
MCBSP_ALL_TX_CHANNELS_ENABLED
= 0x0000U¶ All Channels Enabled.
-
enumerator
MCBSP_TX_CHANNEL_SELECTION_ENABLED
= 0x0001U¶ Selection Enabled.
-
enumerator
MCBSP_ENABLE_MASKED_TX_CHANNEL_SELECTION
= 0x0002U¶ Masked Tx Channel.
-
enumerator
MCBSP_SYMMERTIC_RX_TX_SELECTION
= 0x0003U¶ Symmetric Selection.
-
enumerator
-
enum
McBSP_TxFrameSyncSource
¶ Values that can be passed to McBSP_setTxFrameSyncSource() as the syncSource parameter.
Values:
-
enumerator
MCBSP_TX_EXTERNAL_FRAME_SYNC_SOURCE
= 0x0000U¶ FSR pin supplies frame sync signal.
-
enumerator
MCBSP_TX_INTERNAL_FRAME_SYNC_SOURCE
= 0x0800U¶ SRG supplies frame sync signal.
-
enumerator
-
enum
McBSP_RxFrameSyncSource
¶ Values that can be passed to McBSP_setRxFrameSyncSource() as the syncSource parameter.
Values:
-
enumerator
MCBSP_RX_EXTERNAL_FRAME_SYNC_SOURCE
= 0x0000U¶ FSR pin supplies frame sync signal.
-
enumerator
MCBSP_RX_INTERNAL_FRAME_SYNC_SOURCE
= 0x0400U¶ SRG supplies frame sync signal.
-
enumerator
-
enum
McBSP_TxClockSource
¶ Values that can be passed to McBSP_setTxClockSource() as the Transmitter clockSource parameter.
Values:
-
enumerator
MCBSP_EXTERNAL_TX_CLOCK_SOURCE
= 0x0000U¶ Clock source is external.
-
enumerator
MCBSP_INTERNAL_TX_CLOCK_SOURCE
= 0x0200U¶ Clock source is internal.
-
enumerator
-
enum
McBSP_RxClockSource
¶ Values that can be passed toMcBSP_setRxClockSource() as the Receiver clockSource parameter.
Values:
-
enumerator
MCBSP_EXTERNAL_RX_CLOCK_SOURCE
= 0x0000U¶ Clock source is external.
-
enumerator
MCBSP_INTERNAL_RX_CLOCK_SOURCE
= 0x0100U¶ Clock source is internal.
-
enumerator
-
enum
McBSP_TxFrameSyncPolarity
¶ Values that can be passed to McBSP_setTxFrameSyncPolarity() as the Transmitter syncPolarity parameter.
Values:
-
enumerator
MCBSP_TX_FRAME_SYNC_POLARITY_HIGH
= 0x0000U¶ Pulse active high.
-
enumerator
MCBSP_TX_FRAME_SYNC_POLARITY_LOW
= 0x0008U¶ Pulse active low.
-
enumerator
-
enum
McBSP_RxFrameSyncPolarity
¶ Values that can be passed to McBSP_setRxFrameSyncPolarity() as the Receiver syncPolarity parameter.
Values:
-
enumerator
MCBSP_RX_FRAME_SYNC_POLARITY_HIGH
= 0x0000U¶ Pulse active high.
-
enumerator
MCBSP_RX_FRAME_SYNC_POLARITY_LOW
= 0x0004U¶ Pulse active low.
-
enumerator
-
enum
McBSP_TxClockPolarity
¶ Values that can be passed for Transmitter of McBSP_setTxClockPolarity() as the Transmiiter clockPolarity parameter.
Values:
-
enumerator
MCBSP_TX_POLARITY_RISING_EDGE
= 0x0000U¶ TX data on rising edge.
-
enumerator
MCBSP_TX_POLARITY_FALLING_EDGE
= 0x0002U¶ TX data on falling edge.
-
enumerator
-
enum
McBSP_RxClockPolarity
¶ Values that can be passed for Receiver of McBSP_setRxClockPolarity() as the Receiver clockPolarity parameter.
Values:
-
enumerator
MCBSP_RX_POLARITY_FALLING_EDGE
= 0x0000U¶ RX data sampled falling edge.
-
enumerator
MCBSP_RX_POLARITY_RISING_EDGE
= 0x0001U¶ RX data sampled rising edge.
-
enumerator
-
enum
McBSP_CompandingType
¶ Values that can be passed to McBSP_getLeftJustifyData() as the compandingType parameter.
Values:
-
enumerator
MCBSP_COMPANDING_U_LAW
= 0x0002U¶ U-law companding.
-
enumerator
MCBSP_COMPANDING_A_LAW
= 0x0003U¶ A-law companding.
-
enumerator
Functions
-
void
McBSP_disableLoopback
(uint32_t base)¶ Disables digital loop back mode.
This function disables digital loop back mode.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableLoopback
(uint32_t base)¶ Enables digital loop back mode.
This function enables digital loop back mode.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setRxSignExtension
(uint32_t base, const McBSP_RxSignExtensionMode mode)¶ Configures receiver sign extension mode.
This function sets the sign extension mode. Valid values for mode are:
MCBSP_RIGHT_JUSTIFY_FILL_ZERO - right justified MSB filled with zero.
MCBSP_RIGHT_JUSTIFY_FILL_SIGN - right justified sign extended in MSBs.
MCBSP_LEFT_JUSTIFY_FILL_ZER0 - left justifies LBS filled with zero.
- Parameters
base
: is the base address of the McBSP module.mode
: is the sign extension mode.
- Return
None.
-
void
McBSP_setClockStopMode
(uint32_t base, const McBSP_ClockStopMode mode)¶ Configures clock stop mode.
This function sets the cock stop mode. Valid values for mode are
MCBSP_CLOCK_MCBSP_MODE disables clock stop mode.
MCBSP_CLOCK_SPI_MODE_NO_DELAY enables clock stop mode
MCBSP_CLOCK_SPI_MODE_DELAY enables clock stop mode with delay.
- Parameters
base
: is the base address of the McBSP module.mode
: is the clock stop mode.
If an invalid value is provided, the function will exit with out altering the register bits involved.
- Return
None.
-
void
McBSP_disableDxPinDelay
(uint32_t base)¶ Disables delay at DX pin.
This function disables delay on pin DX when turning the module on.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableDxPinDelay
(uint32_t base)¶ Enables delay at DX pin.
This function enables a delay on pin DX when turning the module on. Look at McBSP timing diagrams for details.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setRxInterruptSource
(uint32_t base, const McBSP_RxInterruptSource interruptSource)¶ Configures receiver interrupt sources.
This function sets the receiver interrupt sources. Valid values for interruptSource are:
MCBSP_RX_ISR_SOURCE_SERIAL_WORD - interrupt at each serial word.
MCBSP_RX_ISR_SOURCE_END_OF_BLOCK - interrupt at the end of block.
MCBSP_RX_ISR_SOURCE_FRAME_SYNC - interrupt when frame sync occurs.
MCBSP_RX_ISR_SOURCE_SYNC_ERROR - interrupt on frame sync error.
- Parameters
base
: is the base address of the McBSP module.interruptSource
: is the ISR source.
- Return
None.
-
void
McBSP_clearRxFrameSyncError
(uint32_t base)¶ Clear the receiver frame sync error.
This function clears the receive frame sync error.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
uint16_t
McBSP_getRxErrorStatus
(uint32_t base)¶ Return receiver error.
This function returns McBSP receiver errors.
- Parameters
base
: is the base address of the McBSP module.
- Return
Returns the following error codes.
MCBSP_RX_NO_ERROR - if there is no error.
MCBSP_RX_BUFFER_ERROR - if buffergets full.
MCBSP_RX_FRAME_SYNC_ERROR -if unexpected frame sync occurs.
MCBSP_RX_BUFFER_FRAME_SYNC_ERROR - if buffer overrun and frame sync error occurs.
-
bool
McBSP_isRxReady
(uint32_t base)¶ Check if data is received by the receiver.
This function returns the status of the receiver buffer , indicating if new data is available.
- Parameters
base
: is the base address of the McBSP port.
- Return
true if new data is available or if the current data was never read. false if there is no new data in the receive buffer.
-
void
McBSP_resetReceiver
(uint32_t base)¶ Reset McBSP receiver.
This function resets McBSP receiver.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableReceiver
(uint32_t base)¶ Enable McBSP receiver.
This function enables McBSP receiver.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setEmulationMode
(uint32_t base, const McBSP_EmulationMode emulationMode)¶ Configures emulation mode.
This function sets the McBSP characters when a breakpoint is encountered in emulation mode. Valid values for emulationMode are:
MCBSP_EMULATION_IMMEDIATE_STOP - transmitter and receiver both stop when a breakpoint is reached.
MCBSP_EMULATION_SOFT_STOP - transmitter stops after current word is transmitted. Receiver is not affected.
MCBSP_EMULATION_FREE_RUN - McBSP runs ignoring the breakpoint.
- Parameters
base
: is the base address of the McBSP module.emulationMode
: is the McBSP emulation character.
- Return
None.
-
void
McBSP_resetFrameSyncLogic
(uint32_t base)¶ Reset frame sync logic.
Resets frame sync logic.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableFrameSyncLogic
(uint32_t base)¶ Enable frame sync logic.
Enables frame sync logic.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_resetSampleRateGenerator
(uint32_t base)¶ Reset sample rate generator.
Resets sample rate generator by clearing GRST bit.
- Parameters
base
: is the base address of the McBSP module.
- Return
-
void
McBSP_enableSampleRateGenerator
(uint32_t base)¶ Enable sample rate generator.
Enables sample rate generator by setting GRST bit.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setTxInterruptSource
(uint32_t base, const McBSP_TxInterruptSource interruptSource)¶ Configures transmitter interrupt sources.
This function sets the transmitter interrupt sources. Valid values for interruptSource are:
MCBSP_TX_ISR_SOURCE_TX_READY - interrupt when transmitter is ready to accept data.
MCBSP_TX_ISR_SOURCE_END_OF_BLOCK - interrupt at the end of block.
MCBSP_TX_ISR_SOURCE_FRAME_SYNC - interrupt when frame sync occurs.
MCBSP_TX_ISR_SOURCE_SYNC_ERROR - interrupt on frame sync error.
- Parameters
base
: is the base address of the McBSP module.interruptSource
: is the ISR source.
- Return
None.
-
uint16_t
McBSP_getTxErrorStatus
(uint32_t base)¶ Return Transmitter error.
This function returns McBSP transmitter errors.
- Parameters
base
: is the base address of the McBSP module.
- Return
Returns the following error codes.
MCBSP_TX_NO_ERROR - if buffer overrun occurs.
MCBSP_TX_BUFFER_ERROR -if unexpected frame sync occurs.
MCBSP_TX_FRAME_SYNC_ERROR - if there is no error.
MCBSP_TX_BUFFER_FRAME_SYNC_ERROR - if buffer overrun and frame sync error occurs.
-
void
McBSP_clearTxFrameSyncError
(uint32_t base)¶ Clear the Transmitter frame sync error.
This function clears the transmitter frame sync error.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
bool
McBSP_isTxReady
(uint32_t base)¶ Check if Transmitter is ready.
This function returns the status of the transmitter ready buffer, indicating if data can be written to the transmitter.
- Parameters
base
: is the base address of the McBSP port.
- Return
true if transmitter is ready to accept new data. false if transmitter is not ready to accept new data.
-
void
McBSP_resetTransmitter
(uint32_t base)¶ Reset McBSP transmitter.
This functions resets McBSP transmitter.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableTransmitter
(uint32_t base)¶ Enable McBSP transmitter.
This function enables McBSP transmitter.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_disableTwoPhaseRx
(uint32_t base)¶ Disable 2 Phase operation for data reception.
This function disables 2 phase reception.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableTwoPhaseRx
(uint32_t base)¶ Enable 2 Phase operation for data Reception.
This function enables 2 phase reception.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setRxCompandingMode
(uint32_t base, const McBSP_CompandingMode compandingMode)¶ Configure receive data companding.
This function configures the receive companding logic. The following are valid compandingMode values:
- Parameters
base
: is the base address of the McBSP module.compandingMode
: is the companding mode to be used.
MCBSP_COMPANDING_NONE disables companding.
MCBSP_COMPANDING_NONE_LSB_FIRST disables companding and enables 8 bit LSB first data reception.
MCBSP_COMPANDING_U_LAW_SET enables U-law companding.
MCBSP_COMPANDING_A_LAW_SET enables A-law companding.
- Return
None.
-
void
McBSP_disableRxFrameSyncErrorDetection
(uint32_t base)¶ Disables receiver unexpected frame sync error detection.
This function disables unexpected frame sync error detection in the receiver.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableRxFrameSyncErrorDetection
(uint32_t base)¶ Enable receiver unexpected frame sync error detection.
This function enables unexpected frame sync error detection in the receiver.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setRxDataDelayBits
(uint32_t base, const McBSP_DataDelayBits delayBits)¶ Sets the receive bit data delay.
This functions sets the bit delay after the frame sync pulse as specified by delayBits. Valid delay bits are
MCBSP_DATA_DELAY_BIT_0, MCBSP_DATA_DELAY_BIT_1 or MCBSP_DATA_DELAY_BIT_2 corresponding to 0, 1 or 2 bit delay respectively.- Parameters
base
: is the base address of the McBSP module.delayBits
: is the number of bits to delay.
- Return
None.
-
void
McBSP_disableTwoPhaseTx
(uint32_t base)¶ Disable 2 Phase operation for data Transmission.
This function disables 2 phase transmission.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableTwoPhaseTx
(uint32_t base)¶ Enable 2 Phase operation for data Transmission.
This function enables 2 phase transmission.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setTxCompandingMode
(uint32_t base, const McBSP_CompandingMode compandingMode)¶ Configure transmit data companding.
This function configures the transmit companding logic. The following are valid compandingMode values:
- Parameters
base
: is the base address of the McBSP module.compandingMode
: is the companding mode to be used.
MCBSP_COMPANDING_NONE disables companding.
MCBSP_COMPANDING_NONE_LSB_FIRST disables companding and enables 8 bit LSB first data reception.
MCBSP_COMPANDING_U_LAW_SET enables U-law companding.
MCBSP_COMPANDING_A_LAW_SET enables A-law companding.
- Return
None.
-
void
McBSP_disableTxFrameSyncErrorDetection
(uint32_t base)¶ Disables transmitter unexpected frame sync error detection.
This function disables unexpected frame sync error detection in the transmitter.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableTxFrameSyncErrorDetection
(uint32_t base)¶ Enable transmitter unexpected frame sync error detection.
This function enables unexpected frame sync error detection in the transmitter.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setTxDataDelayBits
(uint32_t base, const McBSP_DataDelayBits delayBits)¶ Sets the transmit bit delay.
This function sets the bit delay after the frame sync pulse as specified by delayBits. Valid delay bits are
MCBSP_DATA_DELAY_BIT_0, MCBSP_DATA_DELAY_BIT_1 or MCBSP_DATA_DELAY_BIT_2 corresponding to 0, 1 or 2 bit delay respectively.- Parameters
base
: is the base address of the McBSP module.delayBits
: is the number of bits to delay.
- Return
None.
-
void
McBSP_setFrameSyncPulsePeriod
(uint32_t base, uint16_t frameClockDivider)¶ Sets the period for frame synchronisation pulse.
This function sets the sample rate generator clock divider for the McBSP frame sync clock(FSG). FSG = CLKG / (frameClockDivider + 1). frameClockDivider determines the period count.
- Parameters
base
: is the base address of the McBSP module.frameClockDivider
: is the divider count for the sync clock.
- Return
None.
-
void
McBSP_setFrameSyncPulseWidthDivider
(uint32_t base, uint16_t pulseWidthDivider)¶ Sets the frame sync pulse width divider value.
This function sets the pulse width divider bits for the McBSP frame sync clock(FSG). (pulseWidthDivider + 1) is the pulse width in CLKG cycles. pulseWidthDivider determines the pulse width (the on count).
- Parameters
base
: is the base address of the McBSP module.pulseWidthDivider
: is the divider count for sync clock pulse.
- Return
None.
-
void
McBSP_setSRGDataClockDivider
(uint32_t base, uint16_t dataClockDivider)¶ Sets the data clock divider values.
This function sets the sample rate generator clock divider for the McBSP data clock(CLKG). CLKG = CLKSRG / (clockDivider + 1). Valid ranges for clockDivider are 0 to 0xFF.
- Parameters
base
: is the base address of the McBSP module.dataClockDivider
: is the divider count for the data rate.
- Return
None.
-
void
McBSP_disableSRGSyncFSR
(uint32_t base)¶ Disables external clock sync with sample generator.
This function disables CLKG and FSG sync with the external pulse on pin FSR.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableSRGSyncFSR
(uint32_t base)¶ Enables external clock to synch with sample generator.
This function enables CLKG and FSG to sync with the external pulse on pin FSR.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_setRxSRGClockSource
(uint32_t base, const McBSP_SRGRxClockSource srgClockSource)¶ Configures receiver input clock source for sample generator.
This functions sets the clock source for the sample rate generator. Valid values for
clockSource areMCBSP_SRG_RX_CLOCK_SOURCE_LSPCLK for LSPCLK.
MCBSP_SRG_RX_CLOCK_SOURCE_MCLKX_PIN for external clock at MCLKX pin. MCLKR pin will be an output driven by sample rate generator.
- Parameters
base
: is the base address of the McBSP module.srgClockSource
: is clock source for the sample generator.
- Return
None.
-
void
McBSP_setTxSRGClockSource
(uint32_t base, const McBSP_SRGTxClockSource srgClockSource)¶ Configures transmitter input clock source for sample generator.
This functions sets the clock source for the sample rate generator. Valid values for
clockSource areMCBSP_SRG_TX_CLOCK_SOURCE_LSPCLK for LSPCLK.
MCBSP_SRG_TX_CLOCK_SOURCE_MCLKR_PIN for external clock at MCLKR pin. MCLKX pin will be an output driven by sample rate generator.
- Parameters
base
: is the base address of the McBSP module.srgClockSource
: is clock source for the sample generator.
- Return
None.
-
void
McBSP_setTxInternalFrameSyncSource
(uint32_t base, const McBSP_TxInternalFrameSyncSource syncMode)¶ Sets the mode for transmitter internal frame sync signal.
This function sets the frame sync signal generation mode. The signal can be generated based on clock divider as set in
McBSP_setFrameSyncPulsePeriod() function or when data is transferred from DXR registers to XSR registers. Valid input for syncMode are:- Parameters
base
: is the base address of the McBSP module.syncMode
: is the frame sync mode.
MCBSP_TX_INTERNAL_FRAME_SYNC_DATA - frame sync signal is generated when data is transferred from DXR registers to XSR registers.
MCBSP_TX_INTERNAL_FRAME_SYNC_SRG - frame sync signal is generated based on the clock counter value as defined in McBSP_setFrameSyncPulsePeriod() function.
- Return
None.
-
void
McBSP_setRxMultichannelPartition
(uint32_t base, const McBSP_MultichannelPartition partition)¶ Set Multichannel receiver partitions.
This function sets the partitions for Multichannel receiver. Valid values for partition are
MCBSP_MULTICHANNEL_TWO_PARTITION or MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 and 8 partitions respectively.- Parameters
base
: is the base address of the McBSP module.partition
: is the number of partitions.
- Return
None.
-
void
McBSP_setRxTwoPartitionBlock
(uint32_t base, const McBSP_PartitionBlock block)¶ Sets block to receiver in two partition configuration.
This function assigns the block the user provides to the appropriate receiver partition. If user sets the value of block to 0,2,4 or 6 the API will assign the blocks to partition A. If values 1,3,5,or 7 are set to block, then the API assigns the block to partition B.
- Parameters
base
: is the base address of the McBSP module.block
: is the block to assign to the partition.
- Note
This function should be used with the two partition configuration only and not with eight partition configuration.
- Return
None.
-
uint16_t
McBSP_getRxActiveBlock
(uint32_t base)¶ Returns the current active receiver block number.
This function returns the current active receiver block involved in McBSP reception.
- Parameters
base
: is the base address of the McBSP module.
- Return
Active block in McBSP reception. Returned values range from 0 to 7 representing the respective active block number .
-
void
McBSP_setRxChannelMode
(uint32_t base, const McBSP_RxChannelMode channelMode)¶ Configure channel selection mode for receiver.
This function configures the channel selection mode. The following are valid values for channelMode:
- Parameters
base
: is the base address of the McBSP module.channelMode
: is the channel selection mode.
MCBSP_ALL_RX_CHANNELS_ENABLED - enables all channels.
MCBSP_RX_CHANNEL_SELECTION_ENABLED - lets the user enable desired channels by using McBSP_enableRxChannel().
- Return
None.
-
void
McBSP_setTxMultichannelPartition
(uint32_t base, const McBSP_MultichannelPartition partition)¶ Set Multichannel transmitter partitions.
This function sets the partitions for Multichannel transmitter. Valid values for partition are
MCBSP_MULTICHANNEL_TWO_PARTITION or MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 and 8 partitions respectively.- Parameters
base
: is the base address of the McBSP module.partition
: is the number of partitions.
- Return
None.
-
void
McBSP_setTxTwoPartitionBlock
(uint32_t base, const McBSP_PartitionBlock block)¶ Sets block to transmitter in two partition configuration.
This function assigns the block the user provides to the appropriate transmitter partition. If user sets the value of block to 0,2,4 or 6 the API will assign the blocks to partition A. If values 1,3,5,or 7 are set to block, then the API assigns the block to partition B.
- Parameters
base
: is the base address of the McBSP module.block
: is the block to assign to the partition.
- Note
This function should be used with the two partition configuration only and not with eight partition configuration.
- Return
None.
-
uint16_t
McBSP_getTxActiveBlock
(uint32_t base)¶ Returns the current active transmitter block number.
This function returns the current active transmitter block involved in McBSP transmission.
- Parameters
base
: is the base address of the McBSP module.
- Return
Active block in McBSP transmission. Returned values range from 0 to 7 representing the respective active block number.
-
void
McBSP_setTxChannelMode
(uint32_t base, const McBSP_TxChannelMode channelMode)¶ Configure channel selection mode for transmitter.
This function configures the channel selection mode. The following are valid values for channelMode:
- Parameters
base
: is the base address of the McBSP module.channelMode
: is the channel selection mode.
MCBSP_ALL_TX_CHANNELS_ENABLED - enables and unmasks all channels
MCBSP_TX_CHANNEL_SELECTION_ENABLED - lets the user enable and unmask desired channels by using McBSP_enableTxChannel()
MCBSP_ENABLE_MASKED_TX_CHANNEL_SELECTION - All channels enables but until enabled by McBSP_enableTxChannel()
MCBSP_SYMMERTIC_RX_TX_SELECTION - Symmetric transmission and reception.
- Return
None.
-
void
McBSP_setTxFrameSyncSource
(uint32_t base, const McBSP_TxFrameSyncSource syncSource)¶ Select the transmitter frame sync signal source.
This function sets external or internal sync signal source based on the syncSource selection. Valid input for syncSource are:
- Parameters
base
: is the base address of the McBSP module.syncSource
: is the transmitter frame sync source.
MCBSP_TX_EXTERNAL_FRAME_SYNC_SOURCE - frame sync signal is supplied externally by pin FSX.
MCBSP_TX_INTERNAL_FRAME_SYNC_SOURCE - frame sync signal is supplied internally.
- Return
None.
-
void
McBSP_setRxFrameSyncSource
(uint32_t base, const McBSP_RxFrameSyncSource syncSource)¶ Select receiver frame sync signal source.
This function sets external or internal sync signal source based on the syncSource selection. Valid input for syncSource are:
- Parameters
base
: is the base address of the McBSP module.syncSource
: is the receiver frame sync source.
MCBSP_RX_EXTERNAL_FRAME_SYNC_SOURCE - frame sync signal is supplied externally by pin FSR.
MCBSP_RX_INTERNAL_FRAME_SYNC_SOURCE - frame sync signal is supplied by SRG.
- Return
None.
-
void
McBSP_setTxClockSource
(uint32_t base, const McBSP_TxClockSource clockSource)¶ Configures the Transmit clock source.
This function configures the clock source for the transmitter. Valid input for rxClockSource are:
MCBSP_INTERNAL_TX_CLOCK_SOURCE - internal clock source. SRG is the source.
MCBSP_EXTERNAL_TX_CLOCK_SOURCE - external clock source.
- Parameters
base
: is the base address of the McBSP module.clockSource
: is clock source for the transmission pin.
- Return
None.
-
void
McBSP_setRxClockSource
(uint32_t base, const McBSP_RxClockSource clockSource)¶ Configures the Receive clock source.
This function configures the clock source for the receiver. Valid input for base are:
MCBSP_INTERNAL_RX_CLOCK_SOURCE - internal clock source. Sample Rate Generator will be used.
MCBSP_EXTERNAL_RX_CLOCK_SOURCE - external clock will drive the data.
- Parameters
base
: is the base address of the McBSP module.clockSource
: is clock source for the reception pin.
- Return
None.
-
void
McBSP_setTxFrameSyncPolarity
(uint32_t base, const McBSP_TxFrameSyncPolarity syncPolarity)¶ Sets transmitter frame sync polarity.
This function sets the polarity (rising or falling edge)of the frame sync on FSX pin. Use
MCBSP_TX_FRAME_SYNC_POLARITY_LOW for active low frame sync pulse and MCBSP_TX_FRAME_SYNC_POLARITY_HIGH for active high sync pulse.- Parameters
base
: is the base address of the McBSP module.syncPolarity
: is the polarity of frame sync pulse.
- Return
None.
-
void
McBSP_setRxFrameSyncPolarity
(uint32_t base, const McBSP_RxFrameSyncPolarity syncPolarity)¶ Sets receiver frame sync polarity.
This function sets the polarity (rising or falling edge)of the frame sync on FSR pin. Use
MCBSP_RX_FRAME_SYNC_POLARITY_LOW for active low frame sync pulse and MCBSP_RX_FRAME_SYNC_POLARITY_HIGH for active high sync pulse.- Parameters
base
: is the base address of the McBSP module.syncPolarity
: is the polarity of frame sync pulse.
- Return
None.
-
void
McBSP_setTxClockPolarity
(uint32_t base, const McBSP_TxClockPolarity clockPolarity)¶ Sets transmitter clock polarity when using external clock source.
This function sets the polarity (rising or falling edge) of the transmitter clock on MCLKX pin. Valid values for clockPolarity are:
MCBSP_TX_POLARITY_RISING_EDGE for rising edge.
MCBSP_TX_POLARITY_FALLING_EDGE for falling edge.
- Parameters
base
: is the base address of the McBSP module.clockPolarity
: is the polarity of external clock.
- Return
None.
-
void
McBSP_setRxClockPolarity
(uint32_t base, const McBSP_RxClockPolarity clockPolarity)¶ Sets receiver clock polarity when using external clock source.
This function sets the polarity (rising or falling edge) of the receiver clock on MCLKR pin. If external clock is used, the polarity will affect CLKG signal. Valid values for clockPolarity are:
MCBSP_RX_POLARITY_RISING_EDGE for rising edge.
MCBSP_RX_POLARITY_FALLING_EDGE for falling edge.
- Parameters
base
: is the base address of the McBSP module.clockPolarity
: is the polarity of external clock.
- Return
None.
-
uint16_t
McBSP_read16bitData
(uint32_t base)¶ Read 8,12 or 16 bit data word from McBSP data receive registers.
This function returns the data value in data receive register.
- Parameters
base
: is the base address of the McBSP port.
- Return
received data.
-
uint32_t
McBSP_read32bitData
(uint32_t base)¶ Read 20, 24 or 32 bit data word from McBSP data receive registers.
This function returns the data values in data receive registers.
- Parameters
base
: is the base address of the McBSP port.
- Return
received data.
-
void
McBSP_write16bitData
(uint32_t base, uint16_t data)¶ Write 8,12 or 16 bit data word to McBSP data transmit registers.
This function writes 8,12 or 16 bit data to data transmit register.
- Parameters
base
: is the base address of the McBSP port.data
: is the data to be written.
- Return
None.
-
void
McBSP_write32bitData
(uint32_t base, uint32_t data)¶ Write 20, 24 or 32 bit data word to McBSP data transmit registers.
This function writes 20, 24 or 32 bit data to data transmit registers.
- Parameters
base
: is the base address of the McBSP port.data
: is the data to be written.
- Return
None.
-
uint16_t
McBSP_getLeftJustifyData
(uint16_t data, const McBSP_CompandingType compandingType)¶ Return left justified for data for U Law or A Law companding.
This functions returns U law or A law adjusted word.
- Parameters
data
: is the 14 bit word.compandingType
: specifies the type comapnding desired.
- Return
U law or A law left justified word.
-
void
McBSP_enableRxInterrupt
(uint32_t base)¶ Enable Recieve Interrupt.
This function enables Recieve Interrupt on RRDY.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_disableRxInterrupt
(uint32_t base)¶ Disable Recieve Interrupt.
This function disables Recieve Interrupt on RRDY.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_enableTxInterrupt
(uint32_t base)¶ Enable Transmit Interrupt.
This function enables Transmit Interrupt on XRDY.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_disableTxInterrupt
(uint32_t base)¶ Disable Transmit Interrupt.
This function disables Transmit Interrupt on XRDY.
- Parameters
base
: is the base address of the McBSP module.
- Return
None.
-
void
McBSP_transmit16BitDataNonBlocking
(uint32_t base, uint16_t data)¶ Write 8,12 or 16 bit data word to McBSP data transmit registers
This function sends 16 bit or less data to the transmitter buffer.
- Parameters
base
: is the base address of the McBSP port.data
: is the data to be written.
- Return
None.
- Return
None.
-
void
McBSP_transmit16BitDataBlocking
(uint32_t base, uint16_t data)¶ Write 8,12 or 16 bit data word to McBSP data transmit registers
This function sends 16 bit or less data to the transmitter buffer. If transmit buffer is not ready the function will wait until transmit buffer is empty. If the transmitter buffer is empty the data will be written to the data registers.
- Parameters
base
: is the base address of the McBSP port.data
: is the data to be written.
- Return
None.
-
void
McBSP_transmit32BitDataNonBlocking
(uint32_t base, uint32_t data)¶ Write 20 , 24 or 32 bit data word to McBSP data transmit registers
This function sends 20 , 24 or 32 bit data to the transmitter buffer. If the transmitter buffer is empty the data will be written to the data registers.
- Parameters
base
: is the base address of the McBSP port.data
: is the data to be written.
- Return
None.
-
void
McBSP_transmit32BitDataBlocking
(uint32_t base, uint32_t data)¶ Write 20 , 24 or 32 bit data word to McBSP data transmit registers
This function sends 20 , 24 or 32 bit data to the transmitter buffer. If transmit buffer is not ready the function will wait until transmit buffer is empty. If the transmitter buffer is empty the data will be written to the data registers.
- Parameters
base
: is the base address of the McBSP port.data
: is the data to be written.
- Return
None.
-
void
McBSP_receive16BitDataNonBlocking
(uint32_t base, uint16_t *receiveData)¶ Read 8,12 or 16 bit data word from McBSP data receive registers
This function reads 8,12 or 16 bit data from the receiver buffer. If the receiver buffer has new data, the data will be read.
- Parameters
base
: is the base address of the McBSP port.receiveData
: is the pointer to the receive data.
- Return
None.
-
void
McBSP_receive16BitDataBlocking
(uint32_t base, uint16_t *receiveData)¶ Read 8,12 or 16 bit data word from McBSP data receive registers
This function reads 8,12 or 16 bit data from the receiver buffer. If receiver buffer is not ready the function will wait until receiver buffer has new data. If the receiver buffer has new data, the data will be read.
- Parameters
base
: is the base address of the McBSP port.receiveData
: is the pointer to the receive data.
- Return
None.
-
void
McBSP_receive32BitDataNonBlocking
(uint32_t base, uint32_t *receiveData)¶ Read 20, 24 or 32 bit data word from McBSP data receive registers
This function reads 20, 24 or 32 bit data from the receiver buffer. If the receiver buffer has new data, the data will be read.
- Parameters
base
: is the base address of the McBSP port.receiveData
: is the pointer to the receive data.
- Return
None.
-
void
McBSP_receive32BitDataBlocking
(uint32_t base, uint32_t *receiveData)¶ Read 20, 24 or 32 bit data word from McBSP data receive registers
This function reads 20, 24 or 32 bit data from the receiver buffer. If receiver buffer is not ready the function will wait until receiver buffer has new data. If the receiver buffer has new data, the data will be read.
- Parameters
base
: is the base address of the McBSP port.receiveData
: is the pointer to the receive data.
- Return
None.
-
void
McBSP_setRxDataSize
(uint32_t base, const McBSP_DataPhaseFrame dataFrame, const McBSP_DataBitsPerWord bitsPerWord, uint16_t wordsPerFrame)¶ Sets number of words per frame and bits per word for data Reception.
This function sets the number of bits per word and the number of words per frame for the given phase. Valid inputs for phase are
MCBSP_PHASE_ONE_FRAME or MCBSP_PHASE_TWO_FRAME representing the first or second frame phase respectively. Valid value for bitsPerWord are:MCBSP_BITS_PER_WORD_8 8 bit word.
MCBSP_BITS_PER_WORD_12 12 bit word.
MCBSP_BITS_PER_WORD_16 16 bit word.
MCBSP_BITS_PER_WORD_20 20 bit word.
MCBSP_BITS_PER_WORD_24 24 bit word.
MCBSP_BITS_PER_WORD_32 32 bit word. The maximum value for wordsPerFrame is 127 (128 - 1)representing 128 words.
- Parameters
base
: is the base address of the McBSP module.dataFrame
: is the data frame phase.bitsPerWord
: is the number of bits per word.wordsPerFrame
: is the number of words per frame per phase.
- Return
None.
-
void
McBSP_setTxDataSize
(uint32_t base, const McBSP_DataPhaseFrame dataFrame, const McBSP_DataBitsPerWord bitsPerWord, uint16_t wordsPerFrame)¶ Sets number of words per frame and bits per word for data Transmission.
This function sets the number of bits per word and the number of words per frame for the given phase. Valid inputs for phase are
MCBSP_PHASE_ONE_FRAME or MCBSP_PHASE_TWO_FRAME representing single or dual phase respectively. Valid values for bitsPerWord are:MCBSP_BITS_PER_WORD_8 8 bit word.
MCBSP_BITS_PER_WORD_12 12 bit word.
MCBSP_BITS_PER_WORD_16 16 bit word.
MCBSP_BITS_PER_WORD_20 20 bit word.
MCBSP_BITS_PER_WORD_24 24 bit word.
MCBSP_BITS_PER_WORD_32 32 bit word. The maximum value for wordsPerFrame is 127 (128 - 1)representing 128 words.
- Parameters
base
: is the base address of the McBSP module.dataFrame
: is the data frame phase.bitsPerWord
: is the number of bits per word.wordsPerFrame
: is the number of words per frame per phase.
- Return
None.
-
void
McBSP_disableRxChannel
(uint32_t base, const McBSP_MultichannelPartition partition, uint16_t channel)¶ Disables a channel in an eight partition receiver
This function disables the given receiver channel number for the partition provided. Valid values for partition are
MCBSP_MULTICHANNEL_TWO_PARTITION or MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 or 8 partitions respectively. Valid values for channel range from 0 to 127.- Parameters
base
: is the base address of the McBSP module.partition
: is the partition of the channel.channel
: is the receiver channel number to be enabled.
- Return
None.
-
void
McBSP_enableRxChannel
(uint32_t base, const McBSP_MultichannelPartition partition, uint16_t channel)¶ Enables a channel for eight partition receiver
This function enables the given receiver channel number for the partition provided. Valid values for partition are
MCBSP_MULTICHANNEL_TWO_PARTITION or MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 or 8 partitions respectively. Valid values for channel range from 0 to 127.- Parameters
base
: is the base address of the McBSP module.partition
: is the partition of the channel.channel
: is the receiver channel number to be enabled.
- Return
None.
-
void
McBSP_disableTxChannel
(uint32_t base, const McBSP_MultichannelPartition partition, uint16_t channel)¶ Disables a channel in an eight partition transmitter
This function disables the given transmitter channel number for the partition provided. Valid values for partition are
MCBSP_MULTICHANNEL_TWO_PARTITION or MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 or 8 partitions respectively. Valid values for channel range from 0 to 127.- Parameters
base
: is the base address of the McBSP module.partition
: is the partition of the channel.channel
: is the transmitter channel number to be enabled.
- Return
None.
-
void
McBSP_enableTxChannel
(uint32_t base, const McBSP_MultichannelPartition partition, uint16_t channel)¶ Enables a channel for eight partition transmitter
This function enables the given transmitter channel number for the partition provided. Valid values for partition are
MCBSP_MULTICHANNEL_TWO_PARTITION or MCBSP_MULTICHANNEL_EIGHT_PARTITION for 2 or 8 partitions respectively. Valid values for channel range from 0 to 127.- Parameters
base
: is the base address of the McBSP module.partition
: is the partition of the channel.channel
: is the transmitter channel number to be enabled.
- Return
None.
-
void
McBSP_configureTxClock
(uint32_t base, const McBSP_ClockParams *ptrClockParams)¶ Configures transmitter clock
- Note
Make sure the clock divider is such that, the McBSP clock is not running faster than 1/2 the speed of the source clock.
- Return
None.
- Parameters
base
: is the base address of the McBSP module.ptrClockParams
: is a pointer to a structure containing clock parameters McBSP_ClockParams. This function sets up the transmitter clock. The following are valid values and ranges for the parameters of the McBSP_TxFsyncParams.clockSRGSyncFSR - true to sync with signal on FSR pin, false to ignore signal on FSR pin. the pulse on FSR pin.
clockSRGDivider - Maximum valid value is 255.
clockSource - MCBSP_EXTERNAL_TX_CLOCK_SOURCE or MCBSP_INTERNAL_TX_CLOCK_SOURCE
clockTxSRGSource - MCBSP_SRG_TX_CLOCK_SOURCE_LSPCLK or MCBSP_SRG_TX_CLOCK_SOURCE_MCLKR_PIN
clockMCLKXPolarity - Output polarity on MCLKX pin.
MCBSP_TX_POLARITY_RISING_EDGE
MCBSP_TX_POLARITY_FALLING_EDGE
clockMCLKRPolarity - Input polarity on MCLKR pin (if SRG is sourced from MCLKR pin).
MCBSP_RX_POLARITY_FALLING_EDGE
MCBSP_RX_POLARITY_RISING_EDGE
-
void
McBSP_configureRxClock
(uint32_t base, const McBSP_ClockParams *ptrClockParams)¶ Configures receiver clock
- Note
Make sure the clock divider is such that, the McBSP clock is not running faster than 1/2 the speed of the source clock.
- Return
None.
- Parameters
base
: is the base address of the McBSP module.ptrClockParams
: is a pointer to a structure containing clock parameters McBSP_ClockParams. This function sets up the receiver clock. The following are valid values and ranges for the parameters of the McBSP_TxFsyncParams.clockSRGSyncFlag - true to sync with signal on FSR pin, false to ignore the pulse on FSR pin.
clockSRGDivider - Maximum valid value is 255.
clockSource - MCBSP_EXTERNAL_RX_CLOCK_SOURCE or MCBSP_INTERNAL_RX_CLOCK_SOURCE
clockRxSRGSource - MCBSP_SRG_RX_CLOCK_SOURCE_LSPCLK or MCBSP_SRG_RX_CLOCK_SOURCE_MCLKX_PIN
clockMCLKRPolarity- output polarity on MCLKR pin.
MCBSP_RX_POLARITY_FALLING_EDGE or
MCBSP_RX_POLARITY_RISING_EDGE
clockMCLKXPolarity- Input polarity on MCLKX pin (if SRG is sourced from MCLKX pin).
MCBSP_TX_POLARITY_RISING_EDGE or
MCBSP_TX_POLARITY_FALLING_EDGE
-
void
McBSP_configureTxFrameSync
(uint32_t base, const McBSP_TxFsyncParams *ptrFsyncParams)¶ Configures transmitter frame sync.
- Return
None.
- Parameters
base
: is the base address of the McBSP module.ptrFsyncParams
: is a pointer to a structure containing frame sync parameters McBSPTxFsyncParams. This function sets up the transmitter frame sync. The following are valid values and ranges for the parameters of the McBSPTxFsyncParams.syncSRGSyncFSRFlag - true to sync with signal on FSR pin, false to ignore the pulse on FSR pin.This value has to be similar to the value of McBSP_ClockParams.clockSRGSyncFlag.
syncErrorDetect - true to enable frame sync error detect. false to disable.
syncClockDivider - Maximum valid value is 4095.
syncPulseDivider - Maximum valid value is 255.
syncSourceTx - MCBSP_TX_INTERNAL_FRAME_SYNC_SOURCE or MCBSP_TX_EXTERNAL_FRAME_SYNC_SOURCE
syncIntSource - MCBSP_TX_INTERNAL_FRAME_SYNC_DATA or MCBSP_TX_INTERNAL_FRAME_SYNC_SRG
syncFSXPolarity - MCBSP_TX_FRAME_SYNC_POLARITY_LOW or MCBSP_TX_FRAME_SYNC_POLARITY_HIGH.
-
void
McBSP_configureRxFrameSync
(uint32_t base, const McBSP_RxFsyncParams *ptrFsyncParams)¶ Configures receiver frame sync.
- Return
None.
- Parameters
base
: is the base address of the McBSP module.ptrFsyncParams
: is a pointer to a structure containing frame sync parameters McBSP_RxFsyncParams. This function sets up the receiver frame sync. The following are valid values and ranges for the parameters of the McBSPTxFsyncParams.syncSRGSyncFSRFlag - true to sync with signal on FSR pin, false to ignore the pulse on FSR pin. This value has to be similar to the value of McBSP_ClockParams.clockSRGSyncFlag.
syncErrorDetect - true to enable frame sync error detect. false to disable.
syncClockDivider - Maximum valid value is 4095.
syncPulseDivider - Maximum valid value is 255.
syncSourceRx - MCBSP_RX_INTERNAL_FRAME_SYNC_SOURCE or MCBSP_RX_EXTERNAL_FRAME_SYNC_SOURCE
syncFSRPolarity - MCBSP_RX_FRAME_SYNC_POLARITY_LOW or MCBSP_RX_FRAME_SYNC_POLARITY_HIGH
-
void
McBSP_configureTxDataFormat
(uint32_t base, const McBSP_TxDataParams *ptrDataParams)¶ Configures transmitter data format.
- Return
None.
- Parameters
base
: is the base address of the McBSP module.ptrDataParams
: is a pointer to a structure containing data format parameters McBSPTxDataParams. This function sets up the transmitter data format and properties. The following are valid values and ranges for the parameters of the McBSPTxDataParams.loopbackModeFlag - true for digital loop-back mode. false for no loop-back mode.
twoPhaseModeFlag - true for two phase mode. false for single phase mode.
pinDelayEnableFlag - true to enable DX pin delay. false to disable DX pin delay.
phase1FrameLength - maximum value of 127.
phase2FrameLength - maximum value of 127.
clockStopMode - MCBSP_CLOCK_SPI_MODE_NO_DELAY or MCBSP_CLOCK_SPI_MODE_DELAY
phase1WordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32
phase2WordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32
compandingMode - MCBSP_COMPANDING_NONE, MCBSP_COMPANDING_NONE_LSB_FIRST MCBSP_COMPANDING_U_LAW_SET or MCBSP_COMPANDING_A_LAW_SET.
dataDelayBits - MCBSP_DATA_DELAY_BIT_0, MCBSP_DATA_DELAY_BIT_1 or MCBSP_DATA_DELAY_BIT_2
interruptMode - MCBSP_TX_ISR_SOURCE_TX_READY, MCBSP_TX_ISR_SOURCE_END_OF_BLOCK, MCBSP_TX_ISR_SOURCE_FRAME_SYNC or MCBSP_TX_ISR_SOURCE_SYNC_ERROR
Note - When using companding,phase1WordLength and phase2WordLength must be 8 bits wide.
-
void
McBSP_configureRxDataFormat
(uint32_t base, const McBSP_RxDataParams *ptrDataParams)¶ Configures receiver data format.
- Return
None.
- Parameters
base
: is the base address of the McBSP module.ptrDataParams
: is a pointer to a structure containing data format parameters McBSP_RxDataParams. This function sets up the transmitter data format and properties. The following are valid values and ranges for the parameters of the McBSP_RxDataParams.loopbackModeFlag - true for digital loop-back mode. false for non loop-back mode.
twoPhaseModeFlag - true for two phase mode. false for single phase mode.
phase1FrameLength - maximum value of 127.
phase2FrameLength - maximum value of 127.
phase1WordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32
phase2WordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32
compandingMode - MCBSP_COMPANDING_NONE, MCBSP_COMPANDING_NONE_LSB_FIRST MCBSP_COMPANDING_U_LAW_SET or MCBSP_COMPANDING_A_LAW_SET.
dataDelayBits - MCBSP_DATA_DELAY_BIT_0, MCBSP_DATA_DELAY_BIT_1 or MCBSP_DATA_DELAY_BIT_2
signExtMode - MCBSP_RIGHT_JUSTIFY_FILL_ZERO, MCBSP_RIGHT_JUSTIFY_FILL_SIGN or MCBSP_LEFT_JUSTIFY_FILL_ZER0
interruptMode - MCBSP_RX_ISR_SOURCE_SERIAL_WORD, MCBSP_RX_ISR_SOURCE_END_OF_BLOCK, MCBSP_RX_ISR_SOURCE_FRAME_SYNC or MCBSP_RX_ISR_SOURCE_SYNC_ERROR
Note - When using companding,phase1WordLength and phase2WordLength must be 8 bits wide.
-
uint16_t
McBSP_configureTxMultichannel
(uint32_t base, const McBSP_TxMultichannelParams *ptrMchnParams)¶ Configures transmitter multichannel.
This function sets up the transmitter multichannel mode. The following are valid values and ranges for the parameters of the
McBSP_TxMultichannelParams.channelCount - Maximum value of 128 for partition 8 Maximum value of 32 for partition 2
ptrChannelsList - Pointer to an array of size channelCount that has unique channels.
multichannelMode - MCBSP_ALL_TX_CHANNELS_ENABLED, MCBSP_TX_CHANNEL_SELECTION_ENABLED, MCBSP_ENABLE_MASKED_TX_CHANNEL_SELECTION or MCBSP_SYMMERTIC_RX_TX_SELECTION
partition - MCBSP_MULTICHANNEL_TWO_PARTITION or MCBSP_MULTICHANNEL_EIGHT_PARTITION
- Note
- In 2 partition mode only channels that belong to a single even or odd block number should be listed. It is valid to have an even and odd channels. For example you can have channels [48 -63] and channels [96 - 111] enables as one belongs to an even block and the other to an odd block or two partitions. But not channels [48 - 63] and channels [112 - 127] since they both are even blocks or similar partitions.
- Return
returns the following error codes.
MCBSP_ERROR_EXCEEDED_CHANNELS - number of channels exceeds 128
MCBSP_ERROR_2_PARTITION_A - invalid channel combination for partition A
MCBSP_ERROR_2_PARTITION_B - invalid channel combination for partition B
MCBSP_ERROR_INVALID_MODE - invalid transmitter channel mode.
- Return
Returns the following error codes.
MCBSP_ERROR_EXCEEDED_CHANNELS - Exceeded number of channels.
MCBSP_ERROR_2_PARTITION_A - Error in 2 partition A setup.
MCBSP_ERROR_2_PARTITION_B - Error in 2 partition B setup.
MCBSP_ERROR_INVALID_MODE - Invalid mode.
- Parameters
base
: is the base address of the McBSP module.ptrMchnParams
: is a pointer to a structure containing multichannel parameters McBSP_TxMultichannelParams.
-
uint16_t
McBSP_configureRxMultichannel
(uint32_t base, const McBSP_RxMultichannelParams *ptrMchnParams)¶ Configures receiver multichannel.
This function sets up the receiver multichannel mode. The following are valid values and ranges for the parameters of the McBSPMultichannelParams.
channelCount - Maximum value of 128 for partition 8 Maximum value of 32 for partition 2
ptrChannelsList - Pointer to an array of size channelCount that has unique channels.
multichannelMode - MCBSP_ALL_RX_CHANNELS_ENABLED, MCBSP_RX_CHANNEL_SELECTION_ENABLED,
partition - MCBSP_MULTICHANNEL_TWO_PARTITION or MCBSP_MULTICHANNEL_EIGHT_PARTITION
- Note
- In 2 partition mode only channels that belong to a single even or odd block number should be listed. It is valid to have an even and odd channels. For example you can have channels [48 - 63] and channels [96 - 111] enables as one belongs to an even block and the other to an odd block or two partitions. But not channels [48 - 63]and channels [112 - 127] since they both are even blocks or similar partitions.
- Return
returns the following error codes.
MCBSP_ERROR_EXCEEDED_CHANNELS - number of channels exceeds 128
MCBSP_ERROR_2_PARTITION_A - invalid channel combination for partition A
MCBSP_ERROR_2_PARTITION_B - invalid channel combination for partition B
MCBSP_ERROR_INVALID_MODE - invalid transmitter channel mode.
- Return
Returns the following error codes.
MCBSP_ERROR_EXCEEDED_CHANNELS - Exceeded number of channels.
MCBSP_ERROR_2_PARTITION_A - Error in 2 partition A setup.
MCBSP_ERROR_2_PARTITION_B - Error in 2 partition B setup.
MCBSP_ERROR_INVALID_MODE - Invalid mode.
- Parameters
base
: is the base address of the McBSP module.ptrMchnParams
: is a pointer to a structure containing multichannel parameters McBSP_RxMultiChannelParams.
-
void
McBSP_configureSPIMasterMode
(uint32_t base, const McBSP_SPIMasterModeParams *ptrSPIMasterMode)¶ Configures McBSP in SPI master mode
- Note
Make sure the clock divider is such that, the McBSP clock is not running faster than 1/2 the speed of the source clock.
- Return
None.
- Parameters
base
: is the base address of the McBSP module.ptrSPIMasterMode
: is a pointer to a structure containing SPI parameters McBSP_SPIMasterModeParams. This function sets up the McBSP module in SPI master mode.The following are valid values and ranges for the parameters of the McBSP_SPIMasterModeParams.loopbackModeFlag - true for digital loop-back false for no loop-back
clockStopMode - MCBSP_CLOCK_SPI_MODE_NO_DELAY or MCBSP_CLOCK_SPI_MODE_DELAY
wordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32
spiMode It represents the clock polarity can take values:
MCBSP_TX_POLARITY_RISING_EDGE or MCBSP_TX_POLARITY_FALLING_EDGE
clockSRGDivider - Maximum valid value is 255.
-
void
McBSP_configureSPISlaveMode
(uint32_t base, const McBSP_SPISlaveModeParams *ptrSPISlaveMode)¶ Configures McBSP in SPI slave mode
- Return
None.
- Parameters
base
: is the base address of the McBSP module.ptrSPISlaveMode
: is a pointer to a structure containing SPI parameters McBSP_SPISlaveModeParams. This function sets up the McBSP module in SPI slave mode.The following are valid values and ranges for the parameters of the McBSP_SPISlaveModeParams.loopbackModeFlag - true for digital loop-back false for no loop-back
clockStopMode - MCBSP_CLOCK_SPI_MODE_NO_DELAY or MCBSP_CLOCK_SPI_MODE_DELAY
wordLength - MCBSP_BITS_PER_WORD_x , x = 8,12,16,20,24,32
spiMode It represents the clock polarity and can take values:
MCBSP_RX_POLARITY_FALLING_EDGE or MCBSP_RX_POLARITY_RISING_EDGE
-
struct
McBSP_ClockParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureRxClock() and McBSP_configureTxClock() as the clock parameters.
-
struct
McBSP_TxFsyncParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureTxFrameSync() as the Transmitter frameSync parameters.
-
struct
McBSP_RxFsyncParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureTxDataFormat() as the Receiver frameSync parameters.
-
struct
McBSP_TxDataParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureRxDataFormat() as the Transmitter data parameters.
-
struct
McBSP_RxDataParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureRxDataFormat() as the Receiver data parameters.
-
struct
McBSP_RxMultichannelParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureRxMultichannel() as the Receiver multichannel parameters.
-
struct
McBSP_TxMultichannelParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureTxMultichannel() as the Transmitter multichannel parameters.
-
struct
McBSP_SPIMasterModeParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureSPIMasterMode() as the SPIMasterMode parameters.
-
struct
McBSP_SPISlaveModeParams
¶ - #include <mcbsp.h>
Values that can be passed to McBSP_configureSPISlaveMode() as the SPISlaveMode parameters.
-
Before initializing the McBSP module, the user should first put the module transmitter, receiver, sample rate generator & frame sync logic into the reset state.
Next McBSP module should be initialised as per application requirement to set properties like Tx/Rx/sample rate generator/frame sync logic clock source, data delay, tx/rx data format, enable/disable loopback, clock stop mode. McBSP can be configured either in normal McBSP mode or in SPI mode.
After initializing the modules, delay equivalent to 2 SRG cycles must be given before enabling the modules. Nest the sample rate generator must be enabled and after that delay equivalent to 2 CLKG cycles must be given. Next Tx/Rx/frame-sync module must be enabled to complete the configuration.
To transmit data, there are a few options. McBSP_transmit16BitDataNonBlocking, McBSP_transmit32BitDataNonBlocking() will simply write the specified 16/32-bit data to transmit buffer and return. It is left up to the user to check beforehand that the module is ready for a new piece of data to be written to the buffer. The other option is to use one of the two functions McBSP_transmit16BitDataBlocking() & McBSP_transmit32BitDataBlocking() that will wait in a while-loop for the module to be ready.
When receiving data, again, there are a few options. McBSP_receive16BitDataNonBlocking() & McBSP_receive32BitDataNonBlocking() will immediately return the contents of the receive buffer.The user should check that there is in fact data ready by checking the Rx-ready flag. McBSP_receive16BitDataBlocking() and McBSP_receive32BitDataBlocking(),however, will wait in a while-loop for data to become available.
The code for this module is contained in driverlib/mcbsp.c, with driverlib/mcbsp.h containing the API declarations for use by applications.