<?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>topic S32K148 LPSPI Busy After Transfer Complete with RXMSK in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K148-LPSPI-Busy-After-Transfer-Complete-with-RXMSK/m-p/2343296#M57654</link>
    <description>&lt;P&gt;I am having issues when doing LPSPI transfers in master mode with RXMSK set.&lt;/P&gt;&lt;P&gt;Below is the follow code snippet that I perform to write the TDR and read the RDR based on the framesize of the transfer. Once all TX FIFO write, and RX FIFO reads have occurred, we exit the transfer function.&lt;/P&gt;&lt;P&gt;I used to also check for the TCF in the do-while() logic, but I started noticing that the function would always timeout (3ms timeout in this instance) even though I had performed all Tx/Rx writes/reads, and the Chip Select was verified by Oscope to de-assert. This was causing me issues, so I got rid of the check for TCF, and instead clear flags at the beginning of the transfer.&lt;/P&gt;&lt;P&gt;When I removed the TCF check in the do-while() logic, I started dropping SPI transfers when calling this routine repeatedly due to the MBF being set when I initiated this routine. I then noticed when I performed transfers with RXMSK set (c_rxwrds = 0 when RXMSK is set) I would observe this timeout behavior, but not when RXMSK was cleared.&lt;/P&gt;&lt;P&gt;Guess the TCF flag taking so long to set was trying to tell me something, but I cannot find any reference material that would suggest the MBF/TCF would be set longer than the expected transfer time considering Bit Rate and Framesize (Bit Rate = 4MHz; Framesize = 16-264).&lt;/P&gt;&lt;P&gt;Is there any documentation related to the RXMSK and how it might affect the TCF/MBF?&lt;/P&gt;&lt;P&gt;Would also like to note that both CONT/CONTC are 0 during transfers.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;// Check if module is free, and attempt to set TCR&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;if (0U == (pInst-&amp;gt;SR &amp;amp; LPSPI_SR_MBF_MASK))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; // Clear any lingering status flags&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; pInst-&amp;gt;SR |= SR_W1C_FLAGS;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; // Checking for true garuntees we are able to start the intended transfer&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; if (true == Set_Tcr(pInst, pTcr))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; // Get time at start of transfer&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; start_time = Timer_Get_LptmrCnr();&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; // Perform all necessary Tx/Rx actions&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; do&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Attempt to fill Tx fifo if there are still words to transmit&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; while ((c_txwrds &amp;gt; 0U)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;&amp;amp; (true == Set_Tdr(pInst, tx_data[exp_wrds - c_txwrds])))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c_txwrds--;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Attempt to empty Rx fifo if there are still words to receive&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; while ((c_rxwrds &amp;gt; 0U)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;&amp;amp; (true == Get_Rdr(pInst, &amp;amp;rx_data[exp_wrds - c_rxwrds])))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c_rxwrds--;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; } while ( ((c_txwrds + c_rxwrds) &amp;gt; 0U)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;&amp;amp; (false == Timer_TimerExpired(start_time, timeout)));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;}&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Apr 2026 00:25:15 GMT</pubDate>
    <dc:creator>sean_dvorscak</dc:creator>
    <dc:date>2026-04-01T00:25:15Z</dc:date>
    <item>
      <title>S32K148 LPSPI Busy After Transfer Complete with RXMSK</title>
      <link>https://community.nxp.com/t5/S32K/S32K148-LPSPI-Busy-After-Transfer-Complete-with-RXMSK/m-p/2343296#M57654</link>
      <description>&lt;P&gt;I am having issues when doing LPSPI transfers in master mode with RXMSK set.&lt;/P&gt;&lt;P&gt;Below is the follow code snippet that I perform to write the TDR and read the RDR based on the framesize of the transfer. Once all TX FIFO write, and RX FIFO reads have occurred, we exit the transfer function.&lt;/P&gt;&lt;P&gt;I used to also check for the TCF in the do-while() logic, but I started noticing that the function would always timeout (3ms timeout in this instance) even though I had performed all Tx/Rx writes/reads, and the Chip Select was verified by Oscope to de-assert. This was causing me issues, so I got rid of the check for TCF, and instead clear flags at the beginning of the transfer.&lt;/P&gt;&lt;P&gt;When I removed the TCF check in the do-while() logic, I started dropping SPI transfers when calling this routine repeatedly due to the MBF being set when I initiated this routine. I then noticed when I performed transfers with RXMSK set (c_rxwrds = 0 when RXMSK is set) I would observe this timeout behavior, but not when RXMSK was cleared.&lt;/P&gt;&lt;P&gt;Guess the TCF flag taking so long to set was trying to tell me something, but I cannot find any reference material that would suggest the MBF/TCF would be set longer than the expected transfer time considering Bit Rate and Framesize (Bit Rate = 4MHz; Framesize = 16-264).&lt;/P&gt;&lt;P&gt;Is there any documentation related to the RXMSK and how it might affect the TCF/MBF?&lt;/P&gt;&lt;P&gt;Would also like to note that both CONT/CONTC are 0 during transfers.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;// Check if module is free, and attempt to set TCR&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;if (0U == (pInst-&amp;gt;SR &amp;amp; LPSPI_SR_MBF_MASK))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; // Clear any lingering status flags&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; pInst-&amp;gt;SR |= SR_W1C_FLAGS;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; // Checking for true garuntees we are able to start the intended transfer&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; if (true == Set_Tcr(pInst, pTcr))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; // Get time at start of transfer&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; start_time = Timer_Get_LptmrCnr();&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; // Perform all necessary Tx/Rx actions&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; do&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Attempt to fill Tx fifo if there are still words to transmit&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; while ((c_txwrds &amp;gt; 0U)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;&amp;amp; (true == Set_Tdr(pInst, tx_data[exp_wrds - c_txwrds])))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c_txwrds--;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; // Attempt to empty Rx fifo if there are still words to receive&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; while ((c_rxwrds &amp;gt; 0U)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;&amp;amp; (true == Get_Rdr(pInst, &amp;amp;rx_data[exp_wrds - c_rxwrds])))&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c_rxwrds--;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; } while ( ((c_txwrds + c_rxwrds) &amp;gt; 0U)&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;&amp;amp; (false == Timer_TimerExpired(start_time, timeout)));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;}&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2026 00:25:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K148-LPSPI-Busy-After-Transfer-Complete-with-RXMSK/m-p/2343296#M57654</guid>
      <dc:creator>sean_dvorscak</dc:creator>
      <dc:date>2026-04-01T00:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: S32K148 LPSPI Busy After Transfer Complete with RXMSK</title>
      <link>https://community.nxp.com/t5/S32K/S32K148-LPSPI-Busy-After-Transfer-Complete-with-RXMSK/m-p/2343510#M57665</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;the TCF is set when the LPSPI returns to idle state with the transmit FIFO empty.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The code you shared does not show where SR flags are checked, if ever, maybe in Set_Tdr or Get_Rdr. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You should rather use RDF and TDF flags to know when RX FIFO/TX FIFO can be read/written. With RXMSK no data is expected to be read out, but you should rely on TDF to be sure TX FIFO is ready to accept new data.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;BR, Petr&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Apr 2026 08:30:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K148-LPSPI-Busy-After-Transfer-Complete-with-RXMSK/m-p/2343510#M57665</guid>
      <dc:creator>PetrS</dc:creator>
      <dc:date>2026-04-01T08:30:33Z</dc:date>
    </item>
    <item>
      <title>Re: S32K148 LPSPI Busy After Transfer Complete with RXMSK</title>
      <link>https://community.nxp.com/t5/S32K/S32K148-LPSPI-Busy-After-Transfer-Complete-with-RXMSK/m-p/2344808#M57695</link>
      <description>Thanks for the reply.&lt;BR /&gt;&lt;BR /&gt;I found a couple of problems with the logic I had, and I also updated my Get_Rdr/Set_Tdr functions to poll the RDF/TDF instead of monitoring the RXCOUNT/TXCOUNT.&lt;BR /&gt;&lt;BR /&gt;I think a combination of both these changes has made my function overrun problem go away for now.</description>
      <pubDate>Thu, 02 Apr 2026 20:16:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K148-LPSPI-Busy-After-Transfer-Complete-with-RXMSK/m-p/2344808#M57695</guid>
      <dc:creator>sean_dvorscak</dc:creator>
      <dc:date>2026-04-02T20:16:55Z</dc:date>
    </item>
  </channel>
</rss>

