UART APIs for non-consistent message sizes

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

UART APIs for non-consistent message sizes

757 Views
mrecoskie
Contributor III

Hi,

I’m working with the RT1052/RT1064 and MCUXpresso v11.5.   My goal is to create a USB (device side) to UART bridge.  I could not find any close examples to this beyond the Host CDC.  So I started to create this from scratch.

I need to use UART byte by byte receiving because of dynamic incoming message sizes.  Can you confirm it is not possible to use the RX interrupt (and ReceiveByte) and the TransferSendNonBlocking together?  Each mechanism works separately for me but not together.  Looking inside the code it seems as through the LPUART_TransferCreateHandle function deals with the RX interrupt which probably prevents my custom RX IRQ handler with LPUART_ReadByte from working.  If that is the case, is it better to implement both send and receive via interrupt handling or is there another suggestion?  Thanks.

Mark

 

For TX:

LPUART_Init

LPUART_CreateHandle

LPUART_TransferSendNonBlocking

 

For RX:

LPUART_EnableInterrupts

EnableIRQ

In ISR - LPUART_ReadByte

 

 

0 Kudos
Reply
1 Reply

748 Views
mrecoskie
Contributor III

I ended up using LPUART_ReadByte / LPUART_WriteByte and a separate ring buffer for each direction.  This works.  

Next is to added USB connection.  Thanks.

0 Kudos
Reply