Difference between revisions of "Manipulating GPIO"

From AllStarLink Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
[[Category:How to]]
 
[[Category:How to]]
 +
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)
 +
 
== URIs/USB Sound Fobs (CM108, CM119) ==
 
== 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.
 
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.
Line 10: Line 14:
 
  gpio4 = out0 ; in, out0 or out1
 
  gpio4 = out0 ; in, out0 or out1
  
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').
+
<!--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').-->
 +
 
 +
 
 +
== Printer Port / Parallel Port ==
 +
Support for configuration of pins 2-9 (output) and pins 10-13 and 15 (inputs) on a Parallel/Printer Port
 +
 
 +
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.
 +
 
 +
Described in the file as
 +
 
 +
iobase=0x378 - iobase=0x278 - iobase=0x3bc / LPT1, LPT2 and LPT3 respectively.  
  
It also supports configuration of pins 2-9 (output) and pins 10-13 and 15 (inputs) on a Parallel
+
If you might imagine you may use a Doug Hall RBI-1 interface, then begin populating Parallel Port pins starting after pin3 as the first 3 would be used for that device and is unchangeable.
  
Printer Port (if you happen to have one) in the following manner:
+
Pins 2-9 (output) and pins 10-13 and 15 (inputs)  
  
  pp2 = out1 ; out0, out1 or ptt
+
  pp2 = out1 ; out0 (or ptt inside of USBRadio/SimpleUSB)
  pp10 = in ; in, cor or ctcss
+
  pp10 = in (or cor / ctcss inside of USBRadio/SimpleUSB)
  
When you configure an input pin (10,11,12,13 or 15), you can either designate it as 'in' (input),
+
===Inside of SimpleUSB/USBRadio===, When you configure an input pin (10,11,12,13 or 15), you can either designate it as  
  
'cor' (use as the 'cor' input), or 'ctcss' (use as the 'ctcss') input. If you choose 'cor' or
+
'cor' (RX input signal) or 'ctcss' (use as the 'ctcss tone valid') input.  
  
'ctcss', you also need to set the associated 'carrierfrom' or 'ctcssfrom' to either 'pp' (use the
+
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).
 
associated input pin non-inverted) or 'ppinvert' (use the associated input pin inverted).
  
When you configure an output pin (2-9), you can either designate it as 'out0' (output with a default
+
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.
 +
 
 +
Example:
 +
 
 +
pp6=ptt
 +
 
 +
pp7=ctcss
 +
 
 +
pp11=cor
 +
 
 +
invertptt=0
 +
 
 +
carrierfrom=ppinvert (could also be ctcss or ctcssinvert or pp)
  
state of 'off'), 'out1' (output with a default state of 'on'), or 'ptt' makes the PTT signal present
 
  
on it either non-inverted or inverted, depending on the 'invertptt' setting.
 
  
 
Pins 18-25 are ground, and all other pins are to be treated as no connection.
 
Pins 18-25 are ground, and all other pins are to be treated as no connection.
 +
 +
'''Note:''' 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.
 +
  
 
The condition of the input pins are made available via channel variables (e.g. RPT_URI_GPIO1,
 
The condition of the input pins are made available via channel variables (e.g. RPT_URI_GPIO1,
Line 61: Line 90:
  
 
  1234 = cop,61,GPIO1=1 ; Turn on GPIO 1
 
  1234 = cop,61,GPIO1=1 ; Turn on GPIO 1
 +
 +
 +
 +
 +
This page still needs minor revisions.

Revision as of 02:18, 11 January 2022

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)

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.

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.

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

gpio1 = in ; in, out0 or out1
gpio4 = out0 ; in, out0 or out1


Printer Port / Parallel Port

Support for configuration of pins 2-9 (output) and pins 10-13 and 15 (inputs) on a Parallel/Printer Port

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.

Described in the file as

iobase=0x378 - iobase=0x278 - iobase=0x3bc / LPT1, LPT2 and LPT3 respectively.

If you might imagine you may use a Doug Hall RBI-1 interface, then begin populating Parallel Port pins starting after pin3 as the first 3 would be used for that device and is unchangeable.

Pins 2-9 (output) and pins 10-13 and 15 (inputs)

pp2 = out1 ; out0 (or ptt inside of USBRadio/SimpleUSB)
pp10 = in  (or cor / ctcss inside of USBRadio/SimpleUSB)

===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.

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).

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.

Example:

pp6=ptt

pp7=ctcss

pp11=cor

invertptt=0

carrierfrom=ppinvert (could also be ctcss or ctcssinvert or pp)


Pins 18-25 are ground, and all other pins are to be treated as no connection.

Note: 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.


The condition of the input pins are made available via channel variables (e.g. RPT_URI_GPIO1,

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

command) as follows:

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:

1234 = cop,61,GPIO1=1 ; Turn on GPIO 1



This page still needs minor revisions.