when use uart with DMA, why its DMA callback function invoked so slowly?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

when use uart with DMA, why its DMA callback function invoked so slowly?

4,125件の閲覧回数
aarongao
Contributor I

The follow issue i have deal with it for a long time, but i cannot complete it.

Description: On imx6sx i send the packet which is about 6 bytes and then, after sending over, I  send next packet about 2ms later. The amazing things happened, the tx interrupt is triggered, but the dma callback is invoked 4ms later, that is to say, the date will be sent out almostly 4ms after tx interrupt.

and the following packets are the same as above, if i increase the send interval, it will be ok. and tx interrupt is triggered, the tx callback will be invoked immediately.

I am looking forward to your reply, thank you very much at first.

tx_callback prompt.png

ラベル(1)
タグ(3)
0 件の賞賛
返信
7 返答(返信)

3,338件の閲覧回数
Yuri
NXP Employee
NXP Employee

Hello,

  Perhaps the problem concerns with the fact, that DMA transfer data in bursts, DMA cannot transfer less data, than burst length.


Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

3,338件の閲覧回数
aarongao
Contributor I

Its so good to receive your answer. I agree with you that the DMA burst size is the reason possibly, and, i try to modify the burst size before,and it doesn't work. I will check the actual parameter of the burst size and capture the wave on the line.

Thanks a lot.

0 件の賞賛
返信

3,338件の閲覧回数
Yuri
NXP Employee
NXP Employee

Hi,

The burst size of half of UART FIFO is good choice.

Regards,

Yuri.

0 件の賞賛
返信

3,338件の閲覧回数
aarongao
Contributor I

OK, now our DMA configuration  is the same as the link below:

http://lxr.free-electrons.com/source/drivers/tty/serial/imx.c

open it, you can search the keyword 'burst'.

and  you said the burst size is the half of Uart FIFO. you mean tx dst_maxburst or rx src_maxburst?

or I need set the rx src_maxburst is the half of Uart FIFO, and set the tx dst_maxburst is the same as the Uart FIFO?

thanks for your reply.

0 件の賞賛
返信

3,338件の閲覧回数
Yuri
NXP Employee
NXP Employee

Hi,

I mean both tx dst_maxburst and rx src_maxburst.

Regrads,

Yuri.

0 件の賞賛
返信

3,338件の閲覧回数
aarongao
Contributor I

Sorry for reply so late, recently i focus on the other task.

I look up the Uart chapter of imx6sx, and find the Rx/Tx FIFO is 32Bytes. As you advice, the half-of FIFO is 16Bytes.

and ss you said before"Perhaps the problem concerns with the fact, that DMA transfer data in bursts, DMA cannot transfer less data, than burst length."

So DMA transfers the data should less than 16Bytes, and now I send/receive the data usually less than 16Bytes, do you mean i should not use the DMA, maybe interrupt mode without DMA will be better?

0 件の賞賛
返信

3,338件の閲覧回数
Yuri
NXP Employee
NXP Employee

Hi,

yes, often UART is needed to be used in so called debug / interractive mode, without DMA.

Regards,

Yuri.

0 件の賞賛
返信