15. DIGITAL I/O

This page describes the Digital I/Os present on the JETBOX-FLOYD system.

Jetbox-Floyd provides 8 GPIOs optionally exposed on the front panel at connector EXP 2. Refer to Section 8.8 Digital I/Os (EXP 2) for connector pinouts.

The DIOs on the JETBOX-FLOYD is realized using I2C to GPIO expander.

The I2C GPIO expander can be addressed at 0x70 on on the bus /dev/i2c-0.

15.1 Digital I/O Specifications

The DIOs on Jetbox-Floyd are 3.3V output compliant & 5V input tolerant. The logic specifications are as follows:

Since the DIOs are realized with GPIO expanders, the DIOs do not provide any alternate functions but can only be used to drive logic high & logic low.

15.2 Software Commands

There are 3 commands to use the DIOs. They are as follows:

  1. gpio_util setdir

This command configures the direction of a particular DIO. For example, to set DIO 3 as an input & DIO 4 as an output, follow the command as provided below:

gpio_util setdir 3 in // sets DIO 3 as an input
gpio_util setdir 4 out // sets DIO 4 as an output 

2. gpio_util getdir

This command reads the direction of a particular DIO. For example, to read the direction of DIO 2 (earlier set as an input) & DIO 5 (earlier set as an output), use the command as follows:

readDir2 = gpio_util getdir 2 // returns the value "in"
readDir5 = gpio_util getdir 5 out // returns the value "out"

3. gpio_util setval

This command configures the logic driven to an output. For example, to drive a logic 0 to DIO 2 & a logic 1 to DIO 5, use the command as follows:

gpio_util setval 2 0 // drives DIO 2 as logic 0
gpio_util setval 5 1 // drives DIO 5 as logic 1 

4. gpio_util getval

This command reads the logic at an input pin. For example, to read the logic value at DIO 6, use the command as follows:

read6 = gpio_util getval 6 // reads the logic of DIO 6

Last updated