LimeSDR GPIO Board: Difference between revisions
AndrewBack (talk | contribs) (→Python) |
AndrewBack (talk | contribs) (→Python) |
||
Line 61: | Line 61: | ||
===== Read pin status ===== | ===== Read pin status ===== | ||
<source lang="python" line='line'> | |||
import SoapySDR | import SoapySDR | ||
from SoapySDR import * #SOAPY_SDR_ constants | from SoapySDR import * #SOAPY_SDR_ constants | ||
Line 78: | Line 78: | ||
if __name__ == '__main__': main() | if __name__ == '__main__': main() | ||
</source> | |||
===== Toggle each pin ===== | ===== Toggle each pin ===== | ||
<source lang="python" line='line'> | |||
import SoapySDR | import SoapySDR | ||
from SoapySDR import * #SOAPY_SDR_ constants | from SoapySDR import * #SOAPY_SDR_ constants | ||
Line 146: | Line 146: | ||
if __name__ == '__main__': main() | if __name__ == '__main__': main() | ||
</source> | |||
{{Community}} | {{Community}} |
Revision as of 07:05, 21 February 2018
An expansion board for the LimeSDR family that provides individually settable, bi-directional level-shifted I/O for FPGA GPIO 0-7.
Each I/O has a high-voltage and power Darlington drive stage suitable for inductive loads, such as coaxial relays.
Key features
- Provides bi-directional level shifted IO for GPIO 0-7
- 1.2-5.5V IO on J2
- Each IO has a high voltage and power Darlington drive stage
- Acceptable rating 30V 300mA (0-4) 200mA (5-7)
- Suitable for inductive loads
- Input/Output are individually switch-able
- LimeSDR form factor
- Individually pluggable relay connections
Documentation
Layout
- Data direction switches and data indication
- J2 Level shifted interface (1.2-5.5V)
- J1 (cable) and J23 (direct connection)
- LimeSDR interface (3v3 only)
- Power input
- Relay out 0 to 3
- Relay out 4 to 7
Relay outputs and power in
All 8 relay outputs are designed with inductive load switching in mind.
Channels 0-4 have 3 stages of the ULN2003A connected so are suitable for high power applications, It is recommended to keep below 300mA to avoid excessive heating.
Power is connected from J6, Use caution when connecting high voltage supplies not to in correctly connect them as they can cause permanent damage to your LimeSDR.
Equivalent Circuit:
J3 Power bypass
The GPIO board requires power for the level shifting circuity, J2’s VCC must be connected to your interface logic level (i.e. 5V).
If this the level shifting feature is not being used then connect a jumper on J3 to set the whole board to 3v3.
NOTE: DO NOT PROVIDE POWER TO J2 WHEN J3 IS CONNECTED!
Control
LimeSuiteGUI
Connect as normal with LimeSuiteGUI within the board controls tab there is a GPIO control section. “Dir” Ticked is an output un-ticked an input.
Python
These control examples use Soapy SDR Python support. Please ensure that you have this installed.
Read pin status
import SoapySDR from SoapySDR import * #SOAPY_SDR_ constants import time print("Done!") def main(): d = SoapySDR.Device() d.writeGPIODir('MAIN', 0x00) #all inputs while(1): data = d.readGPIO('MAIN') print(data) time.sleep(1) if __name__ == '__main__': main()
Toggle each pin
import SoapySDR from SoapySDR import * #SOAPY_SDR_ constants import time print("Done!") def main(): d = SoapySDR.Device() d.writeGPIODir('MAIN', 0xFF) #all outputs #d.writeGPIO('', 0xF) #all on data = d.listGPIOBanks() print "Device being used: %s" %(data) toggle =0 while(1) if(toggle==0): GPIOVal = 0x00 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #all off if(toggle==1): GPIOVal = 0x01 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #GPIO 1 On if(toggle==2): GPIOVal = 0x02 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #GPIO 2 On if(toggle==3): GPIOVal = 0x04 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #GPIO 3 On if(toggle==4): GPIOVal = 0x08 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #GPIO 4 On if(toggle==5): GPIOVal = 0x10 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #GPIO 5 On if(toggle==6): GPIOVal = 0x20 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #GPIO 6 On if(toggle==7): GPIOVal = 0x40 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #GPIO 7 On if(toggle==8): GPIOVal = 0x80 print "GPIO %d set with value %d" % (toggle,GPIOVal) d.writeGPIO('MAIN', GPIOVal) #GPIO 8 On toggle =0 toggle = toggle + 1 # increment the loop time.sleep(2) # sleep if __name__ == '__main__': main()
|