2.10.3. IO ExpanderΒΆ

The AM64x Starter Kit (SK EVM) has an 40-pin User Expansion connector. The connector has multiple pins providing 3.3v and 5.0v, These VCC pins are routed to the output of power switches, which are controlled by GPIOs of an IO Expander.

By default, these VCC pins are 0v to avoid providing power to the Expansion Connector. But they can be turned ON or OFF by manipulating the corresponding GPIO pins. This section demonstrates the process.

The SK schematics shows the 3.3v power switch is controlled by signal EXP_PS_3V3_EN, which is pin P05 of the IO Expander, while the 5.0v power switch is controlled by signal EXP_PS_5V0_EN which is pin P06 of the IO Expander. The IO Expander is connected to I2C1 with address 0x22.

In the SK EVM Linux prompt, run the following commands to find out the GPIO base ID in SYSFS:

# cd /sys/class/gpio/
# ls -l
total 0
--w------- 1 root root 4096 May 30 16:56 export
lrwxrwxrwx 1 root root    0 May 30 16:56 gpiochip289 -> ../../devices/platform/bus@f0000/20010000.i2c/i2c-1/1-0022/gpio/gpiochip289
lrwxrwxrwx 1 root root    0 May 30 16:56 gpiochip313 -> ../../devices/platform/bus@f0000/601000.gpio/gpio/gpiochip313
lrwxrwxrwx 1 root root    0 May 30 16:56 gpiochip401 -> ../../devices/platform/bus@f0000/600000.gpio/gpio/gpiochip401
lrwxrwxrwx 1 root root    0 May 30 16:56 gpiochip488 -> ../../devices/platform/bus@f0000/bus@f0000:bus@4000000/4201000.gpio/gpio/gpiochip488

The output shows the symlink gpiochip289 points to i2c1 bus, so 289 is the GPIO base ID of the IO Expander. Adding 5 (P05 for EXP_PS_3V3_EN signal) yields 294. So 294 is the GPIO ID for the GPIO controlling the 3.3v pin power switch.

Run the following commands to enable GPIO P05:

# echo 294 > export
# cd gpio294
# ls
active_low  device  direction  edge  power  subsystem  uevent  value
# cat direction
in
# echo out > direction
# cat value
0

To turn on the 3V3 pins, run the following command:

# echo 1 > value

To turn off the 3V3 pins, run the following command:

# echo 0 > value

To control the 5V0 pins, run the similar commands above with the GPIO ID 295, which is for EXP_PS_5V0_EN pin P06.