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.

EDMA UART flow control and interruption

We are using a 6670, and have the UART transmissions going at 921600 bps using EDMA transfers.  This is great for speed, however we are running into buffer overrun conditions (on the other side) and want to use xon/xoff flow control.

I've tried setting the DMAMODE1 bit in FCR to 0 when an xoff character comes in, and setting it back to 1 when a xon character comes in, however it seems to loose the remaining DMA data that was in the transfer.  I've also tried clearing/setting the ETBEI bit in the IER register but I get similar results.

Is there a way to interrupt the DMA transfers and continue when ready when attached to a peripheral?  Any help on this would be greatly appreciated.

Thanks,

Erick

  • Erick,

    The C6670 UART supports hardware autoflow control with the RTS/CTS pins. This is a peripheral-level feature that gives you the control that you are asking for. It does require the two additional signals, but your choice may be between that or improving the processing performance on the other end or slowing down the baud rate to what both sides can handle.

    Since there is a FIFO on the transmit side, if that FIFO is being used then any number (up to 16) bytes could be in that FIFO when an XOFF byte comes in, Even if you were to stop the EDMA by clearing the EER/EERH bit, those bytes in the FIFO would still be sent out.

    Maybe someone has some other ideas for you but we can start with these comments and see what you think.

    Regards,
    RandyP

  • Randy,

    Thanks for the reply however using the RTS/CTS pins is not really an option as our board does not have them connected, those pins aren't even routed.

    The FIFO sending out more data is not really a big deal since the XOFF is sent when the buffer is ~90% full and XON when it is ~10% full.

    If I break my transfers into 128 byte blocks, it can handle a software based XON/XOFF setup, but I wanted to avoid breaking up the transfers and setting up the edma that often, since it means interrupting the main loop like every 1.5 ms to resetup the EDMA.

    Is there is a way to 'clear' the EER/EERH bits and 'set' them again and have the transfer continue where it left off?

    Erick

  • Erick,

    Erick Higa said:
    ...I wanted to avoid breaking up the transfers and setting up the edma that often, since it means interrupting the main loop like every 1.5 ms to resetup the EDMA.

    To do a software XON/XOFF, you have to look at the receive data every sample (10us). Are you already looking at every byte as it comes in for other purposes?

    Why are you re-setting up the EDMA after every 128-byte buffer? The EDMA can automatically reload itself (LINK field and LINK PARAM) if you know where you want data to come from, like a ping/pong buffer. You may be talking about something else or another reason for this, so I will wait for some clarification before continuing down that path.

    Erick Higa said:
    Is there is a way to 'clear' the EER/EERH bits and 'set' them again and have the transfer continue where it left off?

    Yes. You can clear the EER bits and you can set the EER bits. There may be restart issues, but maybe not. That will come from your testing the process and studying the User Guide for what it says about initialization or restart.

    Regards,
    RandyP

  • Randy,

    I only use the EDMA for transmitting data, as that is what is set.  I do look at every byte that comes in on the RX side.

    I am setting up the EDMA every 128 bytes as a fix right now to be able to use the XON/XOFF when I receive the characters, ideally I would like to just pause the EDMA on a XOFF and restart it (from where it was left off) on a XON, then I could setup the EDMA to transfer the whole output buffer w/o resetting it up every 128 bytes when done (which is what I am doing right now, so I can do flow control on XON/XOFF characters).

    I'll look more into the users manual for the EER/EERH bit usages on stop/start and try to test that out.

    Thanks for your suggestions,

    Erick

  • Erick,

    Show me the PARAM setup you use for the 128-byte transfers, and also what you would like to setup for a whole transfer. It might help also if you would describe the way you plan to send out data (from several different places, varying lengths, some long / some short, etc.).

    How much of the FIFO are you writing for your DMA events? What threshold are you using to trigger the event?

    Regards,
    RandyP

  • Randy,

    Thanks for the help, I did get everything working right now using the EER bits to stop/start the transfers. Not sure you need it any more, but here is the answer to your question.

    This is the function I use to setup the PARAM:

    void ti_uart_edma_setup_params(uint32 srcBuf, uint count) {
        // Parameter Handle Open
    // Open all the handles and keep them ready
    uartEdmaTxParamHandle = CSL_edma3GetParamHandle(uartEdmaTxHChannel, CSL_TPCC2_UTXEVT, &uartEdmaStat);
        uartEdmaParamSetup.aCntbCnt = CSL_EDMA3_CNT_MAKE(UART_EDMA_ACNT, count);
    uartEdmaParamSetup.srcDstBidx = CSL_EDMA3_BIDX_MAKE(UART_EDMA_ACNT, 0);
    uartEdmaParamSetup.srcDstCidx = CSL_EDMA3_CIDX_MAKE(0, 0);
    uartEdmaParamSetup.cCnt = 1;
    uartEdmaParamSetup.option = CSL_EDMA3_OPT_MAKE(CSL_EDMA3_ITCCH_DIS, CSL_EDMA3_TCCH_DIS,
    CSL_EDMA3_ITCINT_DIS, CSL_EDMA3_TCINT_EN, \
    CSL_TPCC2_UTXEVT, CSL_EDMA3_TCC_NORMAL, \
    CSL_EDMA3_FIFOWIDTH_NONE, CSL_EDMA3_STATIC_DIS, \
    CSL_EDMA3_SYNC_A, CSL_EDMA3_ADDRMODE_INCR, \
    CSL_EDMA3_ADDRMODE_INCR);
        uartEdmaParamSetup.srcAddr = ti_global_address((uint32)srcBuf);
    uartEdmaParamSetup.dstAddr = (uint32)&(UART_REGS->THR);
        uartEdmaParamSetup.linkBcntrld = CSL_EDMA3_LINKBCNTRLD_MAKE(CSL_EDMA3_LINK_NULL, 0);
    CSL_edma3ParamSetup(uartEdmaTxParamHandle, &uartEdmaParamSetup);
    }

    I use that function when transferring 128 bytes, however it is not limited to just the 128 bytes, could be 20 (minimum amount) could be 16k (max).

  • Hi Erick,

    I am doing EDMA3 with UART Rx.  My EDMA3 setting is similar to yours.  But EDMA3 does not move anything.

    My UART0 settings are

    What might be my problems?

    Thank you for your time.

    Regards,

    Steve

  • Steve,

    This is an old thread that has been marked Answered. Please post your question as a new thread and include all the information that we would need to help you. It is very difficult to decode hex register dumps, so please also include the source snippets that are relevant. The hex dumps are useful, we just need more. And we need to know lots of other things about your project, since it is not so similar to Eric's.

    You may want to come back here and post the link to your new thread in case Eric wants to find you there.

    Regards,
    RandyP

  • Steve,

    I agree, w/ Randy as far as not knowing just by register dumps.  Seeing your Uart Init code snippet and/or how you are triggering the transfer would allow us to help you better.

    Erick