Soon after we released A13-GPIO for Python https://olimex.wordpress.com/2013/03/08/a13-olinuxino-gpio-python-libraries/ we got requests to do same for iMX233.
iMX233_GPIO is released on PyPi now https://pypi.python.org/pypi/iMX233_GPIO/0.1.0
it works identical to pyA13 you can use same commands:
import iMX233_GPIO as GPIO #init module GPIO.init() #configure module GPIO.setinput(GPIO.PIN#) GPIO.setoutput(GPIO.PIN#) #set GPIO high GPIO.output(GPIO.PIN#, 1) #set GPIO low GPIO.output(GPIO.PIN#, 0) #read input state = GPIO.input(GPIO.PIN#)
due to the GPIO multiplexing we add only these GPIOs in the base package:
PIN9, PIN10, PIN11, PIN12, PIN13, PIN14, PIN15, PIN16, PIN17, PIN18, PIN23, PIN24, PIN25, PIN26, PIN27, PIN28, PIN29, PIN31
you can use this as template, and if you for instance disable LCD in your linux image you can have access to all LCD pins too.
After you download the package from PyPi do as follows to install it:
#tar -zxvf iMX233_GPIO-0.1.0.tar.gz #cd iMX233_GPIO-0.1.0.tar.gz #sudo python setup.py install
after the installation you can use it this way:
#sudo python >>> import iMX233_GPIO as GPIO >>> GPIO.init() #init GPIOs >>> GPIO.getcfg(GPIO.PIN31) #config PIN31 as GPIO >>> GPIO.setcfg(GPIO.PIN31, GPIO.OUTPUT) #config PIN31 as output >>> GPIO.output(GPIO.PIN31, GPIO.HIGH) #set PIN31 high >>> GPIO.output(GPIO.PIN31, GPIO.LOW) #set PIN31 low >>> GPIO.setcfg(GPIO.PIN31, GPIO.INPUT) #config PIN31 as input >>> GPIO.input(GPIO.PIN31) #read PIN31
PINxx assignments is exactly as per imx233-OLinuXino-MAXI schematic
Maximum iMX233 GPIO toggle speed via Python is 15,6 kHz, which is kind of dissapointing, as /dev/mem C approach achieve about 5.7 6 Mhz, but Python is running slow on imx233 so this probably cause the slow GPIOs access.
On A13 is opposite /dev/mem is running slower at 1Mhz but pyA13 GPIO achieve up to 100 kHz as Python is running faster on A13.
Recent Comments