SAI for multi-channel PCM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

SAI for multi-channel PCM

1,541 次查看
MADEng
Contributor I

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.



标记 (1)
1 回复

999 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi, MADEng,

Firstly, I think the SAI module can meet your requirement to use 32 slots, the word length is 8 bits, the bit clock output frequency is 2.048MHz.

I do not suggest you call SDK function which will initialize a SAI structure and call an init function. I suggest you write the SAI registers directly, the method is straightforward, and easy to implement.

I attach an example of SAI, but you have to modify it.

If you do want to develop code based on SDK or have issue to modify the example code, pls update the ticket.

BR

XiangJun Rong