I am trying to run the example " DAC-ADC Pmod Examples …" that can be found at the link below on a PYNQ-Z1. https://github.com/Xilinx/PYNQ/blob/v2.5/boards/Pynq-Z1/base/notebooks/pmod/pmod_dac_adc.ipynb
However, instead of a PmodAD4 I have a Pmod AD1 (The PmodAD4 is out of stock).
I am able to run all of the setup code,
from pynq.overlays.base import BaseOverlay
from pynq.lib import Pmod_ADC, Pmod_DAC
ol = BaseOverlay("base.bit")
dac = Pmod_DAC(ol.PMODB)
adc = Pmod_ADC(ol.PMODA)
I am able to write to the DAC (I can see this on an oscilloscope so I know it’s working).
dac.write(0.35)
But when I come to read from the ADC, it hangs,
sample = adc.read()
I can leave it for several minutes but it will never complete, and just stays as [*]
. I tried restarting the PYNQ-Z1, restarting the kernel, and writing some of my own code but it always hangs at the same line. If I interrupt the kernel I get the error below, but I am not sure how to read into this error or what causes it.
KeyboardInterrupt Traceback (most recent call last)
in ()
----> 1 sample = adc.read()/opt/python3.6/lib/python3.6/site-packages/pynq/lib/pmod/pmod_adc.py in read(self, ch1, ch2, ch3)
202
203 # Send the command
→ 204 self.microblaze.write_blocking_command(cmd)
205
206 # Read the last sample from ADC/opt/python3.6/lib/python3.6/site-packages/pynq/lib/pmod/pmod.py in write_blocking_command(self, command)
152 “”"
153 self.write(MAILBOX_OFFSET + MAILBOX_PY2IOP_CMD_OFFSET, command)
→ 154 while self.read(MAILBOX_OFFSET + MAILBOX_PY2IOP_CMD_OFFSET) != 0:
155 pass
156/opt/python3.6/lib/python3.6/site-packages/pynq/lib/pynqmicroblaze/pynqmicroblaze.py in read(self, offset, length)
304 “”"
305 if length == 1:
→ 306 return self.mmio.read(offset)
307 elif length > 1:
308 return [self.mmio.read(offset + 4*i) for i in range(length)]/opt/python3.6/lib/python3.6/site-packages/pynq/mmio.py in read(self, offset, length)
140
141 # Read data out
→ 142 return int(self.array[idx])
143
144 def write(self, offset, data):KeyboardInterrupt:
I am very new to Pynq, and to Juptyer notebooks in general (I come from an Ancaoda/spyder background) so I fully admit I may be missing something simple. Looking at the docs for the library call, I don’t see anything about this library only being for PmodAD2, but maybe there is a compatibility issue
that I am running into?
I am not sure how to get my PYNQ version number, as if I they root@pynq:/home/xilinx# pynq --version
into the Jupyter terminal I get bash: pynq: command not found
. However, if I open the file REVISION I see “Release 2018_02_16 e5c8aeb” so I assume that is my version.