UM1940
__IO uint32_t ErrorCode
Field Documentation
SPI_TypeDef* I2S_HandleTypeDef::Instance
I2S_InitTypeDef I2S_HandleTypeDef::Init
uint16_t* I2S_HandleTypeDef::pTxBuffPtr
__IO uint16_t I2S_HandleTypeDef::TxXferSize
__IO uint16_t I2S_HandleTypeDef::TxXferCount
uint16_t* I2S_HandleTypeDef::pRxBuffPtr
__IO uint16_t I2S_HandleTypeDef::RxXferSize
__IO uint16_t I2S_HandleTypeDef::RxXferCount
DMA_HandleTypeDef* I2S_HandleTypeDef::hdmatx
DMA_HandleTypeDef* I2S_HandleTypeDef::hdmarx
__IO HAL_LockTypeDef I2S_HandleTypeDef::Lock
__IO HAL_I2S_StateTypeDef I2S_HandleTypeDef::State
__IO uint32_t I2S_HandleTypeDef::ErrorCode
25.2
I2S Firmware driver API description
25.2.1
How to use this driver
The I2S HAL driver can be used as follow:
1.
Declare a I2S_HandleTypeDef handle structure.
2.
Initialize the I2S low level resources by implement the HAL_I2S_MspInit() API:
a.
b.
c.
d.
3.
Program the Mode, Standard, Data Format, MCLK Output, Audio frequency and
Polarity using HAL_I2S_Init() function. The specific I2S interrupts (Transmission
complete interrupt, RXNE interrupt and Error Interrupts) will be managed using the
macros __I2S_ENABLE_IT() and __I2S_DISABLE_IT() inside the transmit and
receive process. Make sure that either: I2S PLL is configured or External clock source
is configured after setting correctly the define constant EXTERNAL_CLOCK_VALUE
in the stm32f2xx_hal_conf.h file.
4.
Three operation modes are available within this driver :
Polling mode IO operation
Send an amount of data in blocking mode using HAL_I2S_Transmit()
Enable the SPIx interface clock.
I2S pins configuration:
Enable the clock for the I2S GPIOs.
Configure these I2S pins as alternate function pull-up.
NVIC configuration if you need to use interrupt process (HAL_I2S_Transmit_IT()
and HAL_I2S_Receive_IT() APIs).
Configure the I2Sx interrupt priority.
Enable the NVIC I2S IRQ handle.
DMA Configuration if you need to use DMA process (HAL_I2S_Transmit_DMA()
and HAL_I2S_Receive_DMA() APIs:
Declare a DMA handle structure for the Tx/Rx stream.
Enable the DMAx interface clock.
Configure the declared DMA handle structure with the required Tx/Rx
parameters.
Configure the DMA Tx/Rx Stream.
Associate the initialized DMA handle to the I2S DMA Tx/Rx handle.
Configure the priority and enable the NVIC for the transfer complete interrupt
on the DMA Tx/Rx Stream.
DocID028236 Rev 2
HAL I2S Generic Driver
315/1371
Need help?
Do you have a question about the STM32F2 and is the answer not in the manual?
Questions and answers