cancel
Showing results for 
Search instead for 
Did you mean: 

How to receive a lot of characters from USART???

l90mehdi
Associate II
Posted on May 22, 2017 at 14:13

HI 

I want Receive characters from USART. I don't  know how much characters will be sent

and the data that will be sent is too much. in interrupt mode i will receive amount interrupts and it is not good(for example 1000 ~2000) and in DMA mode i can not know than when the last character has been sent

and i polling mode in should check my buffer always.

so 

what should i do ???

thank you

#data-transfer #usart #usart-dma #large-data
4 REPLIES 4
Posted on May 22, 2017 at 20:41

Idle interrupt!

It take care to gives you a signal when Rx line stops. Example: receiving 'hello', you will receive only one interrupt 10 bits after 'o'. So, the amount of 'time lost' depends on your baudrate.

If amount of bytes are 'too much', use idle interrupt + DMA half/full interrupt. Half is better (a kind of double buffering).

If you loose characters also this way... well... enable flow control

Posted on May 22, 2017 at 22:00

On what part, exactly?

There are ways to use HT and TC interrupts, or simply using the 16-bit wide feature of the USART->DR to flag and harvest data from the buffer. ie use the DMA to act as the inbound FIFO, and then have your worker thread/task pull all of the current data out, and marking the now vacant entries with 0xFFFF

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 24, 2017 at 18:50

THNAK YOU 

  this way is very good 

Posted on May 24, 2017 at 19:31

Hi

khastar.mehdi

khastar.mehdi wrote:

THNAK YOU

this way is very good

https://community.st.com/0D50X00009bMM5DSAW

-Nesrine-