analogdevicesinc / libad9361-iio

IIO AD9361 library for filter design and handling, multi-chip sync, etc.
http://analogdevicesinc.github.io/libad9361-iio/
GNU Lesser General Public License v2.1
76 stars 48 forks source link

support for GPO[3:0] #48

Closed drom closed 5 years ago

drom commented 5 years ago

Does this library provide a way to control General-Purpose Outputs: GPO_3 to GPO_0?

tfcollins commented 5 years ago

Not really, general GPIO control is outside the scope of libIIO in general. Unless an IIO driver internally uses one like the FMComms5 components. The attribute "calibration_switch_control" is essentially mapped to some GPIOs.

drom commented 5 years ago

I am finding some traces of information about AD9361 GPO being supported:

But all my attempts are failing for now. https://observablehq.com/@drom/plutosdr-gpio

rgetz commented 5 years ago

See if this helps:

https://wiki.analog.com/university/tools/pluto/hacking/power_amp

It uses the GPO on the Pluto for Rx/Tx (controlling LNA or power amp).

drom commented 5 years ago

Thank you @rgetz now it works. I just have to do iio_device_debug_attr_write_bool(dev, "initialize", 1); in the end.

mhennerich commented 5 years ago

The AD936x driver in our current master branch supports GPO manual control from debugfs please see updated docs here: https://wiki.analog.com/resources/tools-software/linux-drivers/iio-transceiver/ad9361#gpo_manual_control

drom commented 5 years ago

I have seen this instruction, but the latest PlutoSDR FW v0.31 doesn't have gpo_set utility?

mhennerich commented 5 years ago

No - it'll be in v0.32 ...

drom commented 5 years ago

@mhennerich Looking forward to getting v0.32 then!

mhennerich commented 5 years ago

This will take a few months - we're on a biannual release schedule. However you can use (untested) attached snapshot. plutosdr-fw-v0.31-dirty.zip

drom commented 5 years ago

How badly untested it is? :thinking:

mhennerich commented 5 years ago

There shouldn't be any issues - Everything except the kernel version should be v0.31. It's basically the version I used to implement gpo_set support.

mhennerich commented 5 years ago

Works for me:

# pwd
/sys/kernel/debug/iio/iio:device1
# echo 1 > adi,gpo-manual-mode-enable
# echo 0 1 > gpo_set 
# uname -a
Linux pluto 4.14.0-42808-g570aada #303 SMP PREEMPT Mon Aug 5 09:25:56 CEST 2019 armv7l GNU/Linux
# whoami
root
# 
drom commented 5 years ago

It works. Thank you @mhennerich