30-pin Header

Mixtile Blade 3 (hereinafter referred to as Blade 3) provides a row of GPIO (general-purpose input/output) pins along the lower edge of the board for extended interfacing. These pins can be used for a wide range of applications. Among these pins, some are defined as I2C, I2S, USB, SPI, ADC, and PWM interfaces. 

Figure 1. Layout of Blade 3’s 30 pins

This document describes how to use some of the pins for specific tasks, including:

  • Connect an OLED display module via the I2C interface.
  • Connect an OLED display module via the SPI interface.
  • Connect a fan module.

For more information about pin assignment and definitions, see Blade 3 Connectors & Pin Assignments.

I2C

This section describes how to connect an OLED display module via the I2C interface.

Preparations

Steps

Step 1. Connect the OLED display module to the 30-pin header. The pin matching is as follows:

Figure 2. Mapping between OLED display module and Blade 3
Figure 3. OLED display module connected to I2C interface

Step 2. Check whether the OLED module has been connected to Blade 3 by running the following command:

i2cdetect -y -r 5

The command output is as follows. 0x3c is the address of the OLED display module. 

0 1 2 3 4 5 6 7 8 9 a b c d e f00: -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- 3c -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Step 3. Install a compilation tool by running the following command:

apt update && apt install build-essential

Step 4. Download the oled.tar file, decompress it, and copy it to the Blade 3 directory.

  • Using the ADB tool:
adb push oled.tar /home/mixtile
  • Using a serial communication tool or via SSH:
scp oled.tar mixtile@Blade 3 IP address:/home/mixtile

Step 5. Configure the OLED module and generate an executable file.

Navigate to the oled folder and open the sources/oled.c file by using the vim editor.

5.1 Locate the line //#define IIC_MODE and change it as #define IIC_MODE. Save and exit the vim editor.

5.2 Under the oled directory, run the make command to generate an executable file.

Step 6. Execute the file that is generated in the previous step by running the following command:

./oled

You can see that the OLED display module shows text blade3, as shown below.

Figure 4. OLED display

SPI

Preparations

Steps

Step 1. Connect the OLED display module to the 30-pin header. The pin matching is as follows:

Figure 5. Mapping between OLED display module and Blade 3
Figure 6. OLED display module connected to SPI interface

Step 2. Install the compilation tool by running the following command:

apt update && apt install build-essential

Step 3. Download the oled.tar file, decompress it, and copy it to the Blade 3 directory.

  • Using the ADB tool:
adb push oled.tar /home/mixtile
  • Using a serial communication tool or via SSH:
scp oled.tar mixtile@Blade 3 IP address:/home/mixtile

Step 4. Configure the OLED module and generate an executable file.

4.1 Navigate to the oled folder and open the sources/oled.c file by using the vim editor.

4.2 Locate the line //#define SPI_MODE and change it as #define SPI_MODE. Save and exit the vim editor.

4.3 Under the oled directory, run the make command to generate an executable file.

Step 5. Execute the file that is generated in the previous step by running the following command:

./oled

You can see that the OLED display module shows text blade3, as shown below.

Figure 7. OLED display

Connect a fan module

Preparations

  • A fan module

Steps

Connect the fan module to Blade 3. The pin matching is as follows:

Figure 8. Mapping fan and PWM interface

Note: You can connect the pwm pin to PWM14 or PWM15.

Figure 9. Fan connected to the PWM interface

After connection is done, the fan starts running.

(Optional) Adjust the running speed of the fan.

  1. Under the Blade 3 directory, run the following command:
    cd /sys/class/pwm/pwmchip1/

Note: If you connect the pwm pin of the fan to PWM14, the directory is /sys/class/pwm/pwmchip1/. If you connect the pwm pin of the fan to PWM15, the directory is /sys/class/pwm/pwmchip2/.

2. Enable PWM timer 0 by running the following command:

echo 0 > export

3. Navigate to PWM timer 0 by running the following command:

cd pwm0

4. Configure parameters of PWM timer 0 and make the parameters effective:

echo 20000 > period #Set PWM period to 20 ms.
echo 10000 > duty_cycle #Set the duty cycle of the fan to 50%.
echo normal > polarity #Two parameters are available: normal or inversed, indicating whether the output pin level is inverted.
echo 1 > enable #Enable PWM.

5. To increase the fan speed, change duty_cycle to a greater value. The following command makes the fan run at full speed:

echo 20000 > duty_cycle

6. To reduce the fan speed, change duty_cycle to a smaller value. The following command makes the fun run 20% of the full speed:

echo 5000 > duty_cycle
Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Contact Support