SAI_TxSetBitClockRate parameter questions

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

SAI_TxSetBitClockRate parameter questions

跳至解决方案
1,395 次查看
davenadler
Senior Contributor II

I'm trying to set up SAI (send only, as master).
But I'm confused by the SAI_TxSetBitClockRate parameters, documented as:

 

/*!
 * brief Transmitter bit clock rate configurations.
 *
 * param base SAI base pointer.
 * param sourceClockHz, bit clock source frequency.
 * param sampleRate audio data sample rate.
 * param bitWidth, audio data bitWidth.
 * param channelNumbers, audio channel numbers.
 */
void SAI_TxSetBitClockRate(
    I2S_Type *base, uint32_t sourceClockHz, uint32_t sampleRate, uint32_t bitWidth, uint32_t channelNumbers)

 

1) What is uint32_t channelNumbers?
In the code this seems to be used as numberOfChannels (ie 2 for stereo):

 

uint32_t bitClockFreq = sampleRate * bitWidth * channelNumbers;

 

2) What is uint32_t sourceClockHz?
Is this just the module's clock input, as generated by the clock tool, ie

 

#define BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT              63529411UL

 

Thanks in advance,
Best Regards, Dave

 

 

0 项奖励
回复
1 解答
1,368 次查看
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @davenadler ,

Thanks for your interest in NXP MIMXRT series!

1) What is uint32_t channelNumbers?
In the code this seems to be used as numberOfChannels (ie 2 for stereo):

>> Yes, you are right.

2) What is uint32_t sourceClockHz?
Is this just the module's clock input, as generated by the clock tool, ie

>> Yes. It is the clock frequency of the SAI peripheral. It is used to configure the appropriate BCLK.

 

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,369 次查看
Gavin_Jia
NXP TechSupport
NXP TechSupport

Hi @davenadler ,

Thanks for your interest in NXP MIMXRT series!

1) What is uint32_t channelNumbers?
In the code this seems to be used as numberOfChannels (ie 2 for stereo):

>> Yes, you are right.

2) What is uint32_t sourceClockHz?
Is this just the module's clock input, as generated by the clock tool, ie

>> Yes. It is the clock frequency of the SAI peripheral. It is used to configure the appropriate BCLK.

 

0 项奖励
回复
%3CLINGO-SUB%20id%3D%22lingo-sub-2002352%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ESAI_TxSetBitClockRate%E5%8F%82%E6%95%B0%E9%97%AE%E9%A2%98%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2002352%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E6%88%91%E6%AD%A3%E5%9C%A8%E5%B0%9D%E8%AF%95%E8%AE%BE%E7%BD%AE%20SAI%EF%BC%88%E4%BB%85%E5%8F%91%E9%80%81%EF%BC%8C%E4%BD%9C%E4%B8%BA%E4%B8%BB%E6%9C%8D%E5%8A%A1%E5%99%A8%EF%BC%89%E3%80%82%3CBR%20%2F%3E%E4%BD%86%E6%88%91%E5%AF%B9%20SAI_TxSetBitClockRate%20%E5%8F%82%E6%95%B0%E6%84%9F%E5%88%B0%E5%9B%B0%E6%83%91%EF%BC%8C%E8%AE%B0%E5%BD%95%E5%A6%82%E4%B8%8B%EF%BC%9A%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%20translate%3D%22no%22%3E%2F*!%0A%20*%20brief%20Transmitter%20bit%20clock%20rate%20configurations.%0A%20*%0A%20*%20param%20base%20SAI%20base%20pointer.%0A%20*%20param%20sourceClockHz%2C%20bit%20clock%20source%20frequency.%0A%20*%20param%20sampleRate%20audio%20data%20sample%20rate.%0A%20*%20param%20bitWidth%2C%20audio%20data%20bitWidth.%0A%20*%20param%20channelNumbers%2C%20audio%20channel%20numbers.%0A%20*%2F%0Avoid%20SAI_TxSetBitClockRate(%0A%20%20%20%20I2S_Type%20*base%2C%20uint32_t%20sourceClockHz%2C%20uint32_t%20sampleRate%2C%20uint32_t%20bitWidth%2C%20uint32_t%20channelNumbers)%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E1%EF%BC%89%E4%BB%80%E4%B9%88%E6%98%AFuint32_t%20channelNumbers%EF%BC%9F%3C%2FSTRONG%3E%3CBR%20%2F%3E%E5%9C%A8%E4%BB%A3%E7%A0%81%E4%B8%AD%EF%BC%8C%E8%BF%99%E4%BC%BC%E4%B9%8E%E8%A2%AB%E7%94%A8%E4%BD%9C%E9%80%9A%E9%81%93%E6%95%B0%EF%BC%88%E5%8D%B3%E7%AB%8B%E4%BD%93%E5%A3%B0%E4%B8%BA%202%EF%BC%89%EF%BC%9A%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%20translate%3D%22no%22%3Euint32_t%20bitClockFreq%20%3D%20sampleRate%20*%20bitWidth%20*%20channelNumbers%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3E2%EF%BC%89uint32_t%20sourceClockHz%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F%3CBR%20%2F%3E%3C%2FSTRONG%3E%E8%BF%99%E4%BB%85%E4%BB%85%E6%98%AF%E6%A8%A1%E5%9D%97%E7%9A%84%E6%97%B6%E9%92%9F%E8%BE%93%E5%85%A5%E5%90%97%EF%BC%9F%E7%94%B1%E6%97%B6%E9%92%9F%E5%B7%A5%E5%85%B7%E7%94%9F%E6%88%90%EF%BC%8C%E5%8D%B3%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%20translate%3D%22no%22%3E%23define%20BOARD_BOOTCLOCKRUN_SAI1_CLK_ROOT%20%20%20%20%20%20%20%20%20%20%20%20%20%2063529411UL%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%E6%8F%90%E5%89%8D%E8%87%B4%E8%B0%A2%EF%BC%8C%3CBR%20%2F%3E%E8%B0%A8%E8%87%B4%E9%97%AE%E5%80%99%EF%BC%8C%E6%88%B4%E5%A4%AB%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E