gpt4 book ai didi

c - BBB - 使用设备树获取第二个 SPI 芯片选择时遇到问题

转载 作者:行者123 更新时间:2023-11-30 15:32:44 24 4
gpt4 key购买 nike

我很难让第二个芯片选择在 Beaglebone Black 上工作。

我在我的发行版(Angstrom,内核 3.8.13)中使用了/lib/firmware 中给出的 .dts:

/*
* Copyright (C) 2013 CircuitCo
*
* Virtual cape for SPI1 on connector pins P9.29 P9.31 P9.30 P9.28
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;
/plugin/;

/ {
compatible = "ti,beaglebone", "ti,beaglebone-black";

/* identification */
part-number = "BB-SPI1-01";
version = "00A0";

/* state the resources this cape uses */
exclusive-use =
/* the pin header uses */
"P9.31", /* spi1_sclk */
"P9.29", /* spi1_d0 */
"P9.30", /* spi1_d1 */
"P9.28", /* spi1_cs0 */
"P9.42", /* spi1_cs1 */
/* the hardware ip uses */
"spi1";

fragment@0 {
target = <&am33xx_pinmux>;
__overlay__ {
/* default state has all gpios released and mode set to uart1 */
bb_spi1_pins: pinmux_bb_spi1_pins {
pinctrl-single,pins = <
0x190 0x13 /* mcasp0_aclkx.spi1_sclk, OUTPUT_PULLUP | MODE3 */
0x194 0x33 /* mcasp0_fsx.spi1_d0, INPUT_PULLUP | MODE3 */
0x198 0x13 /* mcasp0_axr0.spi1_d1, OUTPUT_PULLUP | MODE3 */
0x19c 0x13 /* mcasp0_ahclkr.spi1_cs0, OUTPUT_PULLUP | MODE3 */
0x164 0x12 /* eCAP0_in_PWM0_out.spi1_cs1 OUTPUT_PULLUP | MODE2 */
>;
};
};
};

fragment@1 {
target = <&spi1>; /* spi1 is numbered correctly */
__overlay__ {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&bb_spi1_pins>;

#address-cells = <1>;
#size-cells = <0>;

cs-gpios = <&gpio4 17 0>, <&gpio1 7 0>;
spi1_0{
#address-cells = <1>;
#size-cells = <0>;

compatible = "spidev";

reg = <0>;
spi-max-frequency = <16000000>;
};


spi1_1{
#address-cells = <1>;
#size-cells = <0>;

compatible = "spidev";

reg = <1>;
spi-max-frequency = <16000000>;
};
};
};
};

我用 dtc 编译它并用 uEnv.txt 激活它:

capemgr.enable_partno=BB-SPI1-01

(HDMI 和 HDMIN Cape 均已禁用)

我在/dev/中显示了两个 SPI 设备:

/dev/spidev2.0  /dev/spidev2.1

并且引脚由 spi 接口(interface)使用,如下所示:

    root@beaglebone:~# cat $PINS | grep spi1
pin 89 (44e10964): 481a0000.spi (GPIO UNCLAIMED) function pinmux_bb_spi1_pins group pinmux_bb_spi1_pins
pin 100 (44e10990): 481a0000.spi (GPIO UNCLAIMED) function pinmux_bb_spi1_pins group pinmux_bb_spi1_pins
pin 101 (44e10994): 481a0000.spi (GPIO UNCLAIMED) function pinmux_bb_spi1_pins group pinmux_bb_spi1_pins
pin 102 (44e10998): 481a0000.spi (GPIO UNCLAIMED) function pinmux_bb_spi1_pins group pinmux_bb_spi1_pins
pin 103 (44e1099c): 481a0000.spi (GPIO UNCLAIMED) function pinmux_bb_spi1_pins group pinmux_bb_spi1_pins

而且模式很好:

pin 89 (44e10964) 00000012 pinctrl-single
pin 100 (44e10990) 00000013 pinctrl-single
pin 101 (44e10994) 00000033 pinctrl-single
pin 102 (44e10998) 00000013 pinctrl-single
pin 103 (44e1099c) 00000013 pinctrl-single

我成功地使用了一个C语言程序,该程序使用第一个芯片选择的第一个spidev(spidev2.0),但是当我使用spidev2.1时,引脚42上没有任何东西(MOSI,MISO和CLK正在工作) .

有什么想法吗?

提前致谢

最佳答案

我自己找到了答案:

引脚 42 很特殊,因为它连接到两个 I/O。因此,为了使用其中一个 I/O,您必须将另一个 I/O 作为输入。

来源:Beaglebone黑色系统引用手册http://www.digikey.com/web%20export/supplier%20content/ti_296/mkt/boards/BBB_SRM.pdf?redirected=1第 71 页。

但现在我有一个非常奇怪的问题...我将其发布在这里:Trouble with SPIDEV, device tree and .dtbo name with Beaglebone Black

关于c - BBB - 使用设备树获取第二个 SPI 芯片选择时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24078938/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com