LPUART1 RX and TX problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPUART1 RX and TX problem

1,241 Views
623619261
Contributor I

Hello,

   I have some questions about LPUART1 of 'S32K142'.I use it with LIN transceiver 'ATA663211'.

I  use it to be master.

My transmit function is right,but receive function is stranger.

When I want to receive data form slave,I transmit head first.Then I receive data.

I use code like this 'if(LPUART1->STS & rdrf mask) else if(LPUART1->STS & tc mask)' in the interrupt.

The problem is when I want to transmit data,the rdrf is '1',so it do the receive work.I don't know how rdrf to be '1'.

I clear it at first.

So I want to know whether other status would change the rdrf.

Such as over run status,if it's '1',can I clear the rdrf by reading data register.

Tags (2)
0 Kudos
5 Replies

1,052 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Charl Zou, 

Sorry for the late response. 

I recommend you refer to the example lin_master_baremetal for the S32K142-EVB of the SDK 3.0.0. In this example, the Master sends FRAME_MASTER_RECEIVE_DATA header and asks to the slave node responds by sending data. You could use this example as a base to see what you are missing on your project. 


Have a great day,
Victor

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,052 Views
623619261
Contributor I

Thank you for your reply.

  The example only use the lin api,but I don't use sdk.I program by reference mannual.I want to know how to operate the LPUART registers.

  My question is the exceptional 'rdrf' status in register 'LPUART->STS'.  It is setted to '1' for several times,when I transmit data.

  I don't know whether the example in picture is right or not.If it is not the example you said ,please give me a url to download it.

pastedImage_1.png

0 Kudos

1,052 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Charl Zou, 

If you don't want to use the SDK, then I would recommend you refer to the LPUART example that we provide within the Cookbook projects for the S32K142. All these examples were made without the SDK or processor expert. You can use the LPUART example as a starting point to see if you are missing something on your project. 

Link for downloading the cookbook examples. 

Regards, 

Victor 

0 Kudos

1,052 Views
623619261
Contributor I

Thank you,

  But the LPUART example in Cookbook is too simple. The operation of LPUART in this example is as same as my project,except I use interrupt to receive and transmit. I want to konw whether you have other demos or documents about LIN master through operating registers.

  Thank you for your help again! 

0 Kudos

1,052 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hello Charl Zou, 

Within the SDK instead of going to the demo_apps folder, go to driver examples  > communication, in this path you will find a baremetal example of LIN Master.

pastedImage_1.png

Regards, 

Victor 

0 Kudos