I am trying to do UART communication using interrupt in s32k146 development board. I am new in this board. I am attaching the code. Please help me where i am going wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to do UART communication using interrupt in s32k146 development board. I am new in this board. I am attaching the code. Please help me where i am going wrong.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Diana. It works fine now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Diana thanks for replying. I have tried your code as given. only transmission is working but receive echo is not working. please help me. I have also tried with LPUART2 but it is not worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
This test code use interrupts only to receive. Did you enable receive interrupt in the LPUART1->CTRL?
For me, it is working well. When I write something to the terminal (red characters) the interrupt is generated and the character is sent back (the yellow one). See the image below.
I hope ti helps.
Best regards,
Diana

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Subham,
It seems that you combine SDK (lpuart_echo_S32K146) and nonSDK examples together.
I recommend you to use this very simple nonSDK example for the S32K144 which uses LPUART interrupt.
Please, download LPUART.zip
https://community.nxp.com/message/957747?commentID=957747#comment-957747
You can simply modify it for S32K146. The first step is to create a new empty nonSDK project for S32K146 and after that, you can copy the source code from that example and check the ports.
If you have any trouble with this, please, let me know.
Best regards,
Diana
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for replying Diana.I have written the code as u told but after sending one bit it stops sending and it stuck in this instruction below.
while((LPUART2->STAT & LPUART_STAT_TDRE_MASK)>>LPUART_STAT_TDRE_SHIFT==0);
and also in receive section i am facing the issue with the instruction below.
while((LPUART2->STAT & LPUART_STAT_RDRF_MASK)>>LPUART_STAT_RDRF_SHIFT==0);
please help me.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Subham,
I modified the code for the S32K146 and I'm using LPUART1 because these pins are connected to OpenSDA (the board is connected via USB to PC). So, I'm using the terminal for communication. Could you please try this attached test code at first?
TDRE will set when the transmit DATA register is empty.
RDRF is set when the receive buffer (the DATA register) is full.
For more details please refer to RM rev 11. section 51.3.1.7 LPUART Status Register (STAT)
Best regards,
Diana
