NetBurner 3.5.6
PDF Version

Complete configuration structure for the SAI driver. More...

#include <sai.h>

Public Attributes

uint32_t txClkFreq {12288000}
 
uint32_t rxClkFreq {12288000}
 
rxTxSync_t rxTxSync {RXTX_ASYNC}
 
I2S_Type * sai
 
SAI_rxtx_cfg_t rx
 
SAI_rxtx_cfg_t tx
 

Detailed Description

Complete configuration structure for the SAI driver.

This structure encapsulates all configuration parameters for both the transmit and receive channels of the SAI peripheral, along with shared parameters like clock frequencies and synchronization mode.

Clock Configuration

Clock frequencies determine the sample rate:

  • Sample Rate = Clock Frequency / (bits per word x words per frame)
  • Common audio rates: 8kHz, 16kHz, 44.1kHz, 48kHz, 96kHz

Example for 48kHz stereo 24-bit:

  • Clock = 48000 x 24 x 2 = 2,304,000 Hz

Usage

For most applications, use one of the predefined configurations:

  • SAI_I2S_SLAVE_24_TXRX_RK: I2S slave, 24-bit, full duplex, RX clock
  • SAI_LJUST_SLAVE_16_TXRX_TK: Left-justified slave, 16-bit, TX clock

Or customize from a base configuration:

myConfig.txClkFreq = 3072000; // Adjust clock for 16kHz sample rate
myConfig.rx.enable = false; // Transmit only
const SAI_cfg_t SAI_I2S_SLAVE_24_TXRX_RK
Complete configuration structure for the SAI driver.
Definition sai.h:563
SAI_rxtx_cfg_t rx
Definition sai.h:584
uint32_t txClkFreq
Definition sai.h:569
bool enable
Definition sai.h:441

Member Data Documentation

◆ rx

SAI_rxtx_cfg_t SAI_cfg_t::rx

Receive channel configuration

◆ rxClkFreq

uint32_t SAI_cfg_t::rxClkFreq {12288000}

Receive bit clock frequency in Hz. Default: 12.288 MHz

◆ rxTxSync

rxTxSync_t SAI_cfg_t::rxTxSync {RXTX_ASYNC}

Synchronization mode between RX and TX channels

◆ sai

I2S_Type* SAI_cfg_t::sai

Pointer to the SAI hardware instance (SAI1, SAI2, or SAI3)

◆ tx

SAI_rxtx_cfg_t SAI_cfg_t::tx

Transmit channel configuration

◆ txClkFreq

uint32_t SAI_cfg_t::txClkFreq {12288000}

Transmit bit clock frequency in Hz. Must match the actual clock rate for proper operation. Default: 12.288 MHz (512 x 48kHz for 24-bit stereo)


The documentation for this struct was generated from the following file: