AnsweredAssumed Answered

ad9361 python binding

Question asked by nacbapat on Feb 7, 2017
Latest reply on Feb 8, 2017 by pcercuei


Im using  ZC702 + Ad9361 twinchip. Im getting an array mismatch error in the as follows:


Program Code(apologies for the bad indentations):


import iio
from sys import argv

def main():
print('Library version: %u.%u (git tag: %s)' % iio.version)

ctx = iio.LocalContext()
for dev in ctx.devices:
new = ctx.find_device(
new.enable = True
print "sample size" + str(new.sample_size)
for chan_nos in new.channels:
chan_nos.enabled = True
print "channel nos " + str(

if ( == "cf-ad9361-A"):
# print new.sample_size
buffer_object = iio.Buffer(new,128,False)
print "buffer object length" + str(buffer_object._length)
values =

if __name__ == '__main__':


The terminal output throws the following error:

analog@analog:~$ python
Library version: 0.8 (git tag: c48c08a)
buffer object length2048
Traceback (most recent call last):
File "", line 39, in <module>
File "", line 36, in main
values =
File "/usr/lib/python2.7/dist-packages/", line 482, in read
array = bytearray(end - start)
TypeError: unsupported operand type(s) for -: 'int' and 'NoneType'


I digged into the and it seems that buffer_start() function returns a "NoneType" whereas the buffer_end() returns an "Int" type. and thus the error in the console .



In C the void* pointer is type casted into an int16_t and it works.

The same code implemented in the binding throws up the error.

1. How to fix the type casting error ?

2. Are there any configuration settings that i am missing which shall fix the change ?


Mit freundlichen Grüßen,

Nachiket Bapat