将Mikrobus OLED显示屏与iMX 7主板连接

时间:2017-06-06 04:13:33

标签: embedded-linux

我有一个i.MX7S板(WARP7),它有扩展(Mikrobus标准)和OLED C点击显示(Mikrobus标准)。 我尝试了很多方法,但仍未能启用&在OLED屏幕上显示一些东西。 以下是我所做的步骤:

  1. 将它们连接在一起(使用Mikrobus标准)
  2. Bitbake并安装“core-image-base”图像(源代码https://github.com/Freescale/fsl-community-bsp-platform -b krogoth)
  3. 使用Staging / FBTFT模块启用所有设备更新linux内核配置(内核源代码:https://github.com/WaRP7/linux-fslc
  4. 修改fbtft_device.c以添加我的设备的定义

    .name = "oledc",
    .spi = &(struct spi_board_info) {
        .modalias = "fb_ssd1351",
        .max_speed_hz = 20000000,
        .mode = SPI_MODE_0,
        .platform_data = &(struct fbtft_platform_data) {
            .display = {
                .buswidth = 8,
                .width = 96,
                .height = 96,
            },
            .bgr = true,
            .gpios = (const struct fbtft_gpio []) {
                { "reset", 198 },
                { "dc", 200 },
                { "led", 199 },
            },
            .gamma = "0 2 2 2 2 2 2 2 " \
                     "2 2 2 2 2 2 2 2 " \
                     "2 2 2 2 2 2 2 2 " \
                     "2 2 2 2 2 2 2 3 " \
                     "3 3 3 3 3 3 3 3 " \
                     "3 3 3 3 3 3 3 3 " \
                     "3 3 3 4 4 4 4 4 " \
                    "4 4 4 4 4 4 4"
            }
        }
    }
    
  5. 更新设备树(imx7s-warp.dts)以添加SPI支持

    &ecspi2 {
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio4 23 GPIO_ACTIVE_LOW>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi2>;
        status = "okay";        
    
        spidev@0 {
            compatible = "spidev";
            reg = <0>;
            spi-max-frequency = <20000000>;
            spi-cs-high;
        };
    };
    
    &iomuxc {
        pinctrl-names = "default";
        imx7s-warp {
            pinctrl_ecspi2: ecspi2grp {
                fsl,pins = <
                    MX7D_PAD_ECSPI2_MISO__GPIO4_IO22    0x00000014 /* MISO */
                    MX7D_PAD_ECSPI2_MOSI__GPIO4_IO21    0x00000014 /* MOSI */
                    MX7D_PAD_ECSPI2_SCLK__GPIO4_IO20    0x00000014 /* SCLK */
                    MX7D_PAD_ECSPI2_SS0__GPIO4_IO23     0x00000014 /* CS1 */
                >;
            };
        };
        imx7d-sdb {
            pinctrl_brcm_reg: brcmgrp {
                fsl,pins = <
                    MX7D_PAD_SD2_WP__GPIO5_IO10 0x14 /* WL_REG_ON */
                >;
            };
    
            pinctrl_gpio: gpiogrp {
                fsl,pins = <
                    /*MX7D_PAD_ENET1_RGMII_RD1__GPIO7_IO1   0x14*/
                    MX7D_PAD_ENET1_RGMII_RD0__GPIO7_IO0 0x00000005 /* RST */
                    MX7D_PAD_ENET1_RGMII_RD1__GPIO7_IO1 0x00000005 /* INT */
                    MX7D_PAD_ENET1_RGMII_RD2__GPIO7_IO2 0x00000005 /* PWM2 */
                >;
            };
    
  6. 重建zImage,imx7s-warp.dtb,imx7s-warp.dts&amp;复制到引导分区(ums 0 mmc 0模式)

  7. 重建&amp;安装所有模块(ums 0 mmc 0模式)
  8. 重新启动主板
  9. 登录并运行命令

      

    modprobe fbtft

         

    modprobe fb_ssd1351

         

    modprobe fbtft_device name = oledc debug = 3 busnum = 1

         

    modprobe dmesg -c

         

    cp / dev / urandom&gt;的/ dev / FB0

  10. ===&GT;结果:我的显示器仍然是黑色的:(但只有显示器的电源开启 输出命令

    root@imx7s-warp:~# modprobe fbtft_device name=oledc debug=3 busnum=1
    fbtft_device: module is from the staging directory, the quality is unknown, you have been warned.
    fbtft_device: SPI devices registered:
    fbtft_device: spidev spi1.0 20000kHz 8 bits mode=0x04
    fbtft_device: 'fb' Platform devices registered:
    fbtft_device: Deleting spi1.0
    fb_ssd1351 spi1.0: fbtft_gamma_parse_str() str=
    fb_ssd1351 spi1.0: 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4
    fb_ssd1351 spi1.0: fbtft_request_gpios: 'reset' = GPIO198
    fb_ssd1351 spi1.0: fbtft_request_gpios: 'dc' = GPIO200
    fb_ssd1351 spi1.0: fbtft_request_gpios: 'led' = GPIO199
    fb_ssd1351 spi1.0: fbtft_verify_gpios()
    fb_ssd1351 spi1.0: init_display()
    fb_ssd1351 spi1.0: fbtft_reset()
    fb_ssd1351 spi1.0: set_var()
    fb_ssd1351 spi1.0: Display update: 978 kB/s (18.394 ms), fps=0 (0.000 ms)
    fb_ssd1351 spi1.0: set_gamma()
    Console: switching to colour frame buffer device 12x12
    graphics fb0: fb_ssd1351 frame buffer, 96x96, 18 KiB video memory, 4 KiB DMA buffer memory, fps=20, spi1.0 at 20 MHz
    fbtft_device: GPIOS used by 'oledc':
    fbtft_device: 'reset' = GPIO198
    fbtft_device: 'dc' = GPIO200
    fbtft_device: 'led' = GPIO199
    fbtft_device: SPI devices registered:
    fbtft_device: fb_ssd1351 spi1.0 20000kHz 8 bits mode=0x00
    

    我想我的显示器会在这些步骤之后启用并显示某些内容,但事实并非如此。

    我做错了吗? 因为我从未参与过嵌入式和之前的Linux,然后我在这里迷失方向。 非常感谢任何帮助或指导

    非常感谢你。

0 个答案:

没有答案