Post Go back to editing

AD9361 No-OS Rx DMA Cyclic Mode

I am working on AD9361 with No-OS driver.

Sample code of the No-OS driver provides cyclic dma at the Tx side.

It is working very well.

Now, I want to use cyclic dma at the Rx side to receive data into ring buffer continuously, so that there is no data loss.

I set 'AXI_DMAC_REG_FLAGS' to one. However, it doesn't seem to work.

How can I use cyclic dma at the Rx side.

 

 

int32_t adc_capture(uint32_t size, uint32_t start_address)

{

---

 

 adc_dma_write(AXI_DMAC_REG_CTRL, 0x0);
 adc_dma_write(AXI_DMAC_REG_CTRL, AXI_DMAC_CTRL_ENABLE);

 adc_dma_write(AXI_DMAC_REG_IRQ_MASK, 0x0);

 // Cyclic Mode 0:OFF, 1:ON
 adc_dma_write(AXI_DMAC_REG_FLAGS, 0x1);

 adc_dma_read(AXI_DMAC_REG_TRANSFER_ID, &transfer_id);

 adc_dma_write(AXI_DMAC_REG_DEST_ADDRESS, start_addr);
 adc_dma_write(AXI_DMAC_REG_DEST_STRIDE, 0x0);
 adc_dma_write(AXI_DMAC_REG_X_LENGTH, length - 1);
 adc_dma_write(AXI_DMAC_REG_Y_LENGTH, 0x0);

 // Transfer Start
 adc_dma_write(AXI_DMAC_REG_START_TRANSFER, 0x1);

 /* Wait until the new transfer is queued. */
 do {
  adc_dma_read(AXI_DMAC_REG_START_TRANSFER, &reg_val);
 }
 while(reg_val == 1);

---

return 0;

}

Parents
  • Hi,

    The capture DMA does not support cyclic mode. If you put the capture DMA in cyclic mode that just means that your previously captured data would be overwritten with the new data before you are able to process it.

    The recommended solution for continuous capture is to use a double buffer scheme. Have two or more buffer, with this approach one buffer can be filled by the DMA while the other buffer can be processed by your software.

    The DMA contains an internal queue, this means it is possible to submit multiple transfers in advance. So you submit 2 transfers, wait for the first one to finish and then process it. Meanwhile the DMA will fill up the second buffer. Once you are done processing the first buffer you queue it back to the DMA and wait for the second buffer to finish. Then you can process the second buffer, give it back and start waiting for the first one again. And so on...

    - Lars

Reply
  • Hi,

    The capture DMA does not support cyclic mode. If you put the capture DMA in cyclic mode that just means that your previously captured data would be overwritten with the new data before you are able to process it.

    The recommended solution for continuous capture is to use a double buffer scheme. Have two or more buffer, with this approach one buffer can be filled by the DMA while the other buffer can be processed by your software.

    The DMA contains an internal queue, this means it is possible to submit multiple transfers in advance. So you submit 2 transfers, wait for the first one to finish and then process it. Meanwhile the DMA will fill up the second buffer. Once you are done processing the first buffer you queue it back to the DMA and wait for the second buffer to finish. Then you can process the second buffer, give it back and start waiting for the first one again. And so on...

    - Lars

Children