LED Blink - Controlling GPIOs - (Yocto) - LTPP3G2 - SP7021
Tibbits #39_1/39_2/39_3/39_4, #00_3
Power adaptor to power LTPP3G2
USB Type-C-to-A cable
Router and ethernet cable for Network LAN
SD-Card/USB stick (greater than 8GB preferable)
Yocto Image file of LTPP3G2 board
IO Ninja pre-installed to access LTPP3G2 over Serial console while uploading Yocto Image
You will get the stable Yocto image from Tibbo's website here https://tibbo.com/downloads/LTPS/FW/LTPPg2/.
Designate and separate folder on your computer for all the files relating to the LTPP3G2 board.
Download the latest Yocto Image from the web link to your computer and copy the Yocto image to a USB stick and connect your computer and LTPP3G2 using USB Type-C-to-A cable, use the Serial console session on the IO Ninja application for access.
Apply the jumper on CN11 and insert the USB/SD Card and press the "Reset" button on LTPP3G2.
The image file will start to upload on eMMC storage, you can see the console logs in the IO Ninja Serial session window and when it says "ISP all: Done" it means the upload is successful and you can reboot the board by removing the jumper CN11.
The default username and password of the Yocto image is "root" and "123" respectively.
After initial access over the serial console, you can check the file system of the Yocto image and shut down the LTPP3G2 board through the command-line interface, attach the Tibbits #00_3 and either of #39_1/39_2/39_3/39_4 to the sockets S1 and S2 respectively along with the ethernet cable and power-up again.
Access the board over the serial console only and check the LTPP3G2 board gets the IP address from the DHCP server, note the IP Address if you want to have a separate SSH session of the board.
GPIO Naming Convention (Yocto):
In SP7021 Linux all socket pins on the board are REALLY (in the kernel) enumerated from 8 up to 59.
Please, see file "pins.ini" on the board "cat /opt/tps-shared/hwini/pins.ini"
To work with GPIO in CLI mode, the user needs to export the corresponding pin, assign the direction and change the value to toggle the LED.
I have shared the snapshot of it in which you can check how I am exporting the pin and setting the GPIO parameters to blink the LED, the same is explained in the "Project Steps" below, while exporting each GPIO pin the Linux system creates a pre-assigned directory, the directory naming convention is explained in the snapshot.
To make it a bit simpler, you can take the help of the excel format, which represents the naming of directory creation of each pin from 8 to 59 along with the naming convention of TiOS this avoids any confusion relating to the printed Pin numbers on the LTPP3G2 board.
- Upload the Yocto image on the board
- Connect the Tibbit #00_3 and #39_x or any external third-party LED (5V-20mA) to the corresponding GPIO
- Get access to the board using a Serial port or SSH session
- Go to the location “cd /sys/class/gpio” and check the available directories
- Run “echo "8" > ./export” and a directory will be generated with the name P1_00….
- cd to the directory P1_00.. and run “echo "out" > direction”, to set the direction of GPIO
- Set the values of GPIO by running “echo "0" > value”, this will turn on the LED, same way set the value to “1” to turn-off
All above steps are represented sequential wise in the CLI prompt, snapshot shared below
The final results will turn-ON/OFF the LED on the board.