Page 1 of 1

Jupyter Analog Input Example do not works

Posted: Sat Jan 26, 2019 4:07 pm
by SEUTec
Jupyter Analog Input Example do not works:

I get:

singleInput = FPGA.analog_in(0)

---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-8-a16e9d6621c3> in <module>()
----> 1 singleInput = FPGA.analog_in(0)

/home/jupyter/RedPitaya/redpitaya/overlay/mercury.py in __init__(self, channel)
77 channel = self.channels[channel]
78 self.chn = self.dev.find_channel(channel)
---> 79 self.scale = self.chn.attrs['scale'].value
80
81 def read(self):

AttributeError: 'NoneType' object has no attribute 'attrs'

How can I solve this ?
A bug in the python library ?

Thanks.

Re: Jupyter Analog Input Example do not works

Posted: Fri Aug 30, 2019 6:52 pm
by jaimenms
I have the same problem. Any help?

Re: Jupyter Analog Input Example do not works

Posted: Sat Aug 31, 2019 6:05 pm
by jaimenms
I found the problem.

The class analog_in in mercury.py module the slow analog device using an index:

dev = ctx.devices[3]

In my case, the slow analog input is not the "3" but "2". I think the best approach is to access it by the device name.

After some tries I changed it to:

dev = ctw.find_device("iio:device1")

And it worked.

I think I will study the mercury.py before I use it.

Please let me know if it worked for you.

Re: Jupyter Analog Input Example do not works

Posted: Tue Aug 25, 2020 5:45 pm
by IC_Suki
It works for me too, jaimenms! Thank you!