本文主要是介绍OrangePi应用笔记:增加spidev,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
step1: 配置 CONFIG_SPI_SPIDEV=y
Device Drivers --->
[*] SPI support --->
[*] User mode SPI device driver support
step2:配置 dts (Device Tree Source)
vim kernel/arch/arm64/boot/dts/sun50iw2p1.dtsi
找到约853行左右,添加红色区域代码如下:
spi1: spi@01c69000 {#address-cells = <1>;#size-cells = <0>;compatible = "allwinner,sun50i-spi";device_type = "spi1";reg = <0x0 0x01c69000 0x0 0x1000>;interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;clocks = <&clk_pll_periph0>, <&clk_spi1>;clock-frequency = <100000000>;pinctrl-names = "default", "sleep";pinctrl-0 = <&spi1_pins_a &spi1_pins_b>;pinctrl-1 = <&spi1_pins_c>;spi1_cs_number = <1>;spi1_cs_bitmap = <1>;status = "okay"; spidev@0x00 {compatible = "spidev";spi-max-frequency = <1200000>;reg = <0>;};};
step3:修改sys_config.fex文件
位置:external(与kernel同级的文件目录中)/sys_config/OrangePiH5_PC2_sys_config.fex
修改内容参考:http://linux-sunxi.org/SPIdev
编译内核、模块、dtbs,下载到SD卡中,重启装置:
ls /dev/
这篇关于OrangePi应用笔记:增加spidev的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!