TI中文支持网
TI专业的中文技术问题搜集分享网站

求助:AM335x在linux环境下,如何更改SPI1数据线SPI1_D0,SPI1_D1的方向?

大家好!请帮忙看看:

AM335x使用linux自带的SPI驱动,master模式,用示波器测试发现SPI1_D0数据线方向默认为输入,SPI1_D1数据线方向为输出。

想把SPI1_D0数据线方向配置成输出,SPI1_D1配置为输入,应该如何更改内核?先谢谢了!

AM335x的Table 24-4. McSPI Pin List中有写:SPIx_D0和SPIx_D1都能配置为输入或输出“(Can be configured as either input or output (MOSI or MISO)”,因为我硬件电路上已经做死了(SPI1_D0输出,SPI1_D1输入)。

Eggsy Pang:

你只需要在device tree 文件 am33xx.dtsi. 的地方 spi1: spi@481a0000 node 增加一句话:

spi1: spi@481a0000 { compatible = "ti,omap4-mcspi"; #address-cells = <1>; #size-cells = <0>; reg = <0x481a0000 0x400>; interrupts = <125>; ti,spi-num-cs = <2>; ti,hwmods = "spi1";

ti,pindir-d0-out-d1-in = <1>;  

dmas = <&edma 42 0 &edma 43 0 &edma 44 0 &edma 45 0>; dma-names = "tx0", "rx0", "tx1", "rx1"; status = "disabled"; };

user4662703:

回复 Eggsy Pang:

谢谢Eggsy Pang的回复!

但是我们在linux系统源码里找不到am33xx.dtsi这个文件,在arch/arm/boot/dts/目录下只看到omap2.dtsi比较接近一些,如下,但是里面也没有对SPI的描述,应该怎么办?再次谢谢!

/* * Device Tree Source for OMAP2 SoC * * Copyright (C) 2011 Texas Instruments Incorporated – http://www.ti.com/ * * This file is licensed under the terms of the GNU General Public License * version 2. This program is licensed "as is" without any warranty of any * kind, whether express or implied. */

/include/ "skeleton.dtsi"

/ { compatible = "ti,omap2430", "ti,omap2420", "ti,omap2";

aliases { serial0 = &uart1; serial1 = &uart2; serial2 = &uart3; };

cpus { cpu@0 { compatible = "arm,arm1136jf-s"; }; };

soc { compatible = "ti,omap-infra"; mpu { compatible = "ti,omap2-mpu"; ti,hwmods = "mpu"; }; };

ocp { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges; ti,hwmods = "l3_main";

intc: interrupt-controller@1 { compatible = "ti,omap2-intc"; interrupt-controller; #interrupt-cells = <1>; };

uart1: serial@4806a000 { compatible = "ti,omap2-uart"; ti,hwmods = "uart1"; clock-frequency = <48000000>; };

uart2: serial@4806c000 { compatible = "ti,omap2-uart"; ti,hwmods = "uart2"; clock-frequency = <48000000>; };

uart3: serial@4806e000 { compatible = "ti,omap2-uart"; ti,hwmods = "uart3"; clock-frequency = <48000000>; }; };};

xin li14:

回复 Eggsy Pang:

同问

Eggsy Pang:

回复 user4662703:

请问您用的是哪个版本的SDK

user4662703:

回复 Eggsy Pang:

SDK版本?我们用的linux内核版本是3.2.0,是指这个吗?

user4662703:

回复 Eggsy Pang:

非常感谢!这样可以!

user1161658:

回复 user4662703:

使用SPI1配置DAC7760,CS的时序不匹配DAC7760的Latch,准备将SPI1的CS改为GPIO的方式片选DAC7760,怎么修改dts文件让SPI的cs信号采用GPIO的方式驱动?

user1490342:

回复 user1161658:

准备将SPI1的CS改为GPIO的方式片选DAC7760?",请问此问题有解码?"

user6099213:

回复 Eggsy Pang:

您好,原来读取ID时的时d1没有输出数据,d0能检测到输出指令。按着这个方法改了后,现在d1有输出信号,但是cs片选线和d1的信号一样,这是为什么?

赞(0)
未经允许不得转载:TI中文支持网 » 求助:AM335x在linux环境下,如何更改SPI1数据线SPI1_D0,SPI1_D1的方向?
分享到: 更多 (0)