<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Kinetis Microcontrollers中的主题 Re: I2S/SAI audio clock setting</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325050#M14886</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Eddie&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I2S and SAI is different audio IP. In K60F120, it is SAI. I think the pdf version may be wrong, I have the same pdf(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;K60P144M150SF3RM.pdf)&lt;/SPAN&gt; and I can find SAI...&lt;/P&gt;&lt;P&gt;For your question,&lt;/P&gt;&lt;P&gt;1. MCLK = LRCLK * &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;CLK_MULT&lt;/SPAN&gt;, also it is divided by MDR register. MCLK = ClockSorceFeq * (MDR[FRACT] + 1)/(MDR[DIVIDE] + 1)&lt;/P&gt;&lt;P&gt;BCLK = MCLK/((TCR2[DIV] + 1) *2)&lt;/P&gt;&lt;P&gt;2. You just need to re-configure the pin mux for the SAI. In MQX, change the function _bsp_sai_io_init(),in mqx\source\bsp\twrk60f120m\init_gpio.c&lt;/P&gt;&lt;P&gt;3. If changed in MQX, in mqx\source\bsp\twrk60f120m\init_sai.c, change the clock source in the structure. If you want to change in registers, change the MCR[MICS] bit, the meaning of each choice can be found in chip configuration chapter of the reference manual.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jun 2014 02:11:35 GMT</pubDate>
    <dc:creator>likong</dc:creator>
    <dc:date>2014-06-27T02:11:35Z</dc:date>
    <item>
      <title>I2S/SAI audio clock setting</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325049#M14885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We build an platform by using TWR-K60F120M(Rev.C ) with my own CODEC board, connected with wire from TWR's female header A21~A25( I2S signal and clock), my system are CW10.5 and MQX4.0.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I test the "i2s_demo" under "mqx" subfolder, insert a microSD card including a 48kHz/24bit stereo wav file then download the project. when I type play command on shell, I can see the wav file is playing well on console( there are some error message stop on "initial_codec" and "setup_codec", so I commented them out to pass it), but the clock signal are not correct. so I change "CLK_MULT" from 384 to 256 then I could measure that MCLK = 12.288MHz and BCLK = 3.072MHz( system use EXTAL_MAIN 50MHZ by default, jumper J18 on and J6 off), that's what I need but LRCK is 64kHz, it's very weird because I had checked the wav file header and played by some audio player, the sample rate is 48kHz, but sample rate on shell message is 51200Hz, and 64000Hz on LRCK pin &lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;as I&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;mentioned earlier.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;So I surveyed AN4520 and AN4800 which document explain about I2S application on Kinetis, the chapter 3.1 have some key words like I2SSRC, but I can't found any clue on K60P144M150SF3RM.pdf, even SIM_SOPTx didn't have any register about I2S/SAI. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We would like to know how to control I2S signal including:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. 3 clocks(MCLK' BCLK and LRCK). &lt;/P&gt;&lt;P&gt;2. 2 data(DIN' DOUT)'s from PTA to PTE.&lt;/P&gt;&lt;P&gt;3. Change clock source from 50MHz(Y1) to 12MHz(Y5) and use it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be &lt;EM class="jive-hilite"&gt;appreciated!&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eddie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Jun 2014 17:48:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325049#M14885</guid>
      <dc:creator>eddiec</dc:creator>
      <dc:date>2014-06-26T17:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: I2S/SAI audio clock setting</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325050#M14886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Eddie&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I2S and SAI is different audio IP. In K60F120, it is SAI. I think the pdf version may be wrong, I have the same pdf(&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;K60P144M150SF3RM.pdf)&lt;/SPAN&gt; and I can find SAI...&lt;/P&gt;&lt;P&gt;For your question,&lt;/P&gt;&lt;P&gt;1. MCLK = LRCLK * &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;CLK_MULT&lt;/SPAN&gt;, also it is divided by MDR register. MCLK = ClockSorceFeq * (MDR[FRACT] + 1)/(MDR[DIVIDE] + 1)&lt;/P&gt;&lt;P&gt;BCLK = MCLK/((TCR2[DIV] + 1) *2)&lt;/P&gt;&lt;P&gt;2. You just need to re-configure the pin mux for the SAI. In MQX, change the function _bsp_sai_io_init(),in mqx\source\bsp\twrk60f120m\init_gpio.c&lt;/P&gt;&lt;P&gt;3. If changed in MQX, in mqx\source\bsp\twrk60f120m\init_sai.c, change the clock source in the structure. If you want to change in registers, change the MCR[MICS] bit, the meaning of each choice can be found in chip configuration chapter of the reference manual.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2014 02:11:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325050#M14886</guid>
      <dc:creator>likong</dc:creator>
      <dc:date>2014-06-27T02:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: I2S/SAI audio clock setting</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325051#M14887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Li,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your kindly reply, I have found an Application Note AN4526 which says the I2SSRC have moved to I2Sx_MDR. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. About the code you said in i2s_demo are: &lt;/P&gt;&lt;P&gt;&lt;BR /&gt;mclk_freq = header.FMT_SUBCHUNK.SampleRate * CLK_MULT;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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 &lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;the actual&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;setting of &lt;/SPAN&gt;&lt;/SPAN&gt;register&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt; like this one( under sai_int_ksai.c):&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; static uint_32 _ki2s_get_mclk_value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; KSAI_INFO_STRUCT_PTR io_info_ptr&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I2S_MemMapPtr i2s_ptr = io_info_ptr-&amp;gt;SAI_PTR;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint_32 freq = _bsp_get_clock(_bsp_get_clock_configuration(), io_info_ptr-&amp;gt;MCLK_SRC);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint_32 fract = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uint_32 div = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fract = (i2s_ptr-&amp;gt;MDR &amp;amp; I2S_MDR_FRACT_MASK) &amp;gt;&amp;gt; I2S_MDR_FRACT_SHIFT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; div = (i2s_ptr-&amp;gt;MDR &amp;amp; I2S_MDR_DIVIDE_MASK) &amp;gt;&amp;gt; I2S_MDR_DIVIDE_SHIFT;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return ((freq / (div + 1)) * (fract + 1));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. This code is very clear to know each pin's function, I can realize the&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt; literal meaning&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;and&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;replicability, but I would like to know more details of each variables setting like question.1, I can't find more &lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;relevant &lt;/SPAN&gt;&lt;/SPAN&gt;code about it, example:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;PORTA_PCR13 |= (PORT_PCR_MUX(0x06) | PORT_PCR_DSE_MASK); &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can't search another result about setting on "PORTA_PCR13", "PORT_PCR_MUX" or "PORT_PCR_DSE_MASK".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. I'll try to adjust it by registers, there's some relevant setting code in bsp_cm.c &amp;amp; bsp_cm.h, I think changing both I2S and system clock is what I need!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. An a&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="hps"&gt;dditional&lt;/SPAN&gt; question is about i2s_demo in MQX. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;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 &lt;SPAN class="short_text" lang="en"&gt;sound file B.wav(48kHz/24bit-stereo), the I2S clock are MCLK = 12.288MHz' SCLK = 3.072MHz' LRCK = 64kHz&lt;SPAN class="short_text" lang="en"&gt;, and playback information on shell displays 51200Hz&lt;/SPAN&gt;, 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.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="short_text" lang="en"&gt;&lt;SPAN class="short_text" lang="en"&gt;If you can give me some &lt;/SPAN&gt;&lt;/SPAN&gt;suggestion to find how it works, that would be grateful!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eddie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2014 16:17:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325051#M14887</guid>
      <dc:creator>eddiec</dc:creator>
      <dc:date>2014-06-27T16:17:27Z</dc:date>
    </item>
    <item>
      <title>Re: I2S/SAI audio clock setting</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325052#M14888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Li,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have found the real value of question 1'2, they are in psp -&amp;gt; Cortex -&amp;gt; MK60F15.h, it's a huge header file which including many parameters!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks~&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eddie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 28 Jun 2014 06:09:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325052#M14888</guid>
      <dc:creator>eddiec</dc:creator>
      <dc:date>2014-06-28T06:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: I2S/SAI audio clock setting</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325053#M14889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I try to understand the i2s demo application and I have some questions if you can help me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Where are audio frames read from SD card? &lt;/P&gt;&lt;P&gt;2.How is realised the sync in real time? &lt;/P&gt;&lt;P&gt;3.How are the&amp;nbsp;&amp;nbsp; frames transfered to the codec? &lt;/P&gt;&lt;P&gt;4.How is realised the synchronize&amp;nbsp; with the&amp;nbsp; playing flow?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2014 09:45:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325053#M14889</guid>
      <dc:creator>madalinastanca</dc:creator>
      <dc:date>2014-07-03T09:45:03Z</dc:date>
    </item>
    <item>
      <title>Re: I2S/SAI audio clock setting</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325054#M14890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Madalina,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your participation! please see my answer below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. About the audio frame you said, I think it's setting in the system, you can find "header.FMT_SUBCHUNK.SampleRate" in sh_audio.c, which including a Sample Rate( audio frame?)'s information of wav(RIFF) header file .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2 &amp;amp; 4. I use logic analyzers to measure whole signal line simultaneously, I can see the clock is accurate but not I want in 48k/24bit( I need 48kHz of LRCK but not 64kHz), the sound quality sounds no problem in 48k/16bit .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. By connected with wire from TWR's female header A21~A25( I2S signal and clock).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eddie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 01:21:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325054#M14890</guid>
      <dc:creator>eddiec</dc:creator>
      <dc:date>2014-07-04T01:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: I2S/SAI audio clock setting</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325055#M14891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Eddie&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For your question 4, in MQX 4.0, it may be a bug...I think maybe the 24-bit audio is not well supported. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Jul 2014 02:03:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/I2S-SAI-audio-clock-setting/m-p/325055#M14891</guid>
      <dc:creator>likong</dc:creator>
      <dc:date>2014-07-04T02:03:35Z</dc:date>
    </item>
  </channel>
</rss>

