<?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>MCUXpresso SDKのトピックfsl_sai_edma.c does not work for multi-channel Rx mode.  MIMXRT1060, i.MX RT</title>
    <link>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1553487#M3987</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I reported this before &lt;A href="https://community.nxp.com/t5/MCUXpresso-SDK/SDK-2-11-fsl-sai-fifo-combine-mode-on-Rx-has-several-bugs/m-p/1485760#M3825" target="_self"&gt;here&lt;/A&gt;, but since it hasn't been fixed in the latest SDK, I wanted to report it again.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Chip&lt;/STRONG&gt;:&amp;nbsp; i.MXRT with multi-channel SAI port&lt;BR /&gt;&lt;STRONG&gt;SDK version&lt;/STRONG&gt;: SDK_2_12_1_EVK-MIMXRT1060.zip&lt;BR /&gt;&lt;STRONG&gt;fsl_sai_edma.h version&lt;/STRONG&gt;: 2.5.0&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The problems&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;There are three separate problems:&lt;BR /&gt;1) the TCE field of TCR3 is currently being set to 1 &amp;lt;&amp;lt; handle-&amp;gt;channel, which only works for single channel operation.&amp;nbsp; it needs to be set to handle-&amp;gt;channelMask&lt;BR /&gt;2) the RCE field of RCR3 must be set to handle-&amp;gt;channelMask, same as #1&lt;BR /&gt;3) in the RxSetConfig, saiConfig-&amp;gt;fifo.fifoCombine&amp;nbsp; *must* be set to 0b10 or 0b11, however, the enums for kSAI_FifoCombineModeEnabledOnRead is incorrect for the SAI4 RCR FCOMB, it is only correct for SAI1 TCR4 FCOMB.&amp;nbsp; So, you need to change the assert statement to be&amp;nbsp;kSAI_FifoCombineModeEnabledOnWrite instead of&amp;nbsp;kSAI_FifoCombineModeEnabledOnRead, for the RCR4 assert.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="caleb_3-1668455688415.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/200259i902B1A411EB42E22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="caleb_3-1668455688415.png" alt="caleb_3-1668455688415.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;caleb_3-1668455688415.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="caleb_2-1668455635275.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/200258iA3E6FAC9BF3F0A47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="caleb_2-1668455635275.png" alt="caleb_2-1668455635275.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;caleb_2-1668455635275.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The mode we want&amp;nbsp; on TCR4 is mode 0b10, and the mode we want on RCR4 is mode 0b10.&amp;nbsp; So, we *always* want 0b10.&lt;/P&gt;&lt;P&gt;However, the enum is defined like this, which is correct ONLY for TCR4 mode.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;typedef enum _sai_fifo_combine
{
    kSAI_FifoCombineDisabled = 0U, /*!&amp;lt; sai fifo combine mode disabled */
    kSAI_FifoCombineModeEnabledOnRead, /*!&amp;lt; sai fifo combine mode enabled on FIFO reads */
    kSAI_FifoCombineModeEnabledOnWrite, /*!&amp;lt; sai fifo combine mode enabled on FIFO write */
    kSAI_FifoCombineModeEnabledOnReadWrite, /*!&amp;lt; sai fifo combined mode enabled on FIFO read/writes */
} sai_fifo_combine_t;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, we must change the fsl_sai_edma.c with the following change:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;***************
*** 439,441 ****
          (saiConfig-&amp;gt;channelNums &amp;lt;= 1U) ||
!         ((saiConfig-&amp;gt;channelNums &amp;gt; 1U) &amp;amp;&amp;amp; ((saiConfig-&amp;gt;fifo.fifoCombine == kSAI_FifoCombineModeEnabledOnWrite) || (saiConfig-&amp;gt;fifo.fifoCombine == kSAI_FifoCombineModeEnabledOnReadWrite))));
--- 439,441 ----
          (saiConfig-&amp;gt;channelNums &amp;lt;= 1U) ||
