Skip to main content

SPi triggered DMA

DA14580

2 years ago

Posted by kidmose 0 points 1 reply
0 upvotes

Hi,

I have an isuse with getting the DMA to be triggered by and external ADC. 

Configuration:

-------------------------

Da14585

External ADC, SPI BUS

DMA: 2 channels, one for spi tx one for spi rx

 

Requested functionality

-----------------------

Every time a sample is ready, the ADC sets SPI_OUTPUT Low, then 32bit data has to be transferred. For that I have configured the DMA to be triggered by peripheral device.

 

Problem

--------------------------

DMA starts triggered, but after receiving first sample it does not await the SPI_OUTPUT going low, before requesting data again. Hence same sample is sent again from ADC.  If I program it to 1024 samples, it reads out the data as fast as it can wo waiting for next data. So the DMA start is triggered correctly, but I was expecting it to sync with SPI_OUPUT.

 

Further info:

The ADC is in continuous mode sampling at 1024 samples/second. Hence when I want 1024 samples I expected that to take a second. However It goes much faster and issue is that dma just reads the same sample over and over again at full speed.

The current config is below, but I have also tried to have tx lengt = 1 and circular enabled.

 

DMA CONFIG

-------------------------

DMA_setup ti_ads1018_spidma_cnf[TI_ADS1018_DMA_TX+1] =
{
  {//RX
    .channel_number  = DMA_CHANNEL_0,
    .bus_width       = DMA_BW_HALFWORD,
    .irq_enable      = DMA_IRQ_STATE_ENABLED,
    .irq_nr_of_trans = 0,
    .dreq_mode       = DMA_DREQ_TRIGGERED,
    .a_inc           = DMA_AINC_FALSE,
    .b_inc           = DMA_BINC_TRUE,
    .circular        = DMA_MODE_NORMAL,
    .dma_prio        = DMA_PRIO_7,
    .dma_idle        = DMA_IDLE_BLOCKING_MODE,
    .dma_init        = DMA_INIT_AX_BX_AY_BY,
    .dma_req_mux     = DMA_TRIG_SPI_RXTX,
    .dma_sense       = DMA_SENSE_LEVEL_SENSITIVE,
    .src_address     = SPI_RX_TX_REG0,
    .dest_address    = spi_data,
    .length          = 1024,
    .callback        = NULL,
    .user_data       = NULL,
  },
  {//TX
    .channel_number  = DMA_CHANNEL_1,
    .bus_width       = DMA_BW_HALFWORD,
    .irq_enable      = DMA_IRQ_STATE_DISABLED,
    .irq_nr_of_trans = 0,
    .dreq_mode       = DMA_DREQ_TRIGGERED,
    .a_inc           = DMA_AINC_FALSE,
    .b_inc           = DMA_BINC_FALSE,
    .circular        = DMA_MODE_NORMAL,
    .dma_prio        = DMA_PRIO_7,
    .dma_idle        = DMA_IDLE_BLOCKING_MODE,
    .dma_init        = DMA_INIT_AX_BX_AY_BY,
    .dma_req_mux     = DMA_TRIG_SPI_RXTX,
    .dma_sense       = DMA_SENSE_LEVEL_SENSITIVE,
    .src_address     = NULL,
    .dest_address    = SPI_RX_TX_REG0,
    .length          = 1024,
    .callback        = NULL,
    .user_data       = NULL,
  }
};

 

Attachment Size
adc.pdf 42.08 KB

2 years ago

PM_Dialog

Hi kidmose,

We will get contact with you in your registered email address shortly.

Thanks, PM_Dialog