IMX6ULL开发板spi OLED驱动

本文是IMX6ULL开发板spi OLED驱动学习笔记,方便后面查看时快速的回顾,而不需要一点点的看视频

视频地址:
https://www.bilibili.com/video/BV1Yb4y1t7Uj?p=144&spm_id_from=pageDriver&vd_source=1d93d6a5e22d4b223c6c3ac4f5727eb8

视频选集:P141 - P150

1、将文件上传到虚拟机共享目录
file

2、make编译出驱动
file

3、修改设备树

vim 100ask_imx6ull-14x14.dts
file

&ecspi1 {
    pinctrl-names = "default";
    pinctrl-0 = <&pinctrl_ecspi1>;
		
    fsl,spi-num-chipselects = <2>;
    cs-gpios = <&gpio4 26 GPIO_ACTIVE_LOW>, <&gpio4 24 GPIO_ACTIVE_LOW>;
    status = "okay";

    oled: oled {
        compatible = "100ask,oled";
        reg = <0>;
        spi-max-frequency = <1000000>;
        dc-gpios = <&gpio4 20 GPIO_ACTIVE_HIGH>;
    };

编译设备树:
file
注意:必须退回到linux内核目录里编译

将设备树文件放到共享目录:

cp arch/arm/boot/dts/100ask_imx6ull-14x14.dts /home/book/nfs_rootfs/

4、替换设备树

进入开发板,将设备树拷贝到/boot之后重启

mount -t nfs -o nolock,vers=3 192.168.5.11:/home/book/nfs_rootfs /mnt
file

5、验证设备树

进入设备树查找oled

cd /sys/firmware/devicetree/base

find -name "*oled*"
file

进入oled目录查看:

cd ./soc/aips-bus@02000000/spba-bus@02000000/ecspi@02008000/oled
file

6、安装驱动

·insmod oled_drv.ko·
file

7、执行oled_test验证

./oled_test /dev/myoled
file
file

本文由博客一文多发平台 OpenWrite 发布!

posted @ 2024-06-24 10:48  xjxcxjx  阅读(31)  评论(0编辑  收藏  举报