no-OS
Loading...
Searching...
No Matches
dma_example.c File Reference

DMA example for the AD9082 (VPK180) project. More...

#include "dma_example.h"
#include "common_data.h"
#include "parameters.h"
#include "app_config.h"
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include "no_os_error.h"
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_util.h"
#include "no_os_delay.h"
#include "no_os_print_log.h"
#include "xilinx_gpio.h"
#include "xilinx_spi.h"
#include "xil_cache.h"
#include "ad9081.h"
#include "axi_jesd204_rx.h"
#include "axi_jesd204_tx.h"
#include "axi_adc_core.h"
#include "axi_dac_core.h"
#include "axi_dmac.h"
Include dependency graph for dma_example.c:

Macros

#define SINE_LUT_SAMPLES   1024
 
#define DAC_BUFFER_SAMPLES   (SINE_LUT_SAMPLES * (AD9081_TX_JESD_M / 2))
 
#define DAC_BUFFER_BYTES   (DAC_BUFFER_SAMPLES * sizeof(uint32_t))
 
#define ADC_BUFFER_SAMPLES   16384
 
#define ADC_BUFFER_SAMPLES_TOTAL   (ADC_BUFFER_SAMPLES * AD9081_RX_JESD_M)
 
#define ADC_BUFFER_BYTES   (ADC_BUFFER_SAMPLES_TOTAL * sizeof(uint16_t))
 
#define DAC_FILL_REPS   16
 
#define DAC_FILL_BYTES   (DAC_BUFFER_BYTES * DAC_FILL_REPS)
 

Functions

int example_main (void)
 DMA example main execution.
 

Variables

const uint32_t sine_lut_iq [1024]
 

Detailed Description

DMA example for the AD9082 (VPK180) project.

    Brings the HMC7044 clocks, the AXI-JESD204 RX/TX cores and the
    AD9082 (ad9081 driver) up exactly like the basic example, then
    moves data: a sine wave is played out of the DACs from a DDR
    buffer through the TX DMAC, and ADC samples are captured into a DDR
    buffer through the RX DMAC.

    NOTE 1: the PL DMACs master the DDR over the Versal NoC, which the
    ADI vpk180 HDL already routes to the DDR controller.  They are not
    cache-coherent with the CPU, so the buffers live in a dedicated DDR
    region (parameters.h) and the CPU flushes / invalidates them by hand
    around each transfer; otherwise the DAC plays stale data or the RX
    capture reads back stale cache contents.

    NOTE 2: the HDL places an AXI data-offload between the TX DMAC and
    the DAC.  Loaded once with a NON-cyclic transfer, the offload
    replays its BRAM continuously, giving a gap-free DAC output.  The
    sine block is therefore replicated across the BRAM so the replay
    never streams uninitialised memory.  (Driving the DMAC in cyclic
    mode instead chops the DAC output into bursts at each reload.)
Author
Analog Devices, Inc.

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ ADC_BUFFER_BYTES

#define ADC_BUFFER_BYTES   (ADC_BUFFER_SAMPLES_TOTAL * sizeof(uint16_t))

◆ ADC_BUFFER_SAMPLES

#define ADC_BUFFER_SAMPLES   16384

◆ ADC_BUFFER_SAMPLES_TOTAL

#define ADC_BUFFER_SAMPLES_TOTAL   (ADC_BUFFER_SAMPLES * AD9081_RX_JESD_M)

◆ DAC_BUFFER_BYTES

#define DAC_BUFFER_BYTES   (DAC_BUFFER_SAMPLES * sizeof(uint32_t))

◆ DAC_BUFFER_SAMPLES

#define DAC_BUFFER_SAMPLES   (SINE_LUT_SAMPLES * (AD9081_TX_JESD_M / 2))

◆ DAC_FILL_BYTES

#define DAC_FILL_BYTES   (DAC_BUFFER_BYTES * DAC_FILL_REPS)

◆ DAC_FILL_REPS

#define DAC_FILL_REPS   16

◆ SINE_LUT_SAMPLES

#define SINE_LUT_SAMPLES   1024

Function Documentation

◆ example_main()

int example_main ( void )

DMA example main execution.

Basic example main execution.

Basic example main executiont.

Returns
0 on success, negative error code otherwise.

IIO descriptor and initialization parameter.

IIO app.

Declaring iio_devices structure

Initializing IIO app init param.

Initializing IIO app.

Running the IIO app (use iio_info or osc in terminal).

Set the threshold voltage to 5V

The comparator output will be available on the GPO_A pin

Set the DAC output on channel C to 5V

Measure input current on channel D

Variable Documentation

◆ sine_lut_iq

const uint32_t sine_lut_iq[1024]
extern