We are trying to configure the I2S or now the SAI SDK driver on a 24F for 8 bit voice audio, with a bit clock of 2.048Mhz, a frame rate of 8kHz, and the ability to accept 32 channels (slots).
After trolling through countless app notes, I have come initialization code below. However, I am not aware of a straight forward approach without using the the codec or example in the SAI demo. Our application does not require high audio quality, dsp or fancy filtering .
In particular, for protocols beyond I2S, ie more channels than just 2, I am stuck on the configuration procedure.
//Initialize config structure.
sai_user_config_t tx_config;
tx_config.channel = 0; / *!< Which FIFO is used to transfer. */
tx_config.slave_master = kSaiMaster; /*!< Master (generates own clock) or slave (uses extern clk) .
tx_config.sync_mode = kSaiModeSync; /*!< Synchronous or asynchronous. */
tx_config.protocol = ??? - not I2S /*!< I2S left, I2S right or I2S type. */
tx_config.bclk_source = kSaiBclkSourceMclkDiv;
tx_config.mclk_source = kSaiMclkSourceSysclk; /*!< Master clock source. */
tx_config.mclk_divide_enable = true; /*!< Enable the divide of master clock to generate bit clock. */
//Format of audio data
sai_data_format_t sai_tele_audio_config;
sai_tele_audio_config.sample_rate = 8000U; /*!< Sample rate of the PCM file */
sai_tele_audio_config.mclk = 256 * sai_tele_audio_config.sample_rate ; /*!< Master clock frequency */
sai_tele_audio_config.bits = 8U; /*!< How many bits in a word */
sai_tele_audio_config.mono_streo = kSaiStreo;// ??? Is this just 0x1F for 32 channels/slots? /*!< How many word in a frame */
Many thanks in advance for advice on the above setup procedure.