LPUART in Transfer mode

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

LPUART in Transfer mode

Jump to solution
1,639 Views
Maciek
Contributor V

Transfer structure for LPUART driver does not have the 'direction' field: it looks like (unlike LPI2C and LPSPI) we can initiate 'read' and 'write' transfers independently using LPUART_TransferReceiveNonBlocking and LPUART_TransferSendNonBlocking (i.e. it looks like one can be initiated without waiting for the completion of the other). Does both transfers have independent state machines ? Can we use both transfers at the same time not worrying about transfer corruption (like missing characters etc.) ?

We have a device that sends and receives data asynchronously and we have to keep 'receive' transfer active all the time (we don't know when the incoming data may be sent) waiting for possible incoming transfer. And once in a while we must also send data...

Thanks for help

Maciek

0 Kudos
1 Solution
1,575 Views
EdwinHz
NXP TechSupport
NXP TechSupport

That is correct. The UART_TransferHandleIRQ interrupt handler drives both transmit and receive IRQ request. But this process will not precisely be at the same time. By the way the handler is structured, it will process receptions before transmissions. Yet, both Rx and the Tx requests can and will be processed during the same handler call if both IRQ requests are triggered simultaneously. So, there won’t be any problems transmitting and receiving simultaneously.

BR,

Edwin.

View solution in original post

0 Kudos
5 Replies
1,615 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @Maciek!

Yes, UART is full-duplex by standard and our LPUART module is no exception to that. In section 49.2.1 of the i.MX RT1064 Processor Reference Manual, you can see both the transmitter and receiver structures are completely independent from one another, each with their own control blocks. This allows the LPUART module to do both transmission and reception at the same time.

 

BR,

Edwin.

0 Kudos
1,592 Views
Maciek
Contributor V

Hi @EdwinHz

I want to make sure that I understand your answer. As I see from the LPUART driver source code: both transfers 'send' and 'receive' are serviced by the same Interrupt Handler 'UART_TransferHandleIRQ' (this Interrupt Handler implements state machines that guide both transfers). From your answer I understand that this handler is structured in a way that allows to serve both transfers independently and at the same time (i.e. I can initiate both transfers one after the other immediately and UART_TransferHandleIRQ will handle them correctly)? Can you confirm this ?

Thanks
Maciek

0 Kudos
1,576 Views
EdwinHz
NXP TechSupport
NXP TechSupport

That is correct. The UART_TransferHandleIRQ interrupt handler drives both transmit and receive IRQ request. But this process will not precisely be at the same time. By the way the handler is structured, it will process receptions before transmissions. Yet, both Rx and the Tx requests can and will be processed during the same handler call if both IRQ requests are triggered simultaneously. So, there won’t be any problems transmitting and receiving simultaneously.

BR,

Edwin.

0 Kudos
1,627 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @Maciek!

Could you please confirm the MCU part number, SDK version, and MCUXpresso release that you are currently using?

This information will allow me to provide a better answer.

Thanks.

0 Kudos
1,623 Views
Maciek
Contributor V

Hi @EdwinHz

we are working with i.MX RT1064, SDK 2.9.1 and Config Tools v9. We are using MBD Toolbox (not MCUXpresso) where code is generated partially by Config Tools and partially by Embedded Coder (and SDK 2.9.1 is used). This question was asked on the MBD Toolbox forum but we (both I and MBD support team) are not sure what the answer is.

Thanks

Maciek

0 Kudos