Hi.
I am having the following issue with the UART driver from the S32DS platform:
I'm working on an application in which my S32K116 is the master in an UART communication with an LMM (TPS92662A, for your reference). To write messages, I just follow the LMM-specific UART commands and can succesfully control it. On the other hand, when asking the LMM which is its current status (SC,OC, OT...), I need to send a message through UART and right away listen to the LMM response which carries its status.
When I send or receive a UART message, the same IRQ is triggered. This IRQ checks for receive data full interrupt or transmit buffer empty. Both cases are checked and they both access to the LPUART register called DATA.
When I call the function to receive data, that function does two things: sets the buffer I send to it as the receive buffer and enables the receive data full interrupt. If this interrupt is not activated, we will not receive any message. See image below:

On the image, arrow points to the part where my buffer is set as the receive buffer and underlined instruction is where the interrupt receive data full is enabled. Same process is applied to the send message function.

If the receive OR the send interrupt is triggered, both go to the same IRQ. This IRQ does the following:
- If the receive data full interrupt is enabled, we get the value from the sub-register DATA of the register LPUART and put it into our receive buffer.
- If the send data empty interrupt is enabled, we put the values from the send buffer to the sub-register DATA of the LPUART register.
Since these cases are not exclusive, if we need communication where we are the masters and our slave responds to our commands, there is a high chance of us getting the values that we are sending into our receive buffer, since we need to listen to the information our slave is going to send to us right after we send our message.


I divided the above function into two screenshots to avoid having a font size too small to read. These if-statements are both in the same IRQ. And we are having the problem I just described:
The data we are sending is being picked up by our receive buffer, making it nearly impossible to know where is the data I need from my slave. As I said before, both access the same DATA sub-register of the LPUART register.

The screenshot above was directly taken from the S32K reference manual.


As it can be seen on the images above, RX and TX access the same register. So, my question is:
Am I missing something to avoid this from happening? Is there a way to avoid/stop the receive buffer from picking up data that is being sent and not received?
Thank you beforehand for your assistance and sorry for the long post.