LPUART Transmitter and Recviever using MCAL

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPUART Transmitter and Recviever using MCAL

跳至解决方案
3,226 次查看
yousefdessouki123
Contributor II

I am new to NXP micrcontrontrollers. I am currently working on S32k118evb where i want it to talk to an application in python. I am have configured the MCU LPUART0 peripheral and double checked them on the debugger, but yet it does not work as itended. I can not send nor recieve anything on the LPUART0 interface. I have used the MCAL layer. I have attached the project. Any assistance would be greatly appreciated.

0 项奖励
回复
1 解答
3,071 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @yousefdessouki123,

Please check the PTB0 RX pin using an oscilloscope to rule out any potential hardware issues.

Make sure that loopback mode is disabled if you intend to use the RX pin for external communication.

To send and receive data, you must use asynchronous mode.
Follow this sequence:

  • Call Uart_AsyncReceive() first to prepare the receiver.
  • Then call Uart_AsyncSend() to transmit data.
  • Use Uart_GetStatus() to monitor the status of the receiver.

 

Thank you,

BR, Daniel

 

 

在原帖中查看解决方案

0 项奖励
回复
8 回复数
3,198 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @yousefdessouki123,

You enabled the loopback option:

danielmartynek_0-1750149473802.png

 

Regards,

Daniel

 

0 项奖励
回复
3,195 次查看
yousefdessouki123
Contributor II

Hi @danielmartynek ,

I enabled loopback mode to internally test the LPUART peripheral, which eliminates the need for physical connections. Aside from this, does loopback mode affect functionality in any other way? Also, why might the peripheral fail to operate correctly when loopback mode is enabled? Is there anything extra i have to write in the MCAL layer application code?

BR

0 项奖励
回复
3,176 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @yousefdessouki123,

You’re right—the loopback mode does not affect transmission.

I ran the project without making any modifications.

As shown below, transmission does occur, but the baud rate is not the configured 115200 kbps.

 

danielmartynek_0-1750235324775.png

 

Let me look into it.

 

BR, Daniel

0 项奖励
回复
3,174 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

I see the problem - there is an inconsistency in the clock configuration.

danielmartynek_0-1750236224341.png

The modules is clocked by 8MHz from SIRCDIV2_CLK.

But the UART module calculates the baudrate from ReferencePoint_0 which is 48MHz.

danielmartynek_1-1750236286676.png

danielmartynek_2-1750236435331.png

 

Regards,

Daniel

0 项奖励
回复
3,111 次查看
yousefdessouki123
Contributor II

Hello @danielmartynek ,

Thanks for the help. I have reconfigured the clock for the LPUART to make it match that of the MCU(48 MHZ). However, the problem presists. In terms of transmission, the LPUART0 TX pin transmits the required data correct in terms of both the duration and frequency of each character. However the problem presists in terms of connecting the TX with the RX pin. The RX pin does not recieve the data. I have reouted the RX pin to PTC8 and PTB0 and still the issue presists. The UART bus is always idle when i try to recieve data. I have attached some screenshots for some tests I did by picoscope. I have also attached the code after fixing the clock issue.

Thanks in advance

0 项奖励
回复
3,093 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @yousefdessouki123,

What exactly do you mean by 'the RX pin does not receive the data'?
If data is visible on the TX pin but not on the RX pin, it likely indicates a hardware issue.
However, if the data appears on the RX pin but the UART module fails to receive it, the issue might be related to loopback mode.

danielmartynek_0-1750920777791.png

 

BR, Daniel

 

0 项奖励
回复
3,080 次查看
yousefdessouki123
Contributor II

Hello @danielmartynek ,

I hope everything is well. The previous test I sent, had the loopback mode disabled, so that I can see the signals on an oscillscope. However, I have tried it again with the loopback mode, but still the issue presists. The Receiver is always idle. Bear in mind, the EVb I have is brand new and only UART has been tested on it. Also, what do you mean by hardware issue? DO you mean the kit is damaged or there is jumper position wrong. 

0 项奖励
回复
3,072 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @yousefdessouki123,

Please check the PTB0 RX pin using an oscilloscope to rule out any potential hardware issues.

Make sure that loopback mode is disabled if you intend to use the RX pin for external communication.

To send and receive data, you must use asynchronous mode.
Follow this sequence:

  • Call Uart_AsyncReceive() first to prepare the receiver.
  • Then call Uart_AsyncSend() to transmit data.
  • Use Uart_GetStatus() to monitor the status of the receiver.

 

Thank you,

BR, Daniel

 

 

0 项奖励
回复