2015-01-30 10 views
1

BBB에서 SPI를 활성화하는 데 문제가 있습니다. tutorial from the hipstercircuits.com. uSD에 새로운 아치 리눅스를 설치했습니다. 사실 eMMC에서 시스템을 엉망으로 만든 경우에 대비해.Beaglebone black (BBB) ​​Rev C 3.8.13-38-ARCH SPI가 작동하지 않습니다. 부적절한 장치 용 ioctl

내 설정은 다음과 같습니다 SPI1는 HDMI I 장애인 아무것도 HDMI 관련 문제를 가지고 있기 때문에

내가 찾은. fdfile 입력에 대해 확실하지 않지만 웹에서 찾을 수 있습니다. (나는 그것도없이 노력했다.) 현재 나는 SD 카드를 다루고있다.

uEnv.txt

optargs=quiet coherent_pool=1M fdtfile=am335x-boneblack.dtb capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN 

나는 DTS는 hipstercircuits.com에서 바로 파일을 가져다가 팩맨을 통해 설치된 알람/DTC 오버레이 1.4.1-1로 컴파일.

uEnv.txt에 HDMI를 해제 한 후

[[email protected] ~]# echo BB-SPI1-01 > /sys/devices/bone_capemgr.*/slots 

괜찮 가서 나는 보았다

[[email protected] ~]# cat /sys/devices/bone_capemgr.9/slots 
0: 54:PF--- 
1: 55:PF--- 
2: 56:PF--- 
3: 57:PF--- 
4: ff:P-O-L Bone-LT-eMMC-2G,00A0,Texas Instrument,BB-BONE-EMMC-2G 
5: ff:P-O-- Bone-Black-HDMI,00A0,Texas Instrument,BB-BONELT-HDMI 
6: ff:P-O-- Bone-Black-HDMIN,00A0,Texas Instrument,BB-BONELT-HDMIN 
7: ff:P-O-L Override Board Name,00A0,Override Manuf,BB-SPI1-01 

가 나는 또한 BB-SPIDEV0, BB-SPIDEV1 및 BB-SPIDEV1A1을 울리는 시도 여기에서 찾을 :

[[email protected] spi_a]# ls -l /lib/firmware | grep SPI 
    -rw-r--r-- 1 root root 1351 Jan 29 17:04 BB-SPI1-01-00A0.dtbo 
    -rw-r--r-- 1 root root 1185 Jan 25 01:06 BB-SPIDEV0-00A0.dtbo 
    -rw-r--r-- 1 root root 1185 Jan 25 01:06 BB-SPIDEV1-00A0.dtbo 
    -rw-r--r-- 1 root root 1185 Jan 25 01:06 BB-SPIDEV1A1-00A0.dtbo 

spidev_test의 결과는 항상 같습니다.

내가 pingroups에서 SPI1의 일부 등 P9_29, P9_31에 대한 아무것도 보지 않았다 더 흥미로운 무엇 :

[[email protected] ~]# cat /sys/kernel/debug/pinctrl/44e10800.pinmux/pingroups 
registered pin groups: 
group: pinmux_userled_pins 
pin 21 (44e10854) 
pin 22 (44e10858) 
pin 23 (44e1085c) 
pin 24 (44e10860) 

group: pinmux_rstctl_pins 
pin 20 (44e10850) 

group: pinmux_i2c0_pins 
pin 98 (44e10988) 
pin 99 (44e1098c) 

group: pinmux_i2c2_pins 
pin 94 (44e10978) 
pin 95 (44e1097c) 

group: pinmux_mmc1_pins 
pin 88 (44e10960) 

group: pinmux_emmc2_pins 
pin 32 (44e10880) 
pin 33 (44e10884) 
pin 0 (44e10800) 
pin 1 (44e10804) 
pin 2 (44e10808) 
pin 3 (44e1080c) 
pin 4 (44e10810) 
pin 5 (44e10814) 
pin 6 (44e10818) 
pin 7 (44e1081c) 

group: pinmux_userled_pins 
pin 21 (44e10854) 
pin 22 (44e10858) 
pin 23 (44e1085c) 
pin 24 (44e10860) 

spidevs는/dev에

[[email protected] ~]# ls -l /dev | grep spi 
crw------- 1 root root 153, 1 Jan 29 17:13 spidev1.0 
crw------- 1 root root 153, 0 Jan 29 17:13 spidev1.1 

의 존재를 인터페이스를 테스트하기 위해 튜토리얼에서 언급 한 python 메소드와 BBB에서 컴파일 된 spidev_test.c (spidev_test.c)가 사용되었습니다.

[[email protected] ~]# gcc spidev_test.c -o spidev_test 

파이썬 라이브러리의 경우 출력에는 오류가 없으며 SCL 라인의 클럭 신호도 없습니다.

spidev_test 반환 :

[[email protected] spi_a]# ./spidev_test 
can't set spi mode: Inappropriate ioctl for device 
Aborted (core dumped) 
[[email protected] spi_a]# ./spidev_test -D /dev/spidev1.0 
can't set spi mode: Inappropriate ioctl for device 
Aborted (core dumped) 
[[email protected] spi_a]# ./spidev_test -D /dev/spidev1.1 
can't set spi mode: Inappropriate ioctl for device 
Aborted (core dumped) 

내가 * .dts와 * hipstercircuit의 튜토리얼의 시작 부분에 제공 .dtb 파일을 사용할 수 있도록해야합니까?

나는 쉽게 sth를 망쳤습니다. 어떤 아이디어였습니까? 그렇게 작동 시키셨습니까? 모든 조언을 환영하며 매우 감사하겠습니다! ;)

답변

0

이 .dts를 사용하여 spidev_test.c에서 spidev1.0과 spidev1.1 모두 잘 작동했습니다. linux documentation에는 SPI1에서 사용되는 두 번째 칩 선택을 허용하고 핀 42에서 GPIO를 올바르게 구성 할 수있는 라인이 있습니다.

이제는 spi 핀이 올바르게 다중화되는 것을 볼 수 있습니다.

/* 
* 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"; 

[email protected] { 
    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 0x33 /* mcasp0_aclkx.spi1_sclk, INPUT_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 */ 
       0x1A0 0x32 /* Other P42 pin, INPUT_PULLUP */ 
      >; 
     }; 
    }; 
}; 

[email protected] { 
    target = <&spi1>; /* spi1 is numbered correctly */ 
    __overlay__ { 
     status = "okay"; 
     pinctrl-names = "default"; 
     pinctrl-0 = <&bb_spi1_pins>; 

     #address-cells = <1>; 
     #size-cells = <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>; 
     }; 
    }; 
};}; 
0

문제는 ioctl.h라고 생각합니다.

내가 'iotl.h'에 대한 검색 결과가

/usr/include/arm-linux-gnueabihf/sys/ioctl.h 
/usr/include/arm-linux-gnueabihf/asm/ioctl.h 
/usr/include/linux/ioctl.h 
/usr/include/linux/hdlc/ioctl.h 
/usr/include/linux/mmc/ioctl.h 
/usr/include/asm-generic/ioctl.h 

그래서 해당하는 SYS/ioctl.h 내가 올바른 ioctl.h을 찾기 위해 노력하지하고있다가, 다음과 같다