<?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中的主题 How to get SAI running with FRDM-KL28Z</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-get-SAI-running-with-FRDM-KL28Z/m-p/681639#M41964</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is there any example on how to get SAI running with FRDM-KL28Z using&amp;nbsp;SDK_2.2_FRDM-KL28Z?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried with the below code to send some bytes but it hangs in the&amp;nbsp;SAI_WriteBlocking. This due to register bit FWF (Enabled transmit FIFO is empty) will not be set after sending first word. Anyone knows why?&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Christoffer&lt;/P&gt;&lt;P&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;#define BUFFER_SIZE (64)&lt;/P&gt;&lt;P&gt;uint8_t srcBuff[BUFFER_SIZE];&lt;/P&gt;&lt;P&gt;sai_config_t &amp;nbsp;user_config;&lt;/P&gt;&lt;P&gt;&amp;nbsp;sai_transfer_format_t &amp;nbsp; user_format;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user_config.protocol = kSAI_BusPCMA,&lt;BR /&gt; user_config.masterSlave = kSAI_Master;&lt;BR /&gt; user_config.mclkSource = kSAI_MclkSourceSysclk;&lt;BR /&gt; user_config.bclkSource = kSAI_BclkSourceMclkDiv;&lt;BR /&gt; user_config.syncMode = kSAI_ModeAsync;&lt;/P&gt;&lt;P&gt;SAI_TxInit(I2S0, &amp;amp;user_config);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user_format.bitWidth = 16;&lt;BR /&gt; user_format.channel = 0;&lt;BR /&gt; user_format.masterClockHz = 24000000;&lt;BR /&gt; user_format.protocol = kSAI_BusPCMA;&lt;BR /&gt; user_format.sampleRate_Hz = 8000;&lt;BR /&gt; user_format.stereo = kSAI_Stereo;&lt;BR /&gt; user_format.watermark = 4;&lt;/P&gt;&lt;P&gt;SAI_TransferTxSetFormat(I2S0,&amp;amp;user_handle,&amp;amp;user_format,25000000,24000000);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; SAI_TxEnable(I2S0,true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAI_WriteBlocking(I2S0, 0, 16, srcBuff, BUFFER_SIZE);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 May 2017 13:03:40 GMT</pubDate>
    <dc:creator>christoffer</dc:creator>
    <dc:date>2017-05-16T13:03:40Z</dc:date>
    <item>
      <title>How to get SAI running with FRDM-KL28Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-get-SAI-running-with-FRDM-KL28Z/m-p/681639#M41964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is there any example on how to get SAI running with FRDM-KL28Z using&amp;nbsp;SDK_2.2_FRDM-KL28Z?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried with the below code to send some bytes but it hangs in the&amp;nbsp;SAI_WriteBlocking. This due to register bit FWF (Enabled transmit FIFO is empty) will not be set after sending first word. Anyone knows why?&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Christoffer&lt;/P&gt;&lt;P&gt;////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;#define BUFFER_SIZE (64)&lt;/P&gt;&lt;P&gt;uint8_t srcBuff[BUFFER_SIZE];&lt;/P&gt;&lt;P&gt;sai_config_t &amp;nbsp;user_config;&lt;/P&gt;&lt;P&gt;&amp;nbsp;sai_transfer_format_t &amp;nbsp; user_format;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user_config.protocol = kSAI_BusPCMA,&lt;BR /&gt; user_config.masterSlave = kSAI_Master;&lt;BR /&gt; user_config.mclkSource = kSAI_MclkSourceSysclk;&lt;BR /&gt; user_config.bclkSource = kSAI_BclkSourceMclkDiv;&lt;BR /&gt; user_config.syncMode = kSAI_ModeAsync;&lt;/P&gt;&lt;P&gt;SAI_TxInit(I2S0, &amp;amp;user_config);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user_format.bitWidth = 16;&lt;BR /&gt; user_format.channel = 0;&lt;BR /&gt; user_format.masterClockHz = 24000000;&lt;BR /&gt; user_format.protocol = kSAI_BusPCMA;&lt;BR /&gt; user_format.sampleRate_Hz = 8000;&lt;BR /&gt; user_format.stereo = kSAI_Stereo;&lt;BR /&gt; user_format.watermark = 4;&lt;/P&gt;&lt;P&gt;SAI_TransferTxSetFormat(I2S0,&amp;amp;user_handle,&amp;amp;user_format,25000000,24000000);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; SAI_TxEnable(I2S0,true);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAI_WriteBlocking(I2S0, 0, 16, srcBuff, BUFFER_SIZE);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 May 2017 13:03:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-get-SAI-running-with-FRDM-KL28Z/m-p/681639#M41964</guid>
      <dc:creator>christoffer</dc:creator>
      <dc:date>2017-05-16T13:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get SAI running with FRDM-KL28Z</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-get-SAI-running-with-FRDM-KL28Z/m-p/681640#M41965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&amp;nbsp;christoffer,&lt;/P&gt;&lt;P&gt;There are several SAI examples in SDK_2.2_TWR-KL28Z72M. Maybe you can refer these examples.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="SAI in SDK_2.2_TWR-KL28Z72M.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20356i12C28754E99C42F8/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAI in SDK_2.2_TWR-KL28Z72M.png" alt="SAI in SDK_2.2_TWR-KL28Z72M.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to test the SAI interrupt_transfer example in SDK_2.2_TWR-KL28Z72M with default sai_config.&lt;/P&gt;&lt;P&gt;Just modify the code shown below.&lt;/P&gt;&lt;P&gt;I can hear the tone from headphone which connect to J7-SGTL5000.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="SAI interrupt_transfer SDK_2.2_TWR-KL28Z72M.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/20274i95117F69093A139D/image-size/large?v=v2&amp;amp;px=999" role="button" title="SAI interrupt_transfer SDK_2.2_TWR-KL28Z72M.png" alt="SAI interrupt_transfer SDK_2.2_TWR-KL28Z72M.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have you try to use other user_config.protocol, for example: &lt;/P&gt;&lt;P&gt;user_config.protocol = kSAI_BusLeftJustified;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jun 2017 09:03:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-get-SAI-running-with-FRDM-KL28Z/m-p/681640#M41965</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2017-06-07T09:03:00Z</dc:date>
    </item>
  </channel>
</rss>

