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.

TMS570: ADC + DMA

Hello,

I'm using a TMS570LS20216SPGE on the TMDX570LS20SUSB development stick.  I am attempting to configure an A/DC and a DMA channel to work together to store a continuous A/D sample stream into a RAM circular buffer without core intervention.

I have set up one A/DC group to run in continuous mode to capture data from 1 A/D channel.  I have allocated all 64 FIFO words to this group, and have configured the group for multi-word DMA transfer mode (i.e., EV_BLK_XFER=1 with EVBLOCKS=16).

I have configured DMA channel 0 (I am only using 1 DMA channel at this point) to service HW requests from the A/D.  I have set the control packet for this channel to the following:

  CHCTRL.TTYPE=0 (frame trigger)

  CHCTRL.AIM=1 (auto-initiation enabled)

  ITCOUNT.IETCOUNT=16 (frame is 16 words, same as A/DC0 EVBLOCKS)

  ITCOUNT.IFTCOUNT=64 (64 frames per block)

  ISADDR=ADC FIFO

  IDADDR=base of RAM circular buffer

 

As I understand it, these configurations should cause the ADC to request a DMA transfer each time 16 conversion results have been completely written to the FIFO.  On each DMA request from the A/D, the DMA engine should transfer 1 frame (16 words) from the A/DC FIFO into RAM.  After 64 frames have been completed (i.e., a DMA block), the active destination address of the DMA channel should be reset to the initial control packet value (IDADDR) thus implementing a (16*64=) 1024-sample circular buffer.

This scheme seems to work fine for several iterations (around 24 DMA blocks), however I soon observe words in the RAM buffer of the form 0x80000xxx (i.e., and A/DC sample with EV_EMPTY=1) which indicate that the DMA is reading an empty FIFO.

Can anyone spot an error with my configuration that would cause the DMA engine to attempt to read from an empty FIFO?  Any help is much appreciated.

Thanks,

Jason

  • Jason,

    this is being looked into and we plan to have a response shortly.

    Regards,

    Abhishek

  • Jason,

    Thank you for your patience and excuse us for the delay in the response.

    The ADC's block DMA request generation mechanism is the same as the threshold interrupt generation mechanism.

    • This comprises of a down-counter that counts down from the threshold you specify (15) for each new conversion result.
    • The counter increments for each read from the FIFO interface
    • A DMA request (or a threshold interrupt) is generated whenever the counter transitions from +1 to 0

    This counter can also go negative in case the ADC generates more conversion results that the CPU or DMA does not read out in time.

    As you can see, there are several timing dependencies in this scheme. Consider the below scenario:

    • ADC has completed 16 conversions
      • A DMA request is generated which is expected to read out 16 conversion results
      • The ADC is configured to be in continuous conversion mode, so the conversions continue to happen
    • Suppose that the ADC converted one more channel before the DMA got to reading the first conversion result from the FIFO
      • The threshold counter will decrement to -1
    • Now the DMA request starts to read the conversion results one by one
      • The threshold counter increments for each read by the DMA
    • Suppose the ADC writes another conversion result when the threshold counter is 1 (as a result of two conversion results read out by the DMA)
    • This will trigger another DMA request although there have not been 16 conversions since the last time that the DMA request was generated.

    Regards,

    Sunil