Awesome, this was the trick! I also fixed the mask error I introduced. The DMA buffer length register was set to 16 I changed it to 17.
I can now collect 320 us.
I'll let you know what the maximum capture time ends up being. Thanks so much! ⭐ ⭐ ⭐ ⭐
The mask here represents pulling out one of two 14-bit values packed into a 32-bit word, so it should stay 3FFF.
For the DMA, please confirm the width of buffer length register setting is large enough, it's an IP setting in the block design.
I'm not sure where else to look, it looks like the window position register width in the AXI controller is also controlled by kBufferSize in the VHDL source, and the corresponding definition in the C++ sources defines it as up to 26 bits wide: https://github.com/Digilent/zmodlib/blob/f2f491971aa43fa23d3d2a1d6640d6f97ad69318/ZmodADC1410/zmodadc1410.h#L49C9-L49C40. Same for the S2MM length register width in software: https://github.com/Digilent/zmodlib/blob/f2f491971aa43fa23d3d2a1d6640d6f97ad69318/Zmod/zmod.h#L46C9-L46C45.
I would also consider adding an ILA to the design (if possible, it also requires BRAM...), to take a look at the AXI stream signals going into the DMA.
Thanks,
Arthur
Got it working! Here's my cheat sheet to replicate.
Install PetaLinux 2019.1, my install directory is in /home/bw/Xilinx/petalinux-v2019.1
*** You will also need Vivado 2019.1 and SDK 2019.1 if you want to run baremetal or modify the actual hardware project (do additional/different stuff on the FPGA).
*** To collect data with the ADC in Linux using the demo setup, I think you just need Petalinux 2019.1
Get Ubuntu and Format SD Card (just do steps 2, 5, and 6 in link):
https://medium.com/developments-and-implementations-on-zynq-7000-ap/install-ubuntu-16-04-lts-on-zynq-zc702-using-petalinux-2016-4-e1da902eaff7
Get the Digilent Demo for the Eclypse Z7 Zmod ADC 1410:
git clone --recursive https://github.com/Digilent/Eclypse-Z7 -b zmod_adc/master
Source your Petalinux:
source /home/bw/Xilinx/petalinux-v2019.1/settings.sh
The libuio.git build links do not work in this Eclypse-Z7 petalinux project. My workaround is to go into Eclypse-Z7/os/project-spec/meta-user/recipes-apps
and delete the 'libuio' folder. Then later you can install libuio manually in the Ubuntu OS running on the Eclypse Z7.
From Eclypse-Z7/os/ directory run (change to your appropriate directory, probably not "bw"!):
petalinux-config --get-hw-description=/home/bw/Documents/fpga/Eclypse-Z7/hw/hw_handoff/
***In this menu set the rootfs to run from SD card
petalinux-config -c kernel
***In this menu goto device drivers-->userspace I/O-->select (*) all Xilinx UIO options
***also device drivers-->IRQ chipset-->the Xilinx option (not 100% sure you need this)
***save the file by entering on save option, quick keys MAY be unreliable
petalinux-build
petalinux-package --boot --force --fsbl images/linux/zynq_fsbl.elf --fpga images/linux/system.bit --u-boot
Copy image.ub, boot.bin, and system.dtb from images folder into boot parition on SD card.
You also need a uEnv.txt (given below at end of this).
You should now also have Ubuntu as a rootfs on the SD card, copy the 'ZmodADC1410_Demo_Linux' and the 'zmodlib' folders into a folder onto the rootfs partion, I put mine into
/home/ubuntu/RH
Move ZmodADC1410 demo app from Eclypse-Z7-SW folder onto Eclypse Z7 Ubuntu rootfs
add LINUX_APP to compile
for example:
g++ -std=c++11 -Wall -DLINUX_APP dma.c -c
You need to compile all the .c files within the subfolders of zmodlib
many files require adding #include <stdbool.h>, those needing it will give you an error about "bool" this or that
Some may require libuio.h which I got from:
git clone --recursive https://github.com/Digilent/libuio checkout
you can then ``make" these files to build a library to put with outher library files in /lib/ for example
you can also put libuio.h into /usr/include
list of files to compile: dma.c, libaxidma.c, flash.dma, reg.dma, utils.c, zmod.cpp, zmodadc1410.cpp
Finally, go to the directory holding main.cpp, for me its /home/ubuntu/RH/ZmodADC1410_Demo_Linux/src/
Link/compile main.cpp
g++ -std=c++11 -DLINUX_APP main.cpp -o main -I "../../zmodlib/" -I "../../zmodlib/Zmod/" -I "../../zmodlib/Zmod/linux/" -I "../../zmodlib/Zmod/linux/dma/" -I "../../zmodlib/Zmod/linux/flash/" -I "../../zmodlib/Zmod/linux/reg/" -I "../../zmodlib/ZmodADC1410/" ../../zmodlib/Zmod/linux/reg/reg.o ../../zmodlib/Zmod/linux/flash/flash.o ../../zmodlib/Zmod/linux/dma/dma.o ../../zmodlib/Zmod/linux/dma/libaxidma.o ../../zmodlib/Zmod/linux/utils.o ../../zmodlib/ZmodADC1410/zmodadc1410.o ../../zmodlib/Zmod/zmod.o -luio
You can now run it with: sudo ./main
Won't run without sudo, some permission issue with axidma. (perhaps someone knows how to fix?)
################################### uEnv.txt ###################################################
# Eclypse boot configuration
#VARIABLES
#Zmod configuratio to use: adc, dac, adc-dac
zmod=system
fdn=0
bit_addr=0x10000000
dtb_addr=0x11000000
img_addr=0x11400000
img_name=image.ub
dtb_name=system.dtb
####### To evaluate before use
eval_variables=\
setenv bit_name zm-${zmod}.bit; \
setenv dtb_name zm-${zmod}.dtb; \
setenv bootargs console=ttyPS0,115200 earlyprintk cma=25M uio_pdrv_genirq.of_id=generic-uio root=/dev/mmcblk0p2 rw rootwait;