10.1. RPi 40-pin header programming¶
TI AM68A SK development board contain a 40 pin GPIO header, similar to the 40 pin header in the Raspberry Pi. These GPIOs can be controlled for digital input and output using the Python/CPP libraries provided in the TI GPIO Library packages. The libraries have the same API as the RPi.GPIO library for Raspberry Pi in order to provide an easy way to move applications running on the Raspberry Pi to the TI board.
TI GPIO Libraries are packaged under /opt
directory. Run the below script
to build and install the gpio libraries
/opt/edgeai-gst-apps# ./scripts/install_ti_gpio_libs.sh
By default, the 40-pin header is not enabled on AM69A SK board. This can be enabled by
specifying the dtb overlay file k3-am68-sk-rpi-hdr-ehrpwm.dtbo
in
/run/media/BOOT-mmcblk1p1/uEnv.txt
as given below.
name_overlays=k3-j721s2-edgeai-apps.dtbo k3-am68-sk-rpi-hdr-ehrpwm.dtbo
Reboot the board after editing and saving the file.
10.1.1. 40-pin header default configuration¶
The default pin configuration on the SK board is as follows. Any deviation from this needs modifications to the Linux DTBO. The table below lists pin numbers in all three supported modes, namely BOARD, BCM, and SOC.
BOARD: Physical Pin Number BCM : Broadcom SOC Numbering SOC : TI SOC Naming
BOARD |
BCM |
SOC |
Function |
---|---|---|---|
3 |
2 |
GPIO0_4 |
I2C1 SDA |
5 |
3 |
GPIO0_5 |
I2C1 SCL |
7 |
4 |
WKUP_GPIO0_66 |
GPIO |
8 |
14 |
GPIO0_1 |
GPIO |
10 |
15 |
GPIO0_2 |
GPIO |
11 |
17 |
GPIO0_42 |
GPIO |
12 |
18 |
GPIO0_46 |
GPIO |
13 |
27 |
GPIO0_36 |
GPIO |
15 |
22 |
WKUP_GPIO0_49 |
GPIO |
16 |
23 |
GPIO0_3 |
GPIO |
18 |
24 |
GPIO0_13 |
GPIO |
19 |
10 |
WKUP_GPIO0_1 |
GPIO |
21 |
9 |
WKUP_GPIO0_2 |
GPIO |
22 |
25 |
WKUP_GPIO0_67 |
GPIO |
23 |
11 |
WKUP_GPIO0_0 |
GPIO |
24 |
8 |
WKUP_GPIO0_3 |
GPIO |
26 |
7 |
WKUP_GPIO0_15 |
GPIO |
29 |
5 |
WKUP_GPIO0_56 |
GPIO |
31 |
6 |
WKUP_GPIO0_57 |
GPIO |
32 |
12 |
GPIO0_35 |
HW PWM |
33 |
13 |
GPIO0_51 |
HW PWM |
35 |
19 |
GPIO0_47 |
GPIO |
36 |
16 |
GPIO0_41 |
HW PWM |
37 |
26 |
GPIO0_27 |
GPIO |
38 |
20 |
GPIO0_48 |
GPIO |
40 |
21 |
GPIO0_45 |
GPIO |
NOTE: Please refer to SK-AM68 User’s Guide for details on the expansion header pin names and functionality. Also refer to section 2.1.2 Power Budget Considerations for power/voltage limits on the expansion header pins.
10.1.2. Repositories¶
The Python and CPP projects are hosted on Texas Instruments GitHub. The links to the projects are given below. The details on installation and testing can be found in the respective project documentation.
Python Library: https://github.com/TexasInstruments/ti-gpio-py.git
CPP Library: https://github.com/TexasInstruments/ti-gpio-cpp.git
The above repositories are cloned and installed during the initialization process upon initial boot.
The gpiozero
library is also installed as a part fo the initialization.
10.1.3. Additional References¶
Please refer to the lik below for information on the 40-pin header numbering and naming conventions: