使用TI的starterware,uart_edma3例程,在此基础上修改,现在有需求,需要UART发送与接收同时进行,但参考TI的手册,starterware uart 其中的描述如下:
接收与发送共用一个中断,怎么能够实现同时稳定的收发呢?恳求指导。我用的串口是232,本身是支持全双工的。
DMA Mode
• In DMA mode of operation, the data transfer happens via EDMA. UART conditions are still handled by the
interrupts or polling.
• EDMA needs to be first brought out of local reset by enabling the module in the Power Sleep Controller by using
PSCModuleControl() for EDMA3 Channel controller and for EDMA3 Transfer controller.
• EDMA is initialized using EDMA3Init(), the DMA channels are mapped and enabled using
EDMA3RequestChannel()
• EDMA PaRAM set (options) for UART transmit and receive are set using EDMA3SetPaRAM()
• EDMA transfer is enabled using EDMA3EnableTransfer().
• UART DMA event generation for UART transmit and receive is enabled using UARTDMAEnable().
• A transmit register empty/recieve byte condition generates a Tx/Rx EDMA event.
• The EDMA completion interrupt occurs after number of bytes configured in the PaRAM set are exhausted.
• The generation of UART EDMA events is disabled using UARTDMADisable()
• Two interrupt handlers are registered for EDMA
• The completion interrupt handler EDMA3ComplHandlerIsr() to take action on the completion of
transfer. Action usually is to disable the channel on completion of transfer.
• The error interrupt handler EDMA3CCErrHandler() to take action on the error conditions. Action usually
is to disable the channel, clear error bits and terminating the transfer
• EDMA3FreeChannel() will free the channels assigned to EDMA which will internally call
EDMA3DisableTransfer() to disable the transfer over UART EDMA channel.
Tony Tang:
这与能不能同时收发没有冲突,就算是两个分开的中断,对于CPU来说,还是一个时间内只能响应一个中断,退出后才能响应别一个中断,与在一个中断内判断是收还是发没有本质区别。
所以只要系统负载不重,能够及时响应收发的数据,就可以达到全双工收发要求。