Jump to: navigation, search

Difference between revisions of "LimeSDR GPIO Board"

(Control)
(Control)
Line 56: Line 56:
 
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.
 
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.
  
==== C++ (LMS API)
+
==== C++ (LMS API) ====
  
 
See the [https://github.com/myriadrf/LimeSuite/tree/master/src/examples example provided with Lime Suite].
 
See the [https://github.com/myriadrf/LimeSuite/tree/master/src/examples example provided with Lime Suite].

Revision as of 07:08, 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.

1 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

2 Documentation

2.1 Layout

LimeSDR CPIO Board Layout.jpg

  • 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

2.2 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:

LimeSDR GPIO Board Equivalent Circuit.png

2.3 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!

2.4 Control

2.4.1 LimeSuiteGUI

LimeSuiteGUI GPIO Controls.png

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.

2.4.2 C++ (LMS API)

See the example provided with Lime Suite.

2.4.3 Python (SoapySDR API)

These control examples use Soapy SDR Python support. Please ensure that you have this installed.

2.4.3.1 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()
2.4.3.2 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()