LPC845: uart_transfer_dma example : how to read buffer before callback?

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

LPC845: uart_transfer_dma example : how to read buffer before callback?

1,032 Views
v_canoz
Contributor III

Hi,

I'm working on the uart_transfer_dma example for the LPC845 with ping pong buffers which are each 8 bytes sized. This works well when there is a continuous data stream.

I wonder what is the proper way to handle the case when less than 8 bytes are received and we want to process them anyway. This happens when the communication rate is very low.

Let's say I have a software timer that expires each 10ms, and I want to check if a few bytes were received on the UART. How can I check if they are some available without risk of loosing any byte?

Thanks,

Victor

Labels (1)
Tags (2)
0 Kudos
3 Replies

939 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Victor,

You can just transfer 4 bytes to have a try,  check whether can received.

0 Kudos

939 Views
v_canoz
Contributor III

Hello Alice,

The question is, can I flush the DMA transfer before receiving the 8 bytes?

0 Kudos

939 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Update DMA descriptor.

0 Kudos