Ok, so here is code derived from the official GPIO example code (which did not work either):
import onionGpio
import time
import os
print '> Instantiating gpio object'
gpio5 = onionGpio.OnionGpio(5)
gpio11 = onionGpio.OnionGpio(11)
print ''
print '> Set direction to output... '
ret = gpio5.setOutputDirection()
print ' returned %d'%ret
ret = gpio11.setOutputDirection()
print ' returned %d'%ret
print '> Set gpio 5 value to 0... '
ret = gpio5.setValue(0)
print ' returned %d'%ret
time.sleep(0.1)
print '> Set gpio 11 value to 0... '
ret = gpio11.setValue(0)
print ' returned %d'%ret
time.sleep(0.1)
print '> Set gpio 11 value to 1... '
ret = gpio11.setValue(1)
print ' returned %d'%ret
time.sleep(0.1)
print ''
I hooked up GPIO11 to my Si470x's RST pin, and the GPIO5 (SDA) to the Si470x board's respective i2c SDA pin.
I cross checked with my Pi that exactly this wiring works (it does, using a small i2cinit tool and the C based RdsPi Si470 software).
When running the above software to try and put the Si470x in two wire mode, I still get the resource busy error:
root@Omega-FF87:~# echo 11 > /sys/class/gpio/unexport
-ash: write error: Invalid argument
root@Omega-FF87:~# echo 5 > /sys/class/gpio/unexport
-ash: write error: Invalid argument
root@Omega-FF87:~# python onion-si470x.py > Instantiating gpio object
> Set direction to output...
Traceback (most recent call last):
File "onion-si470x.py", line 12, in <module>
ret = gpio5.setOutputDirection()
File "/usr/lib/python2.7/onionGpio.py", line 168, in setOutputDirection
ret = self._setDirection(argument)
File "/usr/lib/python2.7/onionGpio.py", line 147, in _setDirection
self.setValue(0)
File "/usr/lib/python2.7/onionGpio.py", line 85, in setValue
status = self._initGpio()
File "/usr/lib/python2.7/onionGpio.py", line 46, in _initGpio
fd.close()
IOError: [Errno 16] Resource busy
I have the feeling that the GPIO libraries on the Omega are totally broken. The only thing I got working was using the gpioctl command line program.
The same stuff seems so much easier on the Pi and much more reliable.