Jump to content
  • 0

Measuring Zynq IC Temperature on ADP3250

Robert White



New to the ADP3250 and so far very impressed at the capabilities and trying to learn how to program my applications up in linux mode.

I'm trying to read the IO status register "temperature" which I think is channel 1, node 0, see table below.  Using linux mode and running a python script.  I keep getting "0" for the temperature.  I feel like I'm not enabling the device correctly or somehow not understanding how to read the Status?  Help?

from ctypes import *
from dwfconstants import *
from subprocess import call
import sys

dwf = cdll.LoadLibrary("libdwf.so")

hdwf = c_int()  # device handle
dwf.FDwfDeviceOpen(c_int(0), byref(hdwf))  # open first device


dwf.FDwfAnalogIOChannelNodeStatus(hdwf, c_int(1), c_int(0), byref(T1))



Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 1
Posted (edited)

Did you run the program as root?

I didn't run your program because life's too short to hand craft Python code to interface directly to C. Instead I did the following. I probably should have backed up the ADP3250 first, but I YOLOed it instead.

digilent@ADPro:~$ sudo -i
root@ADPro:~# apt update
root@ADPro:~# apt install python3-pip
root@ADPro:~# pip3 install pydwf

Note that installing pip will pull in a full C development environment because pip sometimes needs it, so don't be alarmed about the number if packages that get installed. I was expecting to need to install numpy which is a requirement of pydwf, but unlike the C development packages, numpy was already installed.

Then I copied AnalogIO.py from Github in to the ADP3250 and then I unplugged the the ethernet cable from my ADP3250. Then I ran

digilent@ADPro:~$ sudo python3 AnalogIO.py 
analogIO.enableSet() supported ......... : True
analogIO.enableStatus() supported ...... : True
analogIO.enableGet() ................... : False
analogIO.enableStatus() ................ : False
Channel #1 (2 of 4 channels) named ('Zynq', 'Zynq') has 7 nodes:

    node #0 (1 of 7):
        node_name ............. ('Temperature', 'C')
        node_info ............. DwfAnalogIO.Temperature
        node_set_info ......... (0.0, 0.0, 0)
        node_get .............. 0.0
        node_status_info ...... (0.0, 100.0, 1000)
        node_status ........... 51.17009353637701
Traceback (most recent call last):
  File "AnalogIO.py", line 119, in <module>
  File "AnalogIO.py", line 111, in main
    demo_analog_io_continuous_readout(device.analogIO, "USB Monitor")
  File "AnalogIO.py", line 68, in demo_analog_io_continuous_readout
    raise RuntimeError("Unable to find unique channel {!r}.".format(channel_name))
RuntimeError: Unable to find unique channel 'USB Monitor'.

If you don't unplug the ethernet cable, then AnalogIO.py will find the ethernet interface to the ADP5230 as well as the USB one and not know which one to use. AnalogIO.py supports selecting the device based on the serial number, but that isn't going to help here.


p.s. Working out how to filter out the unwanted ethernet connect to the ADP3250 was a complete pain in the proverbial.The two interfaces to the ADP3250 have different device version numbers, which I can only assume is how the WaveForms software differentiates them. In my case the version number of the non-ethernet interface was 1796 and so I just hard-coded "device_version_filter=1796" into the call to openDwfDevice() in AnalogIO.py and I could now run it without having to unplug the ethernet.

Edited by Lloyd Parkes
Link to comment
Share on other sites

  • 0

Thank you @attila and @Lloyd Parkes.  Adding the line 

 dwf.FDwfAnalogIOStatus(hdwf) #read the Analog IO status

before reading the temperature was all that was required.  Temperature is now reading around 50 C which seems reasonable.

I have seen lots of references to the pydwf package which @Lloyd Parkes suggests, I will have to decide whether to stick with the c_type() stuff or install that.  Thank you!! Great stuff!!

Link to comment
Share on other sites

  • 0

I made the beginner mistake of jumping into Linux mode without doing the optional Linux upgrade. It turns out that the Linux software my ADP3250 shipped with was horror-old. Of course, my ADP3250 isn't brand new any more either. 

With the latest (version 11) Linux image I have noticed that when I don't sudo, that the S/N of the AXI connection shows up as "SN:SudoRequired". Nice.

Now I'm off to report a bug in the pydwf library. It only supports the old style device enumeration, so it doesn't allow you enumerate only AXI connected devices. This is why I had to unplug the ethernet cable from my ADP3250 for enumeration to only find one device.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...