From 973991f53afdb1ac0d10b92968d002c5240c1a35 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Tue, 1 Apr 2025 14:43:45 -0500 Subject: [PATCH] projects/ad738x_fmc: add DMA gate to SPI offload trigger Add an AND gate to disable the SPI offload trigger when the DMA is full. Before this change, when NUM_OF_SDI=1, the SPI offload would pause in the middle of a SPI message when the DMA got full which confused both the DMA controller and the ADC chip causing data channels to become misalligned in memory. After this change, the trigger is prevented from firing when the DMA is full so the SPI message doesn't even start, avoiding the problems mentioned above. Signed-off-by: David Lechner --- projects/ad738x_fmc/common/ad738x_bd.tcl | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/projects/ad738x_fmc/common/ad738x_bd.tcl b/projects/ad738x_fmc/common/ad738x_bd.tcl index 3e09448fa2a..6bdd0d53045 100644 --- a/projects/ad738x_fmc/common/ad738x_bd.tcl +++ b/projects/ad738x_fmc/common/ad738x_bd.tcl @@ -51,10 +51,17 @@ ad_ip_parameter spi_clkgen CONFIG.VCO_MUL 8 ad_connect $sys_cpu_clk spi_clkgen/clk ad_connect spi_clk spi_clkgen/clk_0 +ad_ip_instance util_vector_logic cnv_gate +ad_ip_parameter cnv_gate CONFIG.C_SIZE 1 +ad_ip_parameter cnv_gate CONFIG.C_OPERATION {and} + +ad_connect cnv_gate/Op1 axi_ad738x_dma/s_axis_xfer_req +ad_connect cnv_gate/Op2 spi_trigger_gen/pwm_0 + ad_connect spi_clk spi_trigger_gen/ext_clk ad_connect $sys_cpu_clk spi_trigger_gen/s_axi_aclk ad_connect sys_cpu_resetn spi_trigger_gen/s_axi_aresetn -ad_connect spi_trigger_gen/pwm_0 $hier_spi_engine/trigger +ad_connect cnv_gate/Res $hier_spi_engine/trigger ad_connect axi_ad738x_dma/s_axis $hier_spi_engine/M_AXIS_SAMPLE ad_connect $hier_spi_engine/m_spi ad738x_spi