This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

关于Uart EDMA中断的问题

大家好!

我使用的是C6678,目前在做Uart EDMA的中断,即fifo模式下的uart接收到数据,由EDMA搬运,搬完后产生中断。我已经基本实现了这个功能,但是在调试过程中有几个问题:

1. 我使用串口调试工具,发送字符,不论一次发送几个字符,都会发生一次edma搬运,产生一次中断,我的Uart的triggerLevel设置为8或14 bytes,似乎都不生效。我在手册中看FCR中的triggerlevel字段是一个只读字段,所以我想问,这个triggerlevel正确的配置方式是什么?

2. 我设置了一个uart_buffer[2][8]这样的ping pong buffer,在完成一次搬运之后,如果搬运的数据小于8字节的话,比如只发送了4个字符,那么uart_buffer[0][0-3]有数据,但buffer中的其他内容会被写入一个看起来像是随机值。不知道是什么原因?

3. uart的fifo模式下,fifo是16字节大小的,而uart的triggerlevel是1,2,4,8或14,这个triggerlevel和fifo大小的关系是什么? 配置EDMA时,EDMA的dst buffer大小设置是要个triggerlevel大小保持一致吗还是怎样? 配置EDMA OPT的时候,在CONST模式下,有一个参数是FIFOWIDTH,那这个参数该依据什么来设置呢?是依据uart的triggerlevel还是什么?

谢谢~

  • 1. 在设置FCR寄存器时,需要注意下面两个field的配置。
    The FIFOEN bit must be set to 1 before other FCR bits are written to or the FCR bits are not programmed.

    CAUTION—For proper communication between the UART and the EDMA controller, the DMAMODE1 bit must be set to 1. Always write a 1 to the
    DMAMODE1 bit, and after a hardware reset, change the DMAMODE1 bit from 0 to 1.

    2. 我的理解是虽然只发送了4个字节,但edma还是根据PaRAM里的参数去搬移了8个字节的数据。

    3. trigger level不能大于fifo大小,每次到trigger level了中断EDMA来读取数据,buffer大小应该保持一致。FWID参数和fifo trigger level要一致,但uart不支持constant addressing mode。
    processors.wiki.ti.com/.../II_devices

    另外,可以参考下面的UART例程
    e2echina.ti.com/.../18931