LPUART Transmitter and Recviever using MCAL

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

LPUART Transmitter and Recviever using MCAL

ソリューションへジャンプ
2,774件の閲覧回数
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 解決策
2,619件の閲覧回数
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 返答(返信)
2,746件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi @yousefdessouki123,

You enabled the loopback option:

danielmartynek_0-1750149473802.png

 

Regards,

Daniel

 

0 件の賞賛
返信
2,743件の閲覧回数
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 件の賞賛
返信
2,724件の閲覧回数
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 件の賞賛
返信
2,722件の閲覧回数
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 件の賞賛
返信
2,659件の閲覧回数
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 件の賞賛
返信
2,641件の閲覧回数
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 件の賞賛
返信
2,628件の閲覧回数
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 件の賞賛
返信
2,620件の閲覧回数
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 件の賞賛
返信