4062 views|6 replies

270

Posts

0

Resources
The OP
 

[Luckfox RV1103 Linux Development Board Review] 05 Driving 0.96-inch OLED [Copy link]

 
This post was last edited by 怀穿少年梦 on 2024-1-29 23:21

This time, let's try to use such a small board to drive a 0.96-inch OLED and see the effect.

1. Preparation

hardware:

0.96-inch OLED screen;

Dupont wire;

software:

Download the official OLED reference code

OLED_1in5_Code.7z_Free high-speed download|Baidu Netdisk-Share without restrictions (baidu.com)

SPI/I2C driving OLED (C) | LUCKFOX WIKI References

2. Determine the connection pins

As shown in the following table

Since the pins of the development board are identified by pin numbers, the corresponding relationship between the GPIOn_Xn number and the pin number on the development board is as follows:

pin = bank * 32 + (group * 8 + n); bank is because the chip is divided into several bank areas, for example, GPIO1_C6:

GPIO1 corresponds to bank1; C corresponds to group, which is group 2, and 6 is the 7th pin in group 2;

That is: GPIO1_C6 corresponds to pin = 1 * 32 + 2 * 8 + 6 = 54

0.96inch OLED Module

Luckfox Pico Pinout

Function

VCC

3V3

power input

GND

GND

Power Ground

D1

GPIO1-C2 -----SPI0_MOSI(50)

Master output/slave input

D0

GPIO1-C1------SPI0_CLK(48)

SPI clock signal

CS

GPIO1_C7(55)

Chip Select

DC

GPIO1_C6(54)

Data/Command Selection

RST

GPIO1_C4(52)

Reset

3. Modify SDK

Enter the /sysdrv/source/kernel/arch/arm/boot/dts/ directory

Operation as shown in the figure

1. Add GPIO pin configuration in rv1103g-luckfox-pico.dts and add pin

in pinctrl

2. Confirm whether SPI0 is enabled and add pinctrl of SPI 0

The configured DTS is as follows:

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2022 Rockchip Electronics Co., Ltd.
 */

/dts-v1/;

#include "rv1103.dtsi"
#include "rv1106-evb.dtsi"
#include "rv1103-luckfox-pico-ipc.dtsi"

