Line 1: |
Line 1: |
| [[Category:How to]] | | [[Category:How to]] |
− | The GPIO (general-purpose I/O) pins on a URI (or similar USB device) may be individually used as
| + | [[Category:Hardware]] |
| + | There are 2 types of GPIO as they currently exist in the software. |
| + | I/O's from a URI/sound fob or equivelant AND I/O's from a hardware driven Parallel Port |
| + | (usb converted parallel ports can not be bit-banged for control) |
| | | |
− | either input or output pins. Currently the URI (because of the CM108-AH chip) only supports 2 | + | == URIs/USB Sound Fobs (CM108, CM119) == |
| + | The GPIO (general-purpose I/O) pins on a URI (or similar USB device) may be individually used as either input or output pins. Currently the URI (because of the CM108-AH chip) only supports 2 usable GPIO pins (GPIO 1 and GPIO 4), plus one pin (labeled GPIO2, but is actually the 'HOOK' signal on the CM-108AH chip) that may be used only for input. The old version of the URI and some other devices that use the original CM-108A chip, have full access to the GPIO 2 signal also. |
| | | |
− | usable GPIO pins (GPIO 1 and GPIO 4), plus one pin (labeled GPIO2, but is actually the 'HOOK' signal
| + | The upside to the CM-108AH is that if you are monitoring an external contact closure, the GPIO2 (HOOK) input is internally pulled-up and de-bounced, so its perfect for such applications. |
| | | |
− | on the CM-108AH chip) that may be used only for input. The old version of the URI and some other
| + | Chan_usbradio and chan_simpleusb supports configuration of the GPIO pins in the following manner (from within the section of usbradio.conf that is for the desired device): |
| | | |
− | devices that use the original CM-108A chip, have full access to the GPIO 2 signal also.
| + | <syntaxhighlight lang="ini"> |
| + | gpio1 = in ; in, out0 or out1 |
| + | gpio4 = out0 ; in, out0 or out1 |
| + | </syntaxhighlight> |
| | | |
− | The upside to the CM-108AH is that if you are monitoring an external contact closure, the GPIO2 (HOOK) | + | <!--The following is not correct but I am masking it till verified/KB8JNM - When you configure a GPIO pin, you can either designate it as 'in' (input), 'out0' (output with a default state of 'off'), or 'out1' (output with a default state of 'on').--> |
| + | == Parallel Port == |
| + | Support for configuration of pins 2-9 (output) and pins 10-13 and 15 (inputs) on a Parallel Port |
| | | |
− | input is internally pulled-up and de-bounced, so its perfect for such applications.
| + | First, there must be a description in rpt.conf of the address of the port. Standard ports are 378, 278 and 3bc /LPT1, LPT2 and LPT3 respectively. |
| | | |
− | Chan_usbradio and chan_simpleusb supports configuration of the GPIO pins in the following manner
| + | Described in the file as |
| | | |
− | (from within the section of usbradio.conf that is for the desired device):
| + | iobase=0x378 - iobase=0x278 - iobase=0x3bc / LPT1, LPT2 and LPT3 respectively. |
| | | |
− | gpio1 = in ; in, out0 or out1
| + | If you might imagine you may use a Doug Hall RBI-1 interface, then begin populating Parallel Port pins starting <u>after</u> pp3 (pin5) as the first 3 would be used for that device and is unchangeable. |
| | | |
− | gpio4 = out0 ; in, out0 or out1
| + | Pins 2-9 (output) and pins 10-13 and 15 (inputs) |
| | | |
− | When you configure a GPIO pin, you can either designate it as 'in' (input), 'out0' (output with a default state of 'off'), or 'out1' (output with a default state of 'on').
| + | <syntaxhighlight lang="ini> |
| + | pp2 = out1 ; out0 (or ptt inside of USBRadio/SimpleUSB) |
| + | pp10 = in (or cor / ctcss inside of USBRadio/SimpleUSB) |
| + | </syntaxhighlight> |
| | | |
− | It also supports configuration of pins 2-9 (output) and pins 10-13 and 15 (inputs) on a Parallel
| + | === Inside of SimpleUSB/USBRadio === |
| + | When you configure an input pin (10,11,12,13 or 15), you can either designate it as 'cor' (RX input signal) or 'ctcss' (use as the 'ctcss tone valid') input. |
| | | |
− | Printer Port (if you happen to have one) in the following manner:
| + | If you choose 'cor' or 'ctcss', you also need to set the associated 'carrierfrom' or 'ctcssfrom' to either 'pp' (use the associated input pin non-inverted) or 'ppinvert' (use the associated input pin inverted). |
| | | |
− | pp2 = out1 ; out0, out1 or ptt
| + | When you configure an output pin (2-9) as 'ptt' makes the pin the PTT signal on it, either non-inverted or inverted, depending on the 'invertptt=' setting. |
| | | |
− | pp10 = in ; in, cor or ctcss
| + | ====Example==== |
| + | <syntaxhighlight lang="ini> |
| + | pp6=ptt |
| | | |
− | When you configure an input pin (10,11,12,13 or 15), you can either designate it as 'in' (input),
| + | pp7=ctcss |
| | | |
− | 'cor' (use as the 'cor' input), or 'ctcss' (use as the 'ctcss') input. If you choose 'cor' or
| + | pp11=cor |
| | | |
− | 'ctcss', you also need to set the associated 'carrierfrom' or 'ctcssfrom' to either 'pp' (use the
| + | invertptt=0 |
| | | |
− | associated input pin non-inverted) or 'ppinvert' (use the associated input pin inverted).
| + | carrierfrom=ppinvert ;(could also be ctcss or ctcssinvert or pp) |
| + | </syntaxhighlight> |
| | | |
− | When you configure an output pin (2-9), you can either designate it as 'out0' (output with a default
| + | === Notes === |
| + | Pins 18-25 are ground, and all other pins are to be treated as no connection. |
| | | |
− | state of 'off'), 'out1' (output with a default state of 'on'), or 'ptt' makes the PTT signal present
| + | PP output pins are 0v/NC/float when not active. When active/true, they switch to ground. So, test with one probe on pin and one on digital/frame ground. Pins never show a voltage. |
| | | |
− | on it either non-inverted or inverted, depending on the 'invertptt' setting.
| + | The condition of the input pins are made available via channel variables (e.g. RPT_URI_GPIO1, |
| | | |
− | Pins 18-25 are ground, and all other pins are to be treated as no connection.
| + | RPT_URI_GPIO4, RPT_PP12, etc.) used by the Event Management Subsystem. |
| | | |
− | The condition of the input pins are made available via channel variables (e.g. RPT_URI_GPIO1,
| + | == Usage == |
− | | |
− | RPT_URI_GPIO4, RPT_PP12, etc.) used by the Event Management Subsystem.
| |
| | | |
| The output pins may be manipulated via the 'cop,61' (or 'cop,62') command (directly or through a DTMF | | The output pins may be manipulated via the 'cop,61' (or 'cop,62') command (directly or through a DTMF |
Line 56: |
Line 71: |
| command) as follows: | | command) as follows: |
| | | |
− | 61 - Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,PP4=1].....) | + | 61 - Send Message to USB to control GPIO pins (cop,61,GPIO1=0[,PP4=1].....) |
| + | 62 - Same as above, without generating the 'complete' telemetry. |
| + | |
| + | Use 0 or 1 to set the specified output to 0 or 1, or a number greater then 1 to specify how many milliseconds minus 1 to invert its current state. For example, to pulse the bit for 500ms you would use the value '501'(currently, specified time only significant in increments of 50ms). The use of specifying a value of N+1 to indicate N milliseconds was done so that if, in the future, the granulatity increases down to the millisecond level, a value of 1 ms could be specified. |
| + | |
| + | For example, if you wanted to have a DTMF function (in this example *1234) that turned GPIO 1 on, you would specify the following in the [functions] section of the rpt.conf file: |
| + | |
| + | <syntaxhighlight lang="ini"> 1234 = cop,61,GPIO1=1 ; Turn on GPIO 1</syntaxhighlight> |
| + | |
| + | A simple example command structure for using all 8 PP pins for output switches: |
| + | <syntaxhighlight lang="ini"> |
| + | 98910=cop,61,pp1=0 ;pport pin 1 off |
| + | |
| + | 98911=cop,61,pp1=1 ;pport pin 1 on |
| + | |
| + | 98920=cop,61,pp2=0 ;pport pin 2 off |
| + | |
| + | 98921=cop,61,pp2=1 ;pport pin 2 on |
| + | |
| + | 98930=cop,61,pp3=0 ;pport pin 3 off |
| | | |
− | 62 - Same as above, without generating the 'complete' telemetry.
| + | 98931=cop,61,pp3=1 ;pport pin 3 on |
| | | |
− | Use 0 or 1 to set the specified output to 0 or 1, or a number greater then 1 to specify how
| + | 98940=cop,61,pp4=0 ;pport pin 4 off |
| | | |
− | many milliseconds minus 1 to invert its current state. For example, to pulse the bit for 500ms you
| + | 98941=cop,61,pp4=1 ;pport pin 4 on |
| | | |
− | would use the value '501'(currently, specified time only significant in increments of 50ms). The
| + | 98950=cop,61,pp5=0 ;pport pin 5 off |
| | | |
− | use of specifying a value of N+1 to indicate N milliseconds was done so that if, in the future,
| + | 98951=cop,61,pp5=1 ;pport pin 5 on |
| | | |
− | the granulatity increases down to the millisecond level, a value of 1 ms could be specified.
| + | 98960=cop,61,pp6=0 ;pport pin 6 off |
| | | |
− | For example, if you wanted to have a DTMF function (in this example *1234) that turned GPIO 1
| + | 98961=cop,61,pp6=1 ;pport pin 6 on |
| | | |
− | on, you would specify the following in the [functions] section of the rpt.conf file:
| + | 98970=cop,61,pp7=0 ;pport pin 7 off |
| | | |
− | 1234 = cop,61,GPIO1=1 ; Turn on GPIO 1
| + | 98971=cop,61,pp7=1 ;pport pin 7 on |
| | | |
− | Note: You must have app_rpt version 0.259 10/9/2010, and chan_usbradio also released at
| + | 98980=cop,61,pp8=0 ;pport pin 8 off |
| | | |
− | that time, and for Parallel Printer Port support, you must have app_rpt version 0.267
| + | 98981=cop,61,pp8=1 ;pport pin 8 on |
| + | </syntaxhighlight> |
| | | |
− | 10/23/2010, and chan_usbradio also released at that time.
| + | Using a easier to remember structure as you think of it as - 989 (for pp switch cmd) + 1-8 (pp pin#) + 1/0 (on/off). Change to suite needs |