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.

multiple simultaneous uart with dma

Other Parts Discussed in Thread: AM3358

hi TI

    I use tow simultaneous uarts(exactly:uart0 and uart2) with dma to do the 'keyboard echo' in a while-loop, the Pseudocode is below:
 
 
 //uart_a dma
#define UART_DMA_Tx_CHANNEL_NUM (26)

#define UART_DMA_Tx_L_CHANNEL_NUM (23)

#define UART_DMA_Rx_CHANNEL_NUM (27)

#define UART_DMA_Rx_L_CHANNEL_NUM (24)

//uart_b dma
#define UARTB_DMA_Tx_CHANNEL_NUM (30)

#define UARTB_DMA_Tx_L_CHANNEL_NUM (39)

#define UARTB_DMA_Rx_CHANNEL_NUM (31)

#define UARTB_DMA_Rx_L_CHANNEL_NUM (37)


unsigned char* rxbuffer  = 0x88000000;

unsigned char* rxbufferB = 0x88001000;

while(1)
{
 {

   

  //---------------------rx characters from keyboard---------------------


  //------------------------------------------
  //UARTA
  Uart_EDMARx(rxbuffer,
   RXBUF_LEN,
   UART_DMA_Rx_CHANNEL_NUM,
   UART_DMA_Rx_L_CHANNEL_NUM);


  //------------------------------------------
  //UARTB
  UartB_EDMARx(rxbufferB,
   RXBUF_LEN,
   UARTB_DMA_Rx_CHANNEL_NUM,
   UARTB_DMA_Rx_L_CHANNEL_NUM);

   
   
        Uart_Dma_Wait(UART_DMA_Rx_CHANNEL_NUM);
  EDMA3ClrIntr(SOC_EDMA30CC_0_REGS, UART_DMA_Rx_CHANNEL_NUM);

  UartB_Dma_Wait(UARTB_DMA_Rx_CHANNEL_NUM);
  EDMA3ClrIntr(SOC_EDMA30CC_0_REGS, UARTB_DMA_Rx_CHANNEL_NUM);


  //---------------------echo the rx characters---------------------

  //------------------------------------------
  //UARTB
  UartB_EDMATx(rxbufferB,
   RXBUF_LEN,
   UARTB_DMA_Tx_CHANNEL_NUM,
   UARTB_DMA_Tx_L_CHANNEL_NUM);

  //------------------------------------------
  //UARTA
  Uart_EDMATx(rxbuffer,
   RXBUF_LEN,
   UART_DMA_Tx_CHANNEL_NUM,
   UART_DMA_Tx_L_CHANNEL_NUM);


     
  //------------------------------------------
  //UARTB
  UartB_Dma_Wait(UARTB_DMA_Tx_CHANNEL_NUM);
  EDMA3ClrIntr(SOC_EDMA30CC_0_REGS, UARTB_DMA_Tx_CHANNEL_NUM);

  //------------------------------------------
  //UARTA
  Uart_Dma_Wait(UART_DMA_Tx_CHANNEL_NUM);
  EDMA3ClrIntr(SOC_EDMA30CC_0_REGS, UART_DMA_Tx_CHANNEL_NUM);

 }

}

the function Uart_EDMARx/Uart_EDMATx  UartB_EDMARx/UartB_EDMATx trigger the dma to receive/transmit the character from/to uart0 and uart2 by edma uart0/2 event;

the function Uart_Dma_Wait/UartB_Dma_Wait will check the EDMA_IPR REG for dma complete(dma interrupt closed).

when run this code,the loop works once,the second time the dma for uart2 will receive the character but can not transmit the character(the IPR-bit for UARTB_DMA_Tx_CHANNEL_NUM always 0).

