Dear Li,
Thanks for your kindly reply, I have found an Application Note AN4526 which says the I2SSRC have moved to I2Sx_MDR.
1. About the code you said in i2s_demo are:
mclk_freq = header.FMT_SUBCHUNK.SampleRate * CLK_MULT;
The sample rate is come from wav file's header(48kHz), I think it's OK because the MCLK I measured is 12.288MHz, but I can't found the actual setting of register like this one( under sai_int_ksai.c):
static uint_32 _ki2s_get_mclk_value
(
KSAI_INFO_STRUCT_PTR io_info_ptr
)
{
I2S_MemMapPtr i2s_ptr = io_info_ptr->SAI_PTR;
uint_32 freq = _bsp_get_clock(_bsp_get_clock_configuration(), io_info_ptr->MCLK_SRC);
uint_32 fract = 0;
uint_32 div = 0;
fract = (i2s_ptr->MDR & I2S_MDR_FRACT_MASK) >> I2S_MDR_FRACT_SHIFT;
div = (i2s_ptr->MDR & I2S_MDR_DIVIDE_MASK) >> I2S_MDR_DIVIDE_SHIFT;
return ((freq / (div + 1)) * (fract + 1));
}
It's looks like the formula to get MCLK, when I search "I2S_MDR_FRACT_MASK" or "I2S_MDR_FRACT_SHIFT", it doesn't exist in another code, where can I check the value they are?
2. This code is very clear to know each pin's function, I can realize the literal meaning and replicability, but I would like to know more details of each variables setting like question.1, I can't find more relevant code about it, example:
PORTA_PCR13 |= (PORT_PCR_MUX(0x06) | PORT_PCR_DSE_MASK);
I can't search another result about setting on "PORTA_PCR13", "PORT_PCR_MUX" or "PORT_PCR_DSE_MASK".
3. I'll try to adjust it by registers, there's some relevant setting code in bsp_cm.c & bsp_cm.h, I think changing both I2S and system clock is what I need!
4. An additional question is about i2s_demo in MQX.
When I played a sound file A.wav(48kHz/16bit-stereo), the I2S clock are MCLK = 12.288MHz' SCLK = 1.536MHz' LRCK = 48kHz, and playback information on shell displays 48000Hz, it plays no problem; but when I play a sound file B.wav(48kHz/24bit-stereo), the I2S clock are MCLK = 12.288MHz' SCLK = 3.072MHz' LRCK = 64kHz, and playback information on shell displays 51200Hz, it's very strange because 1536/48 is not equal to 3072/64, It's hard to realize how system can get these value, especially 51200 on shell.
If you can give me some suggestion to find how it works, that would be grateful!
With regards,
Eddie