STM32F439xx HAL User Manual
Functions
I2S IO operation functions
I2S Exported Functions

Data transfers functions. More...

Functions

HAL_StatusTypeDef HAL_I2S_Transmit (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
 Transmit an amount of data in blocking mode.
HAL_StatusTypeDef HAL_I2S_Receive (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
 Receive an amount of data in blocking mode.
HAL_StatusTypeDef HAL_I2S_Transmit_IT (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
 Transmit an amount of data in non-blocking mode with Interrupt.
HAL_StatusTypeDef HAL_I2S_Receive_IT (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
 Receive an amount of data in non-blocking mode with Interrupt.
HAL_StatusTypeDef HAL_I2S_Transmit_DMA (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
 Transmit an amount of data in non-blocking mode with DMA.
HAL_StatusTypeDef HAL_I2S_Receive_DMA (I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
 Receive an amount of data in non-blocking mode with DMA.
HAL_StatusTypeDef HAL_I2S_DMAPause (I2S_HandleTypeDef *hi2s)
 Pauses the audio stream playing from the Media.
HAL_StatusTypeDef HAL_I2S_DMAResume (I2S_HandleTypeDef *hi2s)
 Resumes the audio stream playing from the Media.
HAL_StatusTypeDef HAL_I2S_DMAStop (I2S_HandleTypeDef *hi2s)
 Resumes the audio stream playing from the Media.
void HAL_I2S_IRQHandler (I2S_HandleTypeDef *hi2s)
 This function handles I2S interrupt request.
__weak void HAL_I2S_TxHalfCpltCallback (I2S_HandleTypeDef *hi2s)
 Tx Transfer Half completed callbacks.
__weak void HAL_I2S_TxCpltCallback (I2S_HandleTypeDef *hi2s)
 Tx Transfer completed callbacks.
__weak void HAL_I2S_RxHalfCpltCallback (I2S_HandleTypeDef *hi2s)
 Rx Transfer half completed callbacks.
__weak void HAL_I2S_RxCpltCallback (I2S_HandleTypeDef *hi2s)
 Rx Transfer completed callbacks.
__weak void HAL_I2S_ErrorCallback (I2S_HandleTypeDef *hi2s)
 I2S error callbacks.

Detailed Description

Data transfers functions.

 ===============================================================================
                      ##### IO operation functions #####
 ===============================================================================
    [..]
    This subsection provides a set of functions allowing to manage the I2S data
    transfers.

    (#) There are two modes of transfer:
       (++) Blocking mode : The communication is performed in the polling mode.
            The status of all data processing is returned by the same function
            after finishing transfer.
       (++) No-Blocking mode : The communication is performed using Interrupts
            or DMA. These functions return the status of the transfer startup.
            The end of the data processing will be indicated through the
            dedicated I2S IRQ when using Interrupt mode or the DMA IRQ when
            using DMA mode.

    (#) Blocking mode functions are :
        (++) HAL_I2S_Transmit()
        (++) HAL_I2S_Receive()

    (#) No-Blocking mode functions with Interrupt are :
        (++) HAL_I2S_Transmit_IT()
        (++) HAL_I2S_Receive_IT()

    (#) No-Blocking mode functions with DMA are :
        (++) HAL_I2S_Transmit_DMA()
        (++) HAL_I2S_Receive_DMA()

    (#) A set of Transfer Complete Callbacks are provided in non Blocking mode:
        (++) HAL_I2S_TxCpltCallback()
        (++) HAL_I2S_RxCpltCallback()
        (++) HAL_I2S_ErrorCallback()


Function Documentation

HAL_StatusTypeDef HAL_I2S_DMAPause ( I2S_HandleTypeDef hi2s)

Pauses the audio stream playing from the Media.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
HALstatus

Definition at line 1025 of file stm32f4xx_hal_i2s.c.

References HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_BUSY_TX_RX, I2SxEXT, __I2S_HandleTypeDef::Instance, and __I2S_HandleTypeDef::State.

HAL_StatusTypeDef HAL_I2S_DMAResume ( I2S_HandleTypeDef hi2s)

Resumes the audio stream playing from the Media.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
HALstatus

Definition at line 1061 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_ENABLE, __HAL_I2SEXT_ENABLE, HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_BUSY_TX_RX, I2SxEXT, __I2S_HandleTypeDef::Instance, and __I2S_HandleTypeDef::State.

HAL_StatusTypeDef HAL_I2S_DMAStop ( I2S_HandleTypeDef hi2s)

Resumes the audio stream playing from the Media.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
HALstatus

Definition at line 1111 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_DISABLE, __HAL_I2SEXT_DISABLE, HAL_DMA_Abort(), HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_BUSY_TX_RX, HAL_I2S_STATE_READY, __I2S_HandleTypeDef::hdmarx, __I2S_HandleTypeDef::hdmatx, I2SxEXT, __I2S_HandleTypeDef::Instance, and __I2S_HandleTypeDef::State.

I2S error callbacks.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
None

Definition at line 1237 of file stm32f4xx_hal_i2s.c.

Referenced by HAL_I2S_Init(), HAL_I2S_Receive(), HAL_I2S_Transmit(), HAL_I2SEx_FullDuplex_IRQHandler(), HAL_I2SEx_TransmitReceive(), I2S_DMAError(), I2S_IRQHandler(), and I2SEx_TxRxDMAError().

This function handles I2S interrupt request.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
None

Definition at line 1165 of file stm32f4xx_hal_i2s.c.

References __I2S_HandleTypeDef::IrqHandlerISR.

HAL_StatusTypeDef HAL_I2S_Receive ( I2S_HandleTypeDef hi2s,
uint16_t *  pData,
uint16_t  Size,
uint32_t  Timeout 
)

Receive an amount of data in blocking mode.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to data buffer
Sizenumber of data sample to be sent:
Note:
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 16-bit data length.
Parameters:
TimeoutTimeout duration
Note:
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming)
In I2S Master Receiver mode, just after enabling the peripheral the clock will be generate in continuous way and as the I2S is not disabled at the end of the I2S transaction
Return values:
HALstatus

Definition at line 623 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_CLEAR_OVRFLAG, __HAL_I2S_ENABLE, __HAL_I2S_GET_FLAG, __I2S_HandleTypeDef::ErrorCode, HAL_I2S_ERROR_NONE, HAL_I2S_ERROR_OVR, HAL_I2S_ERROR_TIMEOUT, HAL_I2S_ErrorCallback(), HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_READY, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_FLAG_OVR, I2S_FLAG_RXNE, I2S_MODE_MASTER_RX, I2S_WaitFlagStateUntilTimeout(), __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::RxXferCount, __I2S_HandleTypeDef::RxXferSize, and __I2S_HandleTypeDef::State.

HAL_StatusTypeDef HAL_I2S_Receive_DMA ( I2S_HandleTypeDef hi2s,
uint16_t *  pData,
uint16_t  Size 
)

Receive an amount of data in non-blocking mode with DMA.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to the Receive data buffer.
Sizenumber of data sample to be sent:
Note:
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 16-bit data length.
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
Return values:
HALstatus

Definition at line 943 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_CLEAR_OVRFLAG, __HAL_I2S_ENABLE, __I2S_HandleTypeDef::ErrorCode, HAL_DMA_Start_IT(), HAL_I2S_ERROR_NONE, HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_READY, __I2S_HandleTypeDef::hdmarx, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_DMAError(), I2S_DMARxCplt(), I2S_DMARxHalfCplt(), I2S_MODE_MASTER_RX, __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pRxBuffPtr, __I2S_HandleTypeDef::RxXferCount, __I2S_HandleTypeDef::RxXferSize, __I2S_HandleTypeDef::State, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

HAL_StatusTypeDef HAL_I2S_Receive_IT ( I2S_HandleTypeDef hi2s,
uint16_t *  pData,
uint16_t  Size 
)

Receive an amount of data in non-blocking mode with Interrupt.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to the Receive data buffer.
Sizenumber of data sample to be sent:
Note:
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 16-bit data length.
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
It is recommended to use DMA for the I2S receiver to avoid de-synchronisation between Master and Slave otherwise the I2S interrupt should be optimized.
Return values:
HALstatus

Definition at line 795 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_ENABLE, __HAL_I2S_ENABLE_IT, __I2S_HandleTypeDef::ErrorCode, HAL_I2S_ERROR_NONE, HAL_I2S_STATE_BUSY_RX, HAL_I2S_STATE_READY, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_IT_ERR, I2S_IT_RXNE, __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pRxBuffPtr, __I2S_HandleTypeDef::RxXferCount, __I2S_HandleTypeDef::RxXferSize, and __I2S_HandleTypeDef::State.

Rx Transfer completed callbacks.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
None

Definition at line 1222 of file stm32f4xx_hal_i2s.c.

Referenced by I2S_DMARxCplt(), and I2S_Receive_IT().

Rx Transfer half completed callbacks.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
None

Definition at line 1207 of file stm32f4xx_hal_i2s.c.

Referenced by I2S_DMARxHalfCplt().

HAL_StatusTypeDef HAL_I2S_Transmit ( I2S_HandleTypeDef hi2s,
uint16_t *  pData,
uint16_t  Size,
uint32_t  Timeout 
)

Transmit an amount of data in blocking mode.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to data buffer.
Sizenumber of data sample to be sent:
Note:
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 16-bit data length.
Parameters:
TimeoutTimeout duration
Note:
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
Return values:
HALstatus

Definition at line 524 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_CLEAR_UDRFLAG, __HAL_I2S_ENABLE, __HAL_I2S_GET_FLAG, __I2S_HandleTypeDef::ErrorCode, HAL_I2S_ERROR_NONE, HAL_I2S_ERROR_TIMEOUT, HAL_I2S_ERROR_UDR, HAL_I2S_ErrorCallback(), HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_READY, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_FLAG_TXE, I2S_FLAG_UDR, I2S_WaitFlagStateUntilTimeout(), __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::State, __I2S_HandleTypeDef::TxXferCount, and __I2S_HandleTypeDef::TxXferSize.

HAL_StatusTypeDef HAL_I2S_Transmit_DMA ( I2S_HandleTypeDef hi2s,
uint16_t *  pData,
uint16_t  Size 
)

Transmit an amount of data in non-blocking mode with DMA.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to the Transmit data buffer.
Sizenumber of data sample to be sent:
Note:
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 16-bit data length.
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
Return values:
HALstatus

Definition at line 860 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_ENABLE, __I2S_HandleTypeDef::ErrorCode, HAL_DMA_Start_IT(), HAL_I2S_ERROR_NONE, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_READY, __I2S_HandleTypeDef::hdmatx, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_DMAError(), I2S_DMATxCplt(), I2S_DMATxHalfCplt(), __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pTxBuffPtr, __I2S_HandleTypeDef::State, __I2S_HandleTypeDef::TxXferCount, __I2S_HandleTypeDef::TxXferSize, __DMA_HandleTypeDef::XferCpltCallback, __DMA_HandleTypeDef::XferErrorCallback, and __DMA_HandleTypeDef::XferHalfCpltCallback.

HAL_StatusTypeDef HAL_I2S_Transmit_IT ( I2S_HandleTypeDef hi2s,
uint16_t *  pData,
uint16_t  Size 
)

Transmit an amount of data in non-blocking mode with Interrupt.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
pDataa 16-bit pointer to data buffer.
Sizenumber of data sample to be sent:
Note:
When a 16-bit data frame or a 16-bit data frame extended is selected during the I2S configuration phase, the Size parameter means the number of 16-bit data length in the transaction and when a 24-bit data frame or a 32-bit data frame is selected the Size parameter means the number of 16-bit data length.
The I2S is kept enabled at the end of transaction to avoid the clock de-synchronization between Master and Slave(example: audio streaming).
Return values:
HALstatus

Definition at line 728 of file stm32f4xx_hal_i2s.c.

References __HAL_I2S_ENABLE, __HAL_I2S_ENABLE_IT, __I2S_HandleTypeDef::ErrorCode, HAL_I2S_ERROR_NONE, HAL_I2S_STATE_BUSY_TX, HAL_I2S_STATE_READY, I2S_DATAFORMAT_24B, I2S_DATAFORMAT_32B, I2S_IT_ERR, I2S_IT_TXE, __I2S_HandleTypeDef::Instance, __I2S_HandleTypeDef::pTxBuffPtr, __I2S_HandleTypeDef::State, __I2S_HandleTypeDef::TxXferCount, and __I2S_HandleTypeDef::TxXferSize.

Tx Transfer completed callbacks.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
None

Definition at line 1192 of file stm32f4xx_hal_i2s.c.

Referenced by I2S_DMATxCplt(), and I2S_Transmit_IT().

Tx Transfer Half completed callbacks.

Parameters:
hi2spointer to a I2S_HandleTypeDef structure that contains the configuration information for I2S module
Return values:
None

Definition at line 1177 of file stm32f4xx_hal_i2s.c.

Referenced by I2S_DMATxHalfCplt().