<?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 LPUART Hardware flow control in S32K</title>
    <link>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921797#M4797</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Trying to understand the MODIR values/settings for hardware handshaking&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a simple setup, two SK146 EVBs sitting next to each other.&lt;/P&gt;&lt;P&gt;Connections are crossed, Rx to Tx and CTS to RTS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both boards have UART 0 configured in the same way, one od sending a short message out periodically.&lt;/P&gt;&lt;P&gt;For the purpose of this design, interrupts cannot be used and the receiver is polling the status register and so flow control is required.&lt;/P&gt;&lt;P&gt;There are 8 bits of MODIR involved in the configuration of the handshaking but I find the explanation very confusing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there an application note for this?&lt;/P&gt;&lt;P&gt;Or can someone simply share a known working value for basic cross-connected handshaking?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Jul 2019 14:54:54 GMT</pubDate>
    <dc:creator>brendan_cassidy</dc:creator>
    <dc:date>2019-07-29T14:54:54Z</dc:date>
    <item>
      <title>LPUART Hardware flow control</title>
      <link>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921797#M4797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Trying to understand the MODIR values/settings for hardware handshaking&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a simple setup, two SK146 EVBs sitting next to each other.&lt;/P&gt;&lt;P&gt;Connections are crossed, Rx to Tx and CTS to RTS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Both boards have UART 0 configured in the same way, one od sending a short message out periodically.&lt;/P&gt;&lt;P&gt;For the purpose of this design, interrupts cannot be used and the receiver is polling the status register and so flow control is required.&lt;/P&gt;&lt;P&gt;There are 8 bits of MODIR involved in the configuration of the handshaking but I find the explanation very confusing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there an application note for this?&lt;/P&gt;&lt;P&gt;Or can someone simply share a known working value for basic cross-connected handshaking?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 14:54:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921797#M4797</guid>
      <dc:creator>brendan_cassidy</dc:creator>
      <dc:date>2019-07-29T14:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: LPUART Hardware flow control</title>
      <link>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921798#M4798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For some further&amp;nbsp;info, here is the init code for UART0:&lt;/P&gt;&lt;PRE&gt;void UART0_Init(void)
{ 
&amp;nbsp;// set the pins for Rx and Tx
 PCC-&amp;gt;PCCn[UART0_PIN_CLOCK] |= PCC_PCCn_CGC_MASK; // Enable clock for PORTA 

 UART0_GPIO_BASE-&amp;gt;PDDR |= 1 &amp;lt;&amp;lt; UART0_TX_PIN; // Set tx pin for output

 UART0_PIN_PORT_PAD-&amp;gt;PCR[UART0_TX_PIN]|=PORT_PCR_MUX(4); // Port A27: MUX = ALT4,UART0 TX 
 UART0_PIN_PORT_PAD-&amp;gt;PCR[UART0_RX_PIN]|=PORT_PCR_MUX(4); // Port A28: MUX = ALT4,UART0 RX

 
 PCC-&amp;gt;PCCn[PCC_LPUART0_INDEX] &amp;amp;= ~PCC_PCCn_CGC_MASK; // Ensure clk disabled for config 
 PCC-&amp;gt;PCCn[PCC_LPUART0_INDEX] |= PCC_PCCn_PCS(3);    // PCS=3: Select FIRC 
 PCC-&amp;gt;PCCn[PCC_LPUART0_INDEX] |= PCC_PCCn_CGC_MASK; // Enable clock for LPUART0 regs 
 
 
 // set pins for HW handshake
 PCC-&amp;gt;PCCn[UART0_HS_PIN_CLOCK] |= PCC_PCCn_CGC_MASK; // Enable clock for PORTA 
 
 UART0_HS_BASE-&amp;gt;PDDR |= 1 &amp;lt;&amp;lt; UART0_RTS_PIN; // Set RTS pin for output

 UART0_HS_PORT_PAD-&amp;gt;PCR[UART0_CTS_PIN]|=PORT_PCR_MUX(2); // Port A0: MUX = ALT6,UART0 CTS
 UART0_HS_PORT_PAD-&amp;gt;PCR[UART0_RTS_PIN]|=PORT_PCR_MUX(2); // Port A1: MUX = ALT6,UART0 RTS 
 
 // Enable the RTS and CTS function
 LPUART0-&amp;gt;MODIR |= LPUART_MODIR_TXCTSE(1);
 
 
 // Bit 1 Tx RTS enable
LPUART0-&amp;gt;MODIR |= LPUART_MODIR_TXRTSE(1);
 
 // Bit 2 Txt RTS polarity (active high / low)
 LPUART0-&amp;gt;MODIR |= LPUART_MODIR_TXRTSPOL(0);
 
 
 // Bit 3 Rx RTS enable
 LPUART0-&amp;gt;MODIR |= LPUART_MODIR_RXRTSE(0);
 
 
 // Bit 4 Tx CTS config
 LPUART0-&amp;gt;MODIR |= LPUART_MODIR_TXCTSC(0);
 
 
 // Bit 5 Transmit CTS source

 LPUART0-&amp;gt;MODIR |= LPUART_MODIR_TXCTSSRC(0);
 
 
 // Bits 8 &amp;amp; 9
 // Receive RTS Configuration
 
 LPUART0-&amp;gt;MODIR |= LPUART_MODIR_RTSWATER(0);
 



 // 1000000 baud = 0x0F000003
 // 921600 baud = 0x0C000004 (good for Terra Term


LPUART0-&amp;gt;BAUD = 0x0F000003; // Initialize for 1000000 baud, 1 stop: 
 // SBR=3 (0x3): baud divisor (48MHz/(BAUD_RATE/OSR)) 
 // OSR=15: Over sampling ratio = 15+1=16 
 // SBNS=0: One stop bit 
 // BOTHEDGE=0: receiver samples only on rising edge 
 // M10=0: Rx and Tx use 7 to 9 bit data characters 
 // RESYNCDIS=0: Resync during rec'd data word supported 
 // LBKDIE, RXEDGIE=0: interrupts disable 
 // TDMAE, RDMAE, TDMAE=0: DMA requests disabled 
 // MAEN1, MAEN2, MATCFG=0: Match disabled

LPUART0-&amp;gt;CTRL=0x000C0000; // Enable transmitter &amp;amp; receiver, no parity, 8 bit char: 
 // RE=1: Receiver enabled 
 // TE=1: Transmitter enabled 
 // PE,PT=0: No hw parity generation or checking 
 // M7,M,R8T9,R9T8=0: 8-bit data characters
 // DOZEEN=0: LPUART enabled in Doze mode 
 // ORIE,NEIE,FEIE,PEIE,TIE,TCIE,RIE,ILIE,MA1IE,MA2IE=0: no IRQ
 // TxDIR=0: TxD pin is input if in single-wire mode 
 // TXINV=0: TRansmit data not inverted 
 // RWU,WAKE=0: normal operation; rcvr not in statndby 
 // IDLCFG=0: one idle character 
 // ILT=0: Idle char bit count starts after start bit 
 // SBK=0: Normal transmitter operation - no break char 
 // LOOPS,Rsrc=0: no loop back 
 

 
}&lt;/PRE&gt;&lt;P&gt;I know basic Rx and Tx works, I get comms in both directions but, as expected due to polling, I miss the odd character.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For a simple test, I set&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;LPUART0-&amp;gt;MODIR = LPUART_MODIR_TXRTSE(1)
As above.

Monitor UART0 Tx pin and pull the CTS pin both high and low.
In both cases data is transmitted rather than waiting for CTS to be asserted (pulled high I assume);


&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Jul 2019 15:13:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921798#M4798</guid>
      <dc:creator>brendan_cassidy</dc:creator>
      <dc:date>2019-07-29T15:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: LPUART Hardware flow control</title>
      <link>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921799#M4799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class=""&gt;Brendan Cassidy&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;According to your description: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&lt;BR /&gt;&lt;EM&gt;LPUART0-&amp;gt;MODIR = LPUART_MODIR_TXRTSE(1)&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Monitor UART0 Tx pin and pull the CTS pin both high and low.&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;In both cases data is transmitted rather than waiting for CTS to be asserted&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You don't need the TXRTSE bit to enable, you need the TXCTSE bit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The transmitter checks the state of CTS each time it is ready&lt;BR /&gt;to send a character. If CTS is &lt;STRONG&gt;asserted,&lt;/STRONG&gt; the character&lt;STRONG&gt; is sent&lt;/STRONG&gt;. If CTS is &lt;STRONG&gt;deasserted&lt;/STRONG&gt;, the signal TXD&lt;BR /&gt;remains in the mark state and&lt;STRONG&gt; transmission is delayed&lt;/STRONG&gt; until CTS is asserted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I checked your configuration and I didn't see any problem with the flow control part, unfortunately, there isn't any example code that implements this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not needed this part of the code:&lt;/P&gt;&lt;PRE&gt;UART0_HS_BASE-&amp;gt;PDDR |= 1 &amp;lt;&amp;lt; UART0_RTS_PIN; // Set RTS pin for output&lt;/PRE&gt;&lt;P&gt;And I also notice that you have the mux(2) and you need the mux(6)&lt;/P&gt;&lt;PRE&gt;UART0_HS_PORT_PAD-&amp;gt;PCR[UART0_CTS_PIN]|=PORT_PCR_MUX(2); // Port A0: MUX = ALT6,UART0 CTS
 UART0_HS_PORT_PAD-&amp;gt;PCR[UART0_RTS_PIN]|=PORT_PCR_MUX(2); // Port A1: MUX = ALT6,UART0 RTS &lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this could help you&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jul 2019 23:00:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921799#M4799</guid>
      <dc:creator>jorge_a_vazquez</dc:creator>
      <dc:date>2019-07-30T23:00:55Z</dc:date>
    </item>
    <item>
      <title>Re: LPUART Hardware flow control</title>
      <link>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921800#M4800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jorge&lt;/P&gt;&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;After a few more hours of staring at the code, I did finally realise where the errors were.&lt;BR /&gt;The main one was I was using IART 0 but for some reason picked the CTS and RTS pins for UART 1&lt;BR /&gt;So we would never work.&lt;BR /&gt;Once I hade the correct pins sorted it was a matter of resolving what the did, I found these two:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;// bit 0 Tx CTS enable, Enables clear-to-send operation. 
 // The transmitter checks the state of CTS each time it is ready to send a character. 
 // If CTS is asserted, the character is sent. 
 // If CTS is deasserted, the signal TXD remains in the mark state and transmission is delayed until CTS is asserted. 
 // Changes in CTS as a character is being sent do not affect its transmission.
 LPUART0-&amp;gt;MODIR |= LPUART_MODIR_TXCTSE(1);
 // Confirmed for CTS input.
 // Pull CTS input low to enable tx, if not, board goes into error state as Tx locks up


 // Bit 3 Rx RTS enable 
 // RTS is deasserted if the receiver data register is full or 
 // a start bit has been detected that would cause the receiver data register to become full. 
 // RTS is asserted if the receiver data register is not full and 
 // has not detected a start bit that would cause the receiver data register to become full
 LPUART0-&amp;gt;MODIR |= LPUART_MODIR_RXRTSE(1);
 // Confirmed
 // is asserted low when data can be sent&lt;/PRE&gt;&lt;P&gt;provided the required function.&lt;/P&gt;&lt;P&gt;It was not immediately clear as the descriptions sounded so similar but the fundamental facts are:&lt;/P&gt;&lt;P&gt;CTS is an input that hols up transmission&amp;nbsp;&lt;BR /&gt;RTS is an output that "says, I'm ready for data"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the input and maybe, just maybe, this will help another confuse soul.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 Jul 2019 07:11:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/LPUART-Hardware-flow-control/m-p/921800#M4800</guid>
      <dc:creator>brendan_cassidy</dc:creator>
      <dc:date>2019-07-31T07:11:36Z</dc:date>
    </item>
  </channel>
</rss>

