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.

CCS/TMS570LC4357: Configure the DMA without interrupt mode

Part Number: TMS570LC4357


Tool/software: Code Composer Studio

Hi Team,

In our Application for TMS570LC4357, There are good number of interfaces which are using the DMA engine. Currently, for SCI, the implementation we have done in such a way that it will transfer the next frame upon interrupts(HBC/BTC).

for e.g. if i periodically wants to configure the packet for DMA channel for SCI (different source/destination address) and every time if i want to send the data(variable in size) then upon interrupt it will transmit the next frame.

But, if we do not want to depend on the interrupts, then is there any way to execute this functionality just by polling any bit OR any other way out possible for this?

One way, we can achieve this by, in the next iteration disable the DMA globally then after the packet configuration again re-enable it. But, as there could be other operations going parallel related to DMA, this globally enabling/disabling might affects the other.

Thus, Need recommendations on this, It will really be helpful.

Regards,

Shivam Kakad

  • Hi Shivam,

    Any reason makes you use polling mode instead of interrupt mode? Interrupt mode is a better way for your use case.

  • Yes Wang. Actually, In our system there are lot of other interrupts that we are enabling and monitoring.

    But, here for the SCI-DMA operations, as we are not sure everytime, that how much data sent we will be sending.

    for e.g. lets say, Initially for 50 times it just wants to send only 1 byte of data periodically, so every time generating the interrupt, just for these small chunks of data is not required in our application, it will just create unnecessary overhead to the system by means of time and other critical parameters.

    Hence we wanted to get rid of the interrupt mode and use just polling.

    Regards,

    Shivam

  • Hi Team,

    Do we have any updates on this?

    Quick support/suggestions will be appreciated.

    Regards,

    Shivam

  • Hello,

    The SCI transmit DMA request is enabled by setting SET TX DMA. If the SET TX DMA bit is set, then a TX DMA request is sent to the DMA when data is written to SCITD and TXRDY is set.

    You can enable the SCI TX DMA in your timer notification, and write data to SCITX through DMA, then disable SCI TX DMA. You don't have to disable the DMA module.  

  • Hi Wang,

    We tried this option, to get rid from enabling/disabling the DMA globally for the packet reconfiguration with variable size as mentioned previously, but it did not work. It transmits only once but for further transmissions didn't happen.

    We are configuring the packet for SCI Transmission with the DMA-BTC interrupt as follows:

    // DMA configuration -- start
    dma_ctrl_pkt.SADD = (Uint32)src_buffer;
    dma_ctrl_pkt.DADD = ((Uint32)(&(the_sci->TD)) + 3UL);
    dma_ctrl_pkt.CHCTRL = 0;
    dma_ctrl_pkt.FRCNT = buffer_size;
    dma_ctrl_pkt.ELCNT = 1;
    dma_ctrl_pkt.ELDOFFSET = 0;
    dma_ctrl_pkt.ELSOFFSET = 0;
    dma_ctrl_pkt.FRDOFFSET = 0;
    dma_ctrl_pkt.FRSOFFSET = 0;
    dma_ctrl_pkt.PORTASGN = PORTA_READ_PORTB_WRITE;
    dma_ctrl_pkt.RDSIZE = ACCESS_8_BIT;
    dma_ctrl_pkt.WRSIZE = ACCESS_8_BIT;
    dma_ctrl_pkt.TTYPE = FRAME_TRANSFER;
    dma_ctrl_pkt.ADDMODERD = ADDR_INC1;
    dma_ctrl_pkt.ADDMODEWR = ADDR_FIXED;
    dma_ctrl_pkt.AUTOINIT = AUTOINIT_OFF;

    dmaSetCtrlPacket(tx_ch, dma_ctrl_pkt);
    dmaReqAssign(tx_ch, tx_req);
    dmaEnableInterrupt(tx_ch, BTC, DMA_INTA);
    // DMA configuration -- end

    and once interrupt comes, in ISR We are clearing the corresponding flags as follows:

    dma_ch = dma_get_channel_interrupt_source(DMABTCA_INTERRUPT);
    dma_clear_channel_interrupt_source(dma_ch, DMABTCA_INTERRUPT);


    // now in the ISR, call the DMA configuration with different buffer_size than which was used earlier.

    Secondly, we are using the Hardware Triggering for the transmission. Will it affect?

    Please help us, resolving this issue.

    Regards,

    Shivam Kakad

  • If you really want to use the polling mode to write data to peripheral register and read data from the peripheral register, I prefer not to use the DMA. The DMA Request of the peripheral is used to trigger the DMA transfer.

  • Hi Wang,

    In this DMA packet configuration for SCI as mentioned previously, if we make the auto-init mode on, then i can see the data will be transmitted without enabling and disabling the DMA globally. but i have seen that until it clears the SCI TX DMA request then it continuously transmits the packet. 

    As per the technical reference manual of TMS570LC4357, 20.2.8 Auto-Initiation, i can see, 

    In the case of Hardware Request the channel needs to be retriggered each time after a
    block is complete even if auto-initiation is enabled.

    Thus, wanted to understand more on the observations that i can see, though we are configuring the triggering as hardware.

    PS: i tried with the SW triggering with this auto init mode, but i cannot see any transmission happens at all in the second time without having the enabling/disabling globally.

    Requires help in resolving this issue, so that i need not to reconfigure(enable and disable) the DMA globally for the continuous transmission with variable size for packet transmission over UART DMA.

    Regards,

    Shivam Kakad

  • Both SW request and HW request can trigger either a block or a frame transfer depending on the setting of the TTYPE bit in the Channel Control Register. If DMA is not enabled, no DMA transfer happens even there is HW request or SW request.

    For your use case, HW request should be used. If you use SW trigger, and if the buffer is >1, so the DMA may transfer 2nd byte of data to SCI->TD register before the previous byte has been send out. If HW request is used, the HW request is generated only when the data is copied from SCI->TD to shift register, and previous data will not be overwritten.

    After the block transfer is completed, you can disable the SCI DMA (clear TX DMA bit) in BTC ISR, then enable it whenever you want to transfer next block of data.

    Please read the DMA and SCI chapters in TRM. Thanks