Borrar filtros
Borrar filtros

Use iio_readdev with mwipcore

17 visualizaciones (últimos 30 días)
Luis
Luis el 17 de Dic. de 2019
Respondida: Tom Mealey el 13 de Mzo. de 2023
Hi,
I am working with the AXI4-Stream interface provided with the HDL Coder, starting from this example. Since the AXI4-Stream interface uses iio drivers, it is possible to see the ip cores in the zynq board using iio_info (as stated here).
I wish to test the streaming interface using directly iio drivers in the zynq board: is it possible to use iio_readdev and iio_writedev commands in the zynq command line to test mwipcore?
I tried something similar as shown here, but whitout sucess:
zynqmp> iio_readdev mwipcore0:s2mm0
Unable to refill buffer: Connection timed out

Respuesta aceptada

Tom Mealey
Tom Mealey el 13 de Mzo. de 2023
Yes, it is possible to test the IIO stream drivers using iio_readdev and iio_writedev.
In the AXI4-Stream example you linked, the FIR Filter IP core gets its input from the MM2S DMA and writes the output to S2MM DMA. So, you must write data before you can read it.
First generate a binary file containing your input data. E.g.
t = 0:0.001:1.999;
inputData = cos(2.*pi.*t.*(1+t.*75)).';
inputDataFi = fi(inputData, 1,16,10); % match the input data type in hdlcoder_sfir_fixed_stream
inputDataU16 = typecast(storedInteger(inputDataFi),'uint16'); % get raw uint16 from fi data
inputDataU32 = uint32(inputDataU16); % pad to 32 bits because DMA stream width is 32
writer = dsp.BinaryFileWriter(Filename='input.bin');
step(writer,inputDataU32);
release(writer);
Upload this file to some location on the board's Linux filesystem, e.g. the mounted SD card directory:
hw=xilinxsoc;
hw.putFile('input.bin','/mnt')
Then from the board's Linux shell, queue up iio_readdev:
zynqmp> iio_readdev -T 0 -s 2000 mwipcore0:s2mm0 > /mnt/output.bin &
  • -T 0 specifies infinite timeout (read will block indefinitely until data is available following a write)
  • -s 2000 specifies to read 2000 samples. The input data file in this example contains 2000 32-bit samples.
  • > /mnt/output.bin will write the output data to binary file output.bin on the SD card
  • & will run iio_readdev in the background, freeing up the shell to run iio_writedev
Write input data with iio_writedev:
zynqmp> cat /mnt/input.bin | iio_writedev -s 2000 mwipcore0:mm2s0
Finally, download the output file and check the contents.
hw.getFile('/mnt/output.bin');
reader = dsp.BinaryFileReader(Filename='output.bin',SamplesPerFrame=2000,DataType='uint32');
release(reader);
outputDataU32 = step(reader);
outputDataFi = reinterpretcast(cast_to_fi(outputDataU32), numerictype(1,32,20));
outputData = double(outputDataFi);
plot(outputData);

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by