when I do the 'keyboard echo',only uart0 or uart2 the loop works well;
when I do the 'keyboard echo',uart0 receive and then uart2 echo the loop works well;
when I do the 'keyboard echo',uart0 and uart2 trigger and wait sequentially the loop works well;
However when trigger the uart0 uart2 and dma simultaneous the uart2 tx-dma cannot be completed.
can anybody give some suggestion.

  • moreover, I did the 'keyboard echo' with uart-fifo disable;
    If the uart-fifo on the echo can not even be completed separately by uart0 or uart2.
  • at the second 'keyboard echo',the uart2 dma don't be trigger by the event,the paramset is not exhausted,still the initial value.

    is there any reason can lead to this(I check the CM_PER_UART2_CLKCTRL:0x02 and UART2_SYSC:0x08 seems the uart2 is not in idle).

    by the way my dma OPT field PRIV is set 1(supervisor level) by the arm.

  • it seems there is no event signal from uart to dma ER especially the tx event.

    I check the LSR 'UART_LSR_TX_SR_E' and 'UART_LSR_TX_FIFO_E' are all empty,and then do the 'UARTDMAEnable(SOC_UART_X_REGS, UART_DMA_MODE_1_ENABLE)' .If add some uart0 printf info(no dma mode) ,the event can not post to the EDMA3 ER;If do not add the uart0 printf info,the event can post to the EDMA3 ER   

    some REGs are not set appropriately or the silicon bug?

  • Yihao,
    Could you please post details on which EVM and the full code of the example to try and reproduce? Thanks.

    Regards,
    Lali
  • hi lali

         the hardware platform is my customized not TI's evm.

    I attach my example project called 'mecury' for you.The attachment project can reproduce the same problem as my project which runs on my board.

    In this project you need config edma module and uart0 module:

    edma3 module calls function:EDMAModuleClkConfig() and EDMA3Init();

    uart0 module calls function:UARTStdioInit() and UARTIdleModeConfigure(SOC_UART_0_REGS, UART_IDLEMODE_NO_IDLE);

    I will do the config of  uart2 and uart3; and you can set the uart2 and uart3's baud-rate(default is 115200);

    In my project the mmu is open and ddr-sdram region is cached,but the REG region is non-cached;

    you can define or undefine the macro to open the uart0/uart2/uart3 and test 'tx dma' or 'rx-tx dma' 'simultaneous-dma' or 'sequence-dma'

    modified the macro 'RXBUF_LEN' to test the different number of characters 'keyboard echo'.

    thanks for your help.

    1524.mercury.zip

  • Hi Yihao,

    - Can you please confirm which version of StarterWare are you using?

    - Are you receiving data from two separate UART interfaces (UART0 and UART2) and try to simultaneously echo back using DMA?

    - Does the DMA operation of UART0 succeed and only UART2 fails after the execution of the first loop?

    Below has some documentation on UART EDMA.

    http://ap-fpdsp-swapps.dal.design.ti.com/index.php/Issues_in_AM335x_UART_EDMA

    http://ap-fpdsp-swapps.dal.design.ti.com/index.php/Observations_in_AM335x_StarterWare_UART_EDMA

     

    - Sandhya

  • hi Sandhya

    1.the version is "AM335X_StarterWare_02_00_01_01";

    2.yes,my example project is receive the character from uart0 and uart2 separately, and then try to echo the character into the uart0-terminal and uart2-terminal at windows7;

    3.It seems the uart0 also have the same problem as uart2 and uart3(in my design I only use uart0/uart2/uart3).

    4.the reference link can not open,it shows "Unfortunately, the page you've requested no longer exists. Please use the search form above to locate the information you're interested in."

    In my recent test, the edma ER can not capture the uart-event after the first loop,when the THR is empty(So I think the edma module works well,but the uart-event-generate module don't,or there is some timing problem between the edma module and uart module).

    BTW:I think the problem will also be in the Linux-OS-environment. 

    best regards

    yihao.wang

  • Is there any feedback from the factory?

    Did nobody encounter with this problem?
  • Yihao,

    I have been looking into your issue and was unable to get the example working. To better understand, here are some questions:

    - Since you are working with a custom board that has the 2 keyboards connected, do you have a suggestion on how I can reproduce this problem on my end with the AM335x GP EVM?

    - I have been trying to build your project (mercury) without any luck, using the files that you posted. Do you have a CCS project that I can import and build?

    - Were there any modifications to the library files? or are there any special dependencies?

    Also note that a release of ProcessorSDK for AM335x RTOS was released a few days ago which might be of interest to you.

    Apologies for the very tardy response here.

    Lali

  • hi Lali

        Sorry for response so late.

    1.my custom board did not connect 2 keyboards.I only use tow uart on am3358 to receive and send the infos from the two serial-terminal(SecureCRT),If the  AM335x GP EVM has two uart ports pinout, you can reproduce it.

    2.Sorry I do not have the CCS version.The mercury project is independent.The only thing you should do is to install the GCC tool-chain and set the LIB_GCC and LIB_C in the mercury_defs file under the build folder.

    3.I think the problem will be also in the RTOS environment not only in the bare-metal.So I think you can reproduce the problem under the RTOS(Receive and Send the characters through 2 uart module with dma auto-trigger).

    thanks for your help

    yihao