IMX6ULL开发板spi OLED驱动

月笼纱 2024-06-24 11:15:00 阅读 73

本文是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](https://img2024.cnblogs.com/other/1742799/202406/1742799-20240624104757076-887665210.png)

注意:必须退回到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](https://img2024.cnblogs.com/other/1742799/202406/1742799-20240624104757278-526445394.png)

5、验证设备树

进入设备树查找oled

`cd /sys/firmware/devicetree/base`

`find -name "*oled*"`

![file](https://img2024.cnblogs.com/other/1742799/202406/1742799-20240624104757448-75871267.png)

进入oled目录查看:

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

![file](https://img2024.cnblogs.com/other/1742799/202406/1742799-20240624104757615-2008571055.png)

6、安装驱动

·insmod oled_drv.ko·

![file](https://img2024.cnblogs.com/other/1742799/202406/1742799-20240624104757784-1206741841.png)

7、执行oled_test验证

`./oled_test /dev/myoled`

![file](https://img2024.cnblogs.com/other/1742799/202406/1742799-20240624104757969-1925996638.png)

![file](https://img2024.cnblogs.com/other/1742799/202406/1742799-20240624104758185-1460660820.png)

> 本文由博客一文多发平台 [OpenWrite](https://openwrite.cn?from=article_bottom) 发布!



声明

本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。