<?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 Re: S32K144 Uart Receive Problem in S32K</title>
    <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675883#M24378</link>
    <description>&lt;P&gt;&lt;A href="mailto:Hi@AllenGlen" target="_blank"&gt;Hi@AllenGlen&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Senlent_0-1687770458113.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/229289i91C0B000CD0EC4EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Senlent_0-1687770458113.png" alt="Senlent_0-1687770458113.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jun 2023 09:07:48 GMT</pubDate>
    <dc:creator>Senlent</dc:creator>
    <dc:date>2023-06-26T09:07:48Z</dc:date>
    <item>
      <title>S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675759#M24362</link>
      <description>&lt;P&gt;Hello Sirs,&lt;BR /&gt;&amp;nbsp;I'm using the S32K144 sample cookbook for UART. The transmit function works fine however the receive doesn't work. I've debugged it a little and the program gets stuck in the line&lt;BR /&gt;&lt;STRONG&gt;while((LPUART1-&amp;gt;STAT &amp;amp; LPUART_STAT_RDRF_MASK)&amp;gt;&amp;gt;LPUART_STAT_RDRF_SHIFT==0);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;You can see in the attached photo, the character 'a' should've been echoed in the terminal, but its not.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AllenGlen_0-1687764935066.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/229250i23962C5C4CAE1F77/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AllenGlen_0-1687764935066.png" alt="AllenGlen_0-1687764935066.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The source code :&lt;BR /&gt;int main(void)&lt;BR /&gt;{&lt;BR /&gt;/*!&lt;BR /&gt;* Initialization:&lt;BR /&gt;* =======================&lt;BR /&gt;*/&lt;BR /&gt;WDOG_disable(); /* Disable WDOG */&lt;BR /&gt;SOSC_init_8MHz(); /* Initialize system oscilator for 8 MHz xtal */&lt;BR /&gt;SPLL_init_160MHz(); /* Initialize SPLL to 160 MHz with 8 MHz SOSC */&lt;BR /&gt;NormalRUNmode_80MHz(); /* Init clocks: 80 MHz sysclk &amp;amp; core, 40 MHz bus, 20 MHz flash */&lt;BR /&gt;PORT_init(); /* Configure ports */&lt;BR /&gt;&lt;BR /&gt;LPUART1_init(); /* Initialize LPUART @ 9600*/&lt;BR /&gt;LPUART1_transmit_string("Running LPUART example\n\r"); /* Transmit char string */&lt;BR /&gt;LPUART1_transmit_string("Input character to echo...\n\r"); /* Transmit char string */&lt;BR /&gt;&lt;BR /&gt;while(1)&lt;BR /&gt;{&lt;BR /&gt;LPUART1_transmit_char('&amp;gt;'); /* Transmit prompt character*/&lt;BR /&gt;LPUART1_receive_and_echo_char(); /* Wait for input char, receive &amp;amp; echo it*/&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;char LPUART1_receive_char(void) { /* Function to Receive single Char */&lt;BR /&gt;static char receive;&lt;BR /&gt;while((LPUART1-&amp;gt;STAT &amp;amp; LPUART_STAT_RDRF_MASK)&amp;gt;&amp;gt;LPUART_STAT_RDRF_SHIFT==0);&lt;BR /&gt;/* Wait for received buffer to be full */&lt;BR /&gt;PTD-&amp;gt;PCOR |= (1 &amp;lt;&amp;lt; 0);&lt;BR /&gt;receive= LPUART1-&amp;gt;DATA; /* Read received data*/&lt;BR /&gt;return receive;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void LPUART1_receive_and_echo_char(void) { /* Function to echo received char back */&lt;BR /&gt;char send = LPUART1_receive_char(); /* Receive Char */&lt;BR /&gt;LPUART1_transmit_char(send); /* Transmit same char back to the sender */&lt;BR /&gt;LPUART1_transmit_char('\n'); /* New line */&lt;BR /&gt;LPUART1_transmit_char('\r'); /* Return */&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void LPUART1_init(void) /* Init. summary: 9600 baud, 1 stop bit, 8 bit format, no parity */&lt;BR /&gt;{&lt;BR /&gt;PCC-&amp;gt;PCCn[PCC_LPUART1_INDEX] &amp;amp;= ~PCC_PCCn_CGC_MASK; /* Ensure clk disabled for config */&lt;BR /&gt;PCC-&amp;gt;PCCn[PCC_LPUART1_INDEX] |= PCC_PCCn_PCS(2) /* Clock src=2 (SIRCDIV2_CLK) */&lt;BR /&gt;| PCC_PCCn_CGC_MASK; /* Enable clock for LPUART1 regs */&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;LPUART1-&amp;gt;BAUD = LPUART_BAUD_SBR(0x34) | LPUART_BAUD_OSR(15);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;LPUART1-&amp;gt;CTRL = LPUART_CTRL_RE_MASK | LPUART_CTRL_TE_MASK;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 07:39:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675759#M24362</guid>
      <dc:creator>cabz</dc:creator>
      <dc:date>2023-06-26T07:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675854#M24374</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@AllenGlen" target="_blank"&gt;Hi@AllenGlen&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You type the character 'a' and the device responds with "&amp;gt;a", isn't that normal?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 08:49:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675854#M24374</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2023-06-26T08:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675872#M24376</link>
      <description>&lt;P&gt;no, the pink color signifies I sent it. The black color signifies I received it.&lt;/P&gt;&lt;P&gt;I should receive a black colored 'a' character.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 09:02:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675872#M24376</guid>
      <dc:creator>cabz</dc:creator>
      <dc:date>2023-06-26T09:02:57Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675883#M24378</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@AllenGlen" target="_blank"&gt;Hi@AllenGlen&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Senlent_0-1687770458113.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/229289i91C0B000CD0EC4EF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Senlent_0-1687770458113.png" alt="Senlent_0-1687770458113.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 09:07:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675883#M24378</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2023-06-26T09:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675889#M24379</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AllenGlen_0-1687770941359.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/229290i7711A9DEAF9FF7E6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AllenGlen_0-1687770941359.png" alt="AllenGlen_0-1687770941359.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;do you think this is hardware problem sir?&lt;BR /&gt;I also see the CTS in your terminal is shining... what do you think it means&lt;/P&gt;&lt;P&gt;btw I'm using IAR, and this code is from its samples.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 09:21:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675889#M24379</guid>
      <dc:creator>cabz</dc:creator>
      <dc:date>2023-06-26T09:21:43Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675895#M24380</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@AllenGlen" target="_blank"&gt;Hi@AllenGlen&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Very likely, I tested the "S32K144_Project_LPUART" routine, the result is normal&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 09:22:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675895#M24380</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2023-06-26T09:22:41Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675905#M24383</link>
      <description>I've checked the 2 other boards, they also doesn't work...</description>
      <pubDate>Mon, 26 Jun 2023 09:45:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675905#M24383</guid>
      <dc:creator>cabz</dc:creator>
      <dc:date>2023-06-26T09:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675915#M24385</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@AllenGlen" target="_blank"&gt;Hi@AllenGlen&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Are you using S32K144EVB? The following is the code I tested, I don't see any difference.&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;/*
 * Copyright (c) 2014 - 2016, Freescale Semiconductor, Inc.
 * Copyright (c) 2016 - 2018, NXP.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * 3. Neither the name of the copyright holder nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "device_registers.h"	/* include peripheral declarations S32K144 */
#include "LPUART.h"

void LPUART1_init(void)  /* Init. summary: 9600 baud, 1 stop bit, 8 bit format, no parity */
{
	PCC-&amp;gt;PCCn[PCC_LPUART1_INDEX] &amp;amp;= ~PCC_PCCn_CGC_MASK;    /* Ensure clk disabled for config */
	PCC-&amp;gt;PCCn[PCC_LPUART1_INDEX] |= PCC_PCCn_PCS(0b010)    /* Clock src=2 (SIRCDIV2_CLK) */
                            	 |  PCC_PCCn_CGC_MASK;     /* Enable clock for LPUART1 regs */

	LPUART1-&amp;gt;BAUD = LPUART_BAUD_SBR(0x34)  	/* Initialize for 9600 baud, 1 stop: */
                	|LPUART_BAUD_OSR(15);  	/* SBR=52 (0x34): baud divisor = 8M/9600/16 = ~52 */
											/* 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 */

	LPUART1-&amp;gt;CTRL =	LPUART_CTRL_RE_MASK
					|LPUART_CTRL_TE_MASK;   	/* 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 */
}

void LPUART1_transmit_char(char send) {    /* Function to Transmit single Char */
	while((LPUART1-&amp;gt;STAT &amp;amp; LPUART_STAT_TDRE_MASK)&amp;gt;&amp;gt;LPUART_STAT_TDRE_SHIFT==0);
	/* Wait for transmit buffer to be empty */
	LPUART1-&amp;gt;DATA=send;              /* Send data */
}

void LPUART1_transmit_string(char data_string[])  {  /* Function to Transmit whole string */
	uint32_t i=0;
	while(data_string[i] != '\0')  {           /* Send chars one at a time */
		LPUART1_transmit_char(data_string[i]);
		i++;
	}
}

char LPUART1_receive_char(void) {    /* Function to Receive single Char */
	char receive;
	while((LPUART1-&amp;gt;STAT &amp;amp; LPUART_STAT_RDRF_MASK)&amp;gt;&amp;gt;LPUART_STAT_RDRF_SHIFT==0);
	/* Wait for received buffer to be full */
	receive= LPUART1-&amp;gt;DATA;            /* Read received data*/
	return receive;
}

void LPUART1_receive_and_echo_char(void)  {  /* Function to echo received char back */
	char send = LPUART1_receive_char();        /* Receive Char */
	LPUART1_transmit_char(send);               /* Transmit same char back to the sender */
	LPUART1_transmit_char('\n');               /* New line */
	LPUART1_transmit_char('\r');               /* Return */
}
&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 09:50:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675915#M24385</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2023-06-26T09:50:31Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675922#M24386</link>
      <description>&lt;P&gt;yes sir,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think my pin connections are also correct, PTC6, PTC7 and 3.3V and GND&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AllenGlen_0-1687773262580.jpeg" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/229298i460997FABC40B686/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AllenGlen_0-1687773262580.jpeg" alt="AllenGlen_0-1687773262580.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 09:55:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1675922#M24386</guid>
      <dc:creator>cabz</dc:creator>
      <dc:date>2023-06-26T09:55:08Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1676495#M24422</link>
      <description>&lt;P&gt;&lt;A href="mailto:Hi@AllenGlen" target="_blank"&gt;Hi@AllenGlen&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;ok, you don't need to connect like this, just use USB directly&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 02:12:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1676495#M24422</guid>
      <dc:creator>Senlent</dc:creator>
      <dc:date>2023-06-27T02:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144 Uart Receive Problem</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1676931#M24459</link>
      <description>&lt;P&gt;It works now, the problem must've been the serial wire. Thank you ^3^&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 10:08:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Uart-Receive-Problem/m-p/1676931#M24459</guid>
      <dc:creator>cabz</dc:creator>
      <dc:date>2023-06-27T10:08:18Z</dc:date>
    </item>
  </channel>
</rss>

