Jetson/GPIO

From eLinux.org
< Jetson
Revision as of 22:05, 17 June 2014 by Shervin.emami (talk | contribs) (Created the initial GPIO page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Jetson TK1 has both a 50-pin and a 75-pin expansion port, both with 2mm spacing in rows of 25 pins:

  • J3A1 (SKT2X25_THR_R 50-pin 2-row 2mm-spaced socket)
  • J3A2 (SKT3X25_THR_R 75-pin 3-row 2mm-spaced socket).

The sockets on the board are female, so you have a few options for physically connecting to the expansion ports:

  • The Samtec TW-25-06-F-5-420-110 header can cover the whole 5x25 expansion port. It might be difficult to find if you just want 1 or 2 of them.
  • You could use separate 3x25 + 2x25 connectors such as a 2-row connector from Digikey.
  • You could just connect to some of the pins individually with solid hookup work or breadboarding pins, particularly if you just want access to several pins.
  • You could build a PCB board with pins sticking out at 2mm spacing, providing you access to potentially all 125 expansion port pins.

To quickly test some GPIO pins

First, make sure your kernel .config file contains:

CONFIG_GPIO_SYSFS=y

Then, to set GPIO_PH1 as an output:

cat /sys/kernel/debug/gpio
# Validate that the entry for the Tegra GPIO controller has a base value of 0. If not, add on whatever the base value is to the “57” in the commands below.
cd /sys/class/gpio
echo 57 > export
cd gpio57
echo out > direction
echo 1 > value

Once you’re done:

cd ..
echo 57 > unexport

You can also play with PWM via sysfs at runtime too! You’ll need to make sure that the pinmux is set up so that PWM is routed to the pin, and that the GPIO for that pin is not claimed, so that the pinmux function is not overridden. Again, you’ll need the following in .config:

CONFIG_PWM_SYSFS=y

Then:

cd /sys/devices/soc0/7000a000.pwm/pwm/pwmchip0

Note: In the L4T kernel, the “soc0” directory component might not be there, and the PWM controller might be named something different like “pwm.0” or “pwm.1”. You might want to just run “cd /sys; find . –type d –name pwmchip*”.

Note: You might need to replace “0” in the commands below with a different PWM channel ID:

echo 0 > export
cd pwm0
echo 1000000 > period
echo  500000 > duty_cycle   # or whatever number 0..period you want; you can write to this file later to change the duty cycle
echo 1 > enable

and when you’re done:

cd ..
echo 0 > unexport