/ {
    model = "Luckfox Pico";
    compatible = "rockchip,rv1103g-38x38-ipc-v10", "rockchip,rv1103";

        gpio1pc6:gpio1pc6 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio1_pc6>;
                regulator-name = "gpio1_pc6";
                regulator-always-on;
        };


        gpio1pc4:gpio1pc4 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio1_pc4>;
                regulator-name = "gpio1_pc4";
                regulator-always-on;
        };

        gpio1pc7:gpio1pc7 {
                compatible = "regulator-fixed";
                pinctrl-names = "default";
                pinctrl-0 = <&gpio1_pc7>;
                regulator-name = "gpio1_pc7";
                regulator-always-on;
        };

    gpio4pa2:gpio4pa2 {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio4_pa2>;
        regulator-name = "gpio4_pa2";
        regulator-always-on;
    };

    gpio4pa3:gpio4pa3 {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio4_pa3>;
        regulator-name = "gpio4_pa3";
        regulator-always-on;
    };

    gpio4pa4:gpio4pa4 {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio4_pa4>;
        regulator-name = "gpio4_pa4";
        regulator-always-on;
    };

    gpio4pa6:gpio4pa6 {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio4_pa6>;
        regulator-name = "gpio4_pa6";
        regulator-always-on;
    };

    gpio4pb0:gpio4pb0 {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio4_pb0>;
        regulator-name = "gpio4_pb0";
        regulator-always-on;
    };

    gpio4pb1:gpio4pb1 {
        compatible = "regulator-fixed";
        pinctrl-names = "default";
        pinctrl-0 = <&gpio4_pb1>;
        regulator-name = "gpio4_pb1";
        regulator-always-on;
    };
};
/**********GPIO**********/
&pinctrl {

        gpio1-pc6 {
                gpio1_pc6:gpio1-pc6 {
                        rockchip,pins = <1 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

        gpio1-pc4 {
                gpio1_pc4:gpio1-pc4 {
                        rockchip,pins = <1 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

        gpio1-pc7 {
                gpio1_pc7:gpio1-pc7 {
                        rockchip,pins = <1 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
                };
        };

    gpio4-pa2 {
        gpio4_pa2:gpio4-pa2 {
            rockchip,pins =    <4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
        };
    };

    gpio4-pa3 {
        gpio4_pa3:gpio4-pa3 {
            rockchip,pins =    <4 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
        };
    };

    gpio4-pa4 {
        gpio4_pa4:gpio4-pa4 {
            rockchip,pins =    <4 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
        };
    };

    gpio4-pa6 {
        gpio4_pa6:gpio4-pa6 {
            rockchip,pins =    <4 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
        };
    };

    gpio4-pb0 {
        gpio4_pb0:gpio4-pb0 {
            rockchip,pins =    <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
        };
    };

    gpio4-pb1 {
        gpio4_pb1:gpio4-pb1 {
            rockchip,pins =    <4 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
        };
    };

};

&pinctrl {
    spi0 {
        /omit-if-no-ref/
            spi0m0_pins: spi0m0-pins {
                    rockchip,pins =
                    /* spi0_clk_m0 */
                    <1 RK_PC1 4 &pcfg_pull_none>,
                    /* spie_miso_m0 */
                    /* <1 RK_PC3 6 &pcfg_pull_none>,*/
                    /* spi_mosi_m0 */
                    <1 RK_PC2 6 &pcfg_pull_none>;
        };
    };
};




/**********ETH**********/
&gmac {
    status = "disabled";
};

/**********USB**********/
// &usbdrd {
//     status = "disabled";
// };

// &usbdrd_dwc3 {
//     status = "disabled";
// };

// &u2phy {
//     status = "disabled";
// };

// &u2phy_otg {
//     status = "disabled";
// };

/**********I2C**********/
// &i2c0 {
//     status = "okay";
//     pinctrl-0 = <&i2c0m2_xfer>;
//     clock-frequency = <100000>;
// };
&i2c3 {
    status = "okay";
    pinctrl-0 = <&i2c3m1_xfer>;
    clock-frequency = <100000>;
};

// /**********SPI**********/
&spi0 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&spi0m0_pins>;
    cs-gpios = <&gpio1 RK_PC0 1>;
    // cs-gpios = <&gpio1 26 1>;
    #address-cells = <1>;
    #size-cells = <0>;
    spidev@0 {
        compatible = "rockchip,spidev";
        spi-max-frequency = <1000000000>;
        reg = <0>;
    };
};

// /**********UART**********/
&uart3 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart3m1_xfer>;
};
//&uart4 {
//    status = "okay";
//    pinctrl-names = "default";
//    pinctrl-0 = <&uart4m1_xfer>;
//};
// &uart5 {
//     status = "okay";
//     pinctrl-names = "default";
//     pinctrl-0 = <&uart5m0_xfer>;
// };

/**********PWM**********/

&pwm0 {
    status = "okay";
    pinctrl-names = "active";
    pinctrl-0 = <&pwm0m0_pins>;
    // pinctrl-0 = <&pwm0m1_pins>;
};
&pwm1 {
    status = "okay";
    pinctrl-names = "active";
    pinctrl-0 = <&pwm1m0_pins>;
    // pinctrl-0 = <&pwm1m1_pins>;
};

// &pwm2 {
//     status = "okay";
//     pinctrl-names = "active";
//     pinctrl-0 = <&pwm2m2_pins>;
// };
// &pwm3 {
//     status = "okay";
//     pinctrl-names = "active";
//     pinctrl-0 = <&pwm3m2_pins>;
// };
// &pwm4 {
//     status = "okay";
//     pinctrl-names = "active";
//     pinctrl-0 = <&pwm4m2_pins>;
// };
// &pwm5 {
//     status = "okay";
//     pinctrl-names = "active";
//     pinctrl-0 = <&pwm5m2_pins>;
// };
// &pwm6 {
//     status = "okay";
//     pinctrl-names = "active";
//     pinctrl-0 = <&pwm6m2_pins>;
// };
// &pwm7 {
//     status = "okay";
//     pinctrl-names = "active";
//     pinctrl-0 = <&pwm7m2_pins>;
// };
// &pwm8 {
//     status = "okay";
//     pinctrl-names = "active";
//     // pinctrl-0 = <&pwm8m1_pins>;
//     pinctrl-0 = <&pwm8m0_pins>;
// };
// &pwm9 {
//     status = "okay";
//     pinctrl-names = "active";
//     // pinctrl-0 = <&pwm9m1_pins>;
//     pinctrl-0 = <&pwm9m0_pins>;
// };

&pwm10 {
    status = "okay";
    pinctrl-names = "active";
    pinctrl-0 = <&pwm10m1_pins>;
    // pinctrl-0 = <&pwm10m2_pins>;
    // pinctrl-0 = <&pwm10m0_pins>;
};
&pwm11 {
    status = "okay";
    pinctrl-names = "active";
    pinctrl-0 = <&pwm11m1_pins>;
    // pinctrl-0 = <&pwm11m2_pins>;
    // pinctrl-0 = <&pwm11m0_pins>;
};

3. Compile the kernel

1) Select the corresponding board to compile

2) Start compiling

3) Kernel compilation is successful

4) Replace boot.img

Check the boot image generation time in the directory, copy it to the previously burned image file, and then burn it.

4. Modify the official OLED program;

1. Modify the DC and RST pins

1) Check the IO port number of the schematic diagram

2) Modify the DC and RST pins in DEV_Config.h

2. Compile the modified C file in the virtual machine

1) Transfer C project to the virtual machine

2) Enter the c directory and modify the compiler path in the Makefile file

3) Make directly, as shown in the figure

Generate an executable file, as shown in the figure

V. Execution

1. Transfer the entire project file to WINDOWS, and then transfer the project folder to the development board, as shown in the figure

2. Execute the application

1) Add permissions

chmod -R 777 Luckfox_Pico_OLED

2) Execution

3. Actual effect

Luckfox_Pico_OLED.zip (174.02 KB, downloads: 4)
This post is from Domestic Chip Exchange

Latest reply

Ah, this one is indeed a bit small, but it is more than enough to display the words. It takes a bit of effort to make an icon, but it's not a big problem.   Details Published on 2024-1-31 16:28
 
 

6570

Posts

0

Resources
2
 

The actual effect is very good

Thumbs up

This post is from Domestic Chip Exchange

Comments

The screen is a bit smaller  Details Published on 2024-1-31 08:26
 
 
 

4764

Posts

12

Resources
3
 
What's the resolution of this screen?
This post is from Domestic Chip Exchange

Comments

The resolution is not high, only 128*64;  Details Published on 2024-1-31 08:27
 
 
 

270

Posts

0

Resources
4
 
Jacktang posted on 2024-1-31 07:31 The actual effect is very good.

The screen is a bit smaller

This post is from Domestic Chip Exchange
 
 
 

270

Posts

0

Resources
5
 
Azuma Simeng posted on 2024-1-31 08:23 What is the resolution of this screen?

The resolution is not high, only 128*64;

This post is from Domestic Chip Exchange

Comments

This is a little small, but it's more than enough to display text. It's a bit difficult to make an icon, but it's not a big problem.  Details Published on 2024-1-31 16:28
 
 
 

4764

Posts

12

Resources
6
 
Posted with a Youthful Dream on 2024-1-31 08:27 The resolution is not high, only 128*64;

Ah, this one is indeed a bit small, but it is more than enough to display the words.

It takes a bit of effort to make an icon, but it's not a big problem.

This post is from Domestic Chip Exchange

Comments

Yes, mainly used to display some menus, etc.  Details Published on 2024-1-31 17:35
 
 
 

270

Posts

0

Resources
7
 
Azuma Simeng posted on 2024-1-31 16:28 Ah, this is indeed a little small, but it is more than enough to display the text. It takes a little effort to make an icon, but it’s not a big problem,

Yes, mainly used to display some menus, etc.

This post is from Domestic Chip Exchange
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Featured Posts
Experiment 9. Digital display experiment

The digital display using a single chip microcomputer should have a display device; the most widely used is the 7-segmen ...

ATX power interface pin definition

This post was last edited by qwqwqw2088 on 2020-3-28 10:08 24-pin ATX12V 2.x 466942 466943 The 20-pin ATX connector ig ...

What is the selection method and calculation process of ESD tube? Which forum friend can write out the calculation steps?

What is the selection method and calculation process of ESD tube? Which forum friend can write out the calculation steps ...

Encoder counting principle and motor speed measurement principle - multi-picture analysis

This post was last edited by DDZZ669 on 2021-2-14 23:30 Encoder is a sensor used to measure mechanical rotation or displ ...

ssd1306 Chinese and picture display

This post was last edited by lemon1394 on 2021-8-17 23:19 I have found many Chinese displays of ssd1306 introduced on t ...

Discussion on the Reasons for the Temperature Drop of MOS Tubes Connected in Parallel

A circuit was originally designed to test the size of AC current. The design value is 5A maximum, with multiple rang ...

Analysis of rt-thread SDIO driver framework (SMD SD card flash driver\SD Nand flash driver)

Table of Contents rt-thread SDIO driver framework analysis of SD card driver 1. Introduction 2. Introduction to SDIO Uni ...

Espressif is the first to support the Matter 1.2 standard and new home appliance device types

Espressif is so fast! They already support Matter 1.2 as soon as it comes out~ The newly released Matter 1.2 specific ...

【ACM32G103RCT6】3-Porting FreeRTOS to ACM32

This post was last edited by qiao--- on 2023-12-30 03:20 In this video, we will transplant the rtos system to acm32. ac ...

【Follow me Season 2 Episode 2】+ Getting Started Tasks 【Building Environment, Blink / Serial Port Log Printing】

This post was last edited by Misaka10032 on 2024-9-7 00:36 Preface I am very honored to participate in the follow ...

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list