!         ((saiConfig-&amp;gt;channelNums &amp;gt; 1U) &amp;amp;&amp;amp; ((saiConfig-&amp;gt;fifo.fifoCombine == kSAI_FifoCombineModeEnabledOnRead) || (saiConfig-&amp;gt;fifo.fifoCombine == kSAI_FifoCombineModeEnabledOnReadWrite))));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have included a patch that fixes the issues.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2022 20:02:15 GMT</pubDate>
    <dc:creator>caleb</dc:creator>
    <dc:date>2022-11-14T20:02:15Z</dc:date>
    <item>
      <title>fsl_sai_edma.c does not work for multi-channel Rx mode.  MIMXRT1060, i.MX RT</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1553487#M3987</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; I reported this before &lt;A href="https://community.nxp.com/t5/MCUXpresso-SDK/SDK-2-11-fsl-sai-fifo-combine-mode-on-Rx-has-several-bugs/m-p/1485760#M3825" target="_self"&gt;here&lt;/A&gt;, but since it hasn't been fixed in the latest SDK, I wanted to report it again.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Chip&lt;/STRONG&gt;:&amp;nbsp; i.MXRT with multi-channel SAI port&lt;BR /&gt;&lt;STRONG&gt;SDK version&lt;/STRONG&gt;: SDK_2_12_1_EVK-MIMXRT1060.zip&lt;BR /&gt;&lt;STRONG&gt;fsl_sai_edma.h version&lt;/STRONG&gt;: 2.5.0&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The problems&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;There are three separate problems:&lt;BR /&gt;1) the TCE field of TCR3 is currently being set to 1 &amp;lt;&amp;lt; handle-&amp;gt;channel, which only works for single channel operation.&amp;nbsp; it needs to be set to handle-&amp;gt;channelMask&lt;BR /&gt;2) the RCE field of RCR3 must be set to handle-&amp;gt;channelMask, same as #1&lt;BR /&gt;3) in the RxSetConfig, saiConfig-&amp;gt;fifo.fifoCombine&amp;nbsp; *must* be set to 0b10 or 0b11, however, the enums for kSAI_FifoCombineModeEnabledOnRead is incorrect for the SAI4 RCR FCOMB, it is only correct for SAI1 TCR4 FCOMB.&amp;nbsp; So, you need to change the assert statement to be&amp;nbsp;kSAI_FifoCombineModeEnabledOnWrite instead of&amp;nbsp;kSAI_FifoCombineModeEnabledOnRead, for the RCR4 assert.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="caleb_3-1668455688415.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/200259i902B1A411EB42E22/image-size/medium?v=v2&amp;amp;px=400" role="button" title="caleb_3-1668455688415.png" alt="caleb_3-1668455688415.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;caleb_3-1668455688415.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="caleb_2-1668455635275.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/200258iA3E6FAC9BF3F0A47/image-size/medium?v=v2&amp;amp;px=400" role="button" title="caleb_2-1668455635275.png" alt="caleb_2-1668455635275.png" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;caleb_2-1668455635275.png&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The mode we want&amp;nbsp; on TCR4 is mode 0b10, and the mode we want on RCR4 is mode 0b10.&amp;nbsp; So, we *always* want 0b10.&lt;/P&gt;&lt;P&gt;However, the enum is defined like this, which is correct ONLY for TCR4 mode.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;typedef enum _sai_fifo_combine
{
    kSAI_FifoCombineDisabled = 0U, /*!&amp;lt; sai fifo combine mode disabled */
    kSAI_FifoCombineModeEnabledOnRead, /*!&amp;lt; sai fifo combine mode enabled on FIFO reads */
    kSAI_FifoCombineModeEnabledOnWrite, /*!&amp;lt; sai fifo combine mode enabled on FIFO write */
    kSAI_FifoCombineModeEnabledOnReadWrite, /*!&amp;lt; sai fifo combined mode enabled on FIFO read/writes */
} sai_fifo_combine_t;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, we must change the fsl_sai_edma.c with the following change:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;***************
*** 439,441 ****
          (saiConfig-&amp;gt;channelNums &amp;lt;= 1U) ||
!         ((saiConfig-&amp;gt;channelNums &amp;gt; 1U) &amp;amp;&amp;amp; ((saiConfig-&amp;gt;fifo.fifoCombine == kSAI_FifoCombineModeEnabledOnWrite) || (saiConfig-&amp;gt;fifo.fifoCombine == kSAI_FifoCombineModeEnabledOnReadWrite))));
--- 439,441 ----
          (saiConfig-&amp;gt;channelNums &amp;lt;= 1U) ||
!         ((saiConfig-&amp;gt;channelNums &amp;gt; 1U) &amp;amp;&amp;amp; ((saiConfig-&amp;gt;fifo.fifoCombine == kSAI_FifoCombineModeEnabledOnRead) || (saiConfig-&amp;gt;fifo.fifoCombine == kSAI_FifoCombineModeEnabledOnReadWrite))));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have included a patch that fixes the issues.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 20:02:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1553487#M3987</guid>
      <dc:creator>caleb</dc:creator>
      <dc:date>2022-11-14T20:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: fsl_sai_edma.c does not work for multi-channel Rx mode.  MIMXRT1060, i.MX RT</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1553488#M3988</link>
      <description>&lt;P&gt;As an aside for anybody else trying to get the SAI to work in multi-channel mode, it's also critical that you set the Tx pin mode to TriState with something like this, or the TX will take over and drive zeros on SAI1_RX_DATA[1..3]&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// NOTE!  This is your configuration for the Tx
// side of the SAI to get the Rx side to work!

sai_transceiver_t config;
SAI_GetTDMConfig(
    &amp;amp;config,
    kSAI_FrameSyncLenOneBitClk, 
    kSAI_WordWidth32bits, 
    16, 
    kSAI_Channel0Mask | kSAI_Channel1Mask | kSAI_Channel2Mask);
config.serialData.dataMode = kSAI_DataPinStateTriState;
[...]
SAI_TransferTxSetConfigEDMA(sai, &amp;amp;sai_edma_handle, &amp;amp;config);
[...]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2022 20:13:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1553488#M3988</guid>
      <dc:creator>caleb</dc:creator>
      <dc:date>2022-11-14T20:13:35Z</dc:date>
    </item>
    <item>
      <title>Re: fsl_sai_edma.c does not work for multi-channel Rx mode.  MIMXRT1060, i.MX RT</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1555308#M3999</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/80818"&gt;@caleb&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;Thanks for reporting this bug.&lt;/P&gt;
&lt;P&gt;This issue has already been reported to the SDK team, and they are currently working on it. It is possible that&amp;nbsp;the next mayor SDK release will implement the fix, but we cannot say for sure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your patience,&lt;/P&gt;
&lt;P&gt;Edwin.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 23:08:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1555308#M3999</guid>
      <dc:creator>EdwinHz</dc:creator>
      <dc:date>2022-11-16T23:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: fsl_sai_edma.c does not work for multi-channel Rx mode.  MIMXRT1060, i.MX RT</title>
      <link>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1569896#M4059</link>
      <description>&lt;P&gt;Many thanks for the tri-state find!&amp;nbsp; I've been working for days trying to figure out why I wasn't getting any Rx data properly when using the non-deprecated (config vs format) initialization code.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Dec 2022 17:22:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-SDK/fsl-sai-edma-c-does-not-work-for-multi-channel-Rx-mode/m-p/1569896#M4059</guid>
      <dc:creator>scott_thompson</dc:creator>
      <dc:date>2022-12-14T17:22:12Z</dc:date>
    </item>
  </channel>
</rss>

