UART+EDMA

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

UART+EDMA

2,497件の閲覧回数
tailiang_dong
Contributor I

hi all,

I have a problem,i am using RT1061 EVK, using UART idle interrupt + EDMA mode to achieve UART variable length reception. After init IO\UART\EDMA,i open the idle interrupt function and interrupt function, Do in the interrupt function: get data, clear idle interrupt flag, open interrupt.

tailiang_dong_0-1631070093491.png

 

I use URAT3 to receive, and then use UART1 to send, there is no problem.But when I use UART3 to receive and then use UART3 to send, there will be a phenomenon that I can only succeed once. After debug, I found that after usingLPUART_SendEDMA, the program will enter the interrupt function, and then I added a statement to clear the sending flag in the interrupt function. it does not work.

tailiang_dong_1-1631070196477.png

 

I would like to ask, will the interrupt function be entered when the send function is used? If so, how to clear this flag to achieve unlimited sending times。

ラベル(1)
0 件の賞賛
返信
6 返答(返信)

2,469件の閲覧回数
tailiang_dong
Contributor I

It is also not OK to clear the TransmissionCompleteInterrupt flag in LPUART3_IRQHandler, how can I restore the TransmissionCompleteInterrupt flag ? Can someone help me?

0 件の賞賛
返信

2,485件の閲覧回数
tailiang_dong
Contributor I

Thank you for your reply, the project has been uploaded。

0 件の賞賛
返信

2,464件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi,
In my opinion, the code is bad.
According to your statement, you want to use the interrupt way to receive the data and transmit the data via the DMA module, however, you use the LPUART_ReceiveEDMA function in LPUART3_IRQHandler, it's obviously not a good idea.
Next, you call LPUART_SendEDMA to transmit data, however, I don't find any functions to indicate the DMA transmit completes, so I think you shouldn't remove the LPUART_TransferCreateHandleEDMA function.
Finally, I'd like to suggest you optimize the code by referring to lpuart_edma_transfer code demo.
Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

2,448件の閲覧回数
tailiang_dong
Contributor I

hi jeremyzhou

官方的eDMA+uart不能实现不定长的接收,我测试了大概是最多44个自己,多了就会出错。所以我才用的空闲中断的方式。

在LPUART3_IRQHandler中使用LPUART_ReceiveEDMA f函数是因为处理上次接收数据之前关闭了接收传输,处理了数据(用同个串口回传数据)后再次打开,这样做会带来什么问题吗?

LPUART_TransferCreateHandleEDMA我并没有删除,是在peripherals中LPUART3_init设置了的。

我使用这个空闲中断的方式,导致LPUART_EnableInterrupts和EnableIRQ后,发送完成也会进入LPUART3_IRQHandler,但规格书上说的1,重新发送数据,2,关闭TE发送功能,3,进入中段读取STAT貌似都不能让TC清除,导致一直在LPUART3_IRQHandler里面循环。

0 件の賞賛
返信

2,487件の閲覧回数
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I think I need more information prior to jumping to a conclusion, so I was wondering if you can upload your demo project.
Have a great day,
TIC

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 件の賞賛
返信

2,477件の閲覧回数
tailiang_dong
Contributor I

Hi jeremy,

Did you find any reason why the xDataRegEmptyInterrupt flag could not be cleared?

0 件の賞賛
返信