GPIO
This section refers to the following sample application(s):
02-gpio02-gpio_net
A General Purpose Input/Output (GPIO) is a pin that can be configured in software to serve either as an input or as an output pin. On the
LTC5800
chip, all GPIO pins have interrupt capabilities.
When using a DC9003, make sure that the V+ pin is never in contact with any other pin on the mote. The DC9006 supplies 12V through this pin, and connecting any mote IO to it will destroy the mote.
GPIO on
LTC5800
The following list shows the device names, the pins they are mapped to, and the location of the pins on the
board. Some of the pins are reserved for internal use by the
SmartMesh network stack
, and must not be used by your application.
When using a GPIO as an input as arming notifications, we recommend you introduce a delay (e.g. 100ms) when re-arming the notification to the opposite level for de-bouncing.
Device Name | Special Function | board | |||||
|
| Header | Silkscreen text | pin name | pin number | pin name | pin number |
|---|---|---|---|---|---|---|---|
| SPI Master Slave Select 2 (active low) | P2 |
|
| 36 |
| 28 |
| IPCS Slave Select | P1 |
|
| 45 |
| 39 |
| IPCS Clock | P1 |
|
| 44 |
| 36 |
| IPCS Master-Out-Slave-In | P1 |
|
| 42 |
| 35 |
| IPCS Master-In-Slave-Out | P1 |
|
| 40 |
| 33 |
| SPI Master Master Clock | P3 |
|
| 43 |
| 41 |
| SPI Master Master-Out-Slave-In | P3 |
|
| 41 |
| 40 |
| SPI Master Master-In-Slave-Out | P3 |
|
| 39 |
| 38 |
| SPI Master Slave Select 0 (active low) | P3 |
|
| 47 |
| 44 |
| SPI Master Slave Select 1 (active low) | P2 |
|
| 46 |
| 43 |
|
| P2 |
|
| 49 |
| 46 |
|
| P2 |
|
| 48 |
| 45 |
|
| P2 |
|
| 34 |
| 26 |
|
| P2 |
|
| 33 |
| 25 |
|
| P2 |
|
| 27 |
| 21 |
| SPI Slave Master-Out-Slave-In | P2 |
|
| 51 |
| 48 |
The 02-gpio Sample Application
The 02-gpio sample application creates two tasks:
The gpioToggleTask() task configures a pin as output and toggles its state every second. On the
board, this corresponds to the blue LED.
The gpioNotifTask() task waits for notifications from a different pin configured as input. On the
board, this corresponds to the pin labeled
DP2on the silkscreen. Connecting this pin to the supply voltage triggers a notification; disconnecting it triggers another one, as shown in the CLI output captured below:
gpio app, ver 1.0.0.1
SmartMeshIP stack, ver 1.2.1.3
gpioNotifTask: level=1.
gpioNotifTask: level=0.
The 02-gpio sample application does not implement software de-bouncing. You might see a stream of notifications printed if you don't have a circuit which implements hardware de-bouncing.
The 02-gpio_net Sample Application
The 02-gpio_net sample application periodically reads the state of a pin, and sends a corresponding packet to the manager. You can configure the period between samples, and the 1-byte value to send when the pin is high or low.
The figure below is a typical CLI output:
gpio_net app, ver 1.0.0.1
SmartMeshIP stack, ver 1.2.1.3
Current config:
- lowval: 255
- highval: 1
- period: 10000
6661 : Joining
8808 : Connected
15096 : Active
samplePinLevel=0, sent 0xff
samplePinLevel=0, sent 0xff
samplePinLevel=0, sent 0xff
samplePinLevel=1, sent 0x01
samplePinLevel=1, sent 0x01
samplePinLevel=1, sent 0x01