spidev无法控制芯片选择信号

时间:2022-08-08 09:25:24

I use kernel 3.12.rc4 on an embedded linux device (olimex imx233 micro). My aim is to use /dev/spidev to be able to communicate with another spi device.

我在嵌入式Linux设备(olimex imx233 micro)上使用内核3.12.rc4。我的目标是使用/ dev / spidev能够与另一个spi设备通信。

I edit arch/arm/boot/dts/imx23-olinuxino.dts as:

我编辑arch / arm / boot / dts / imx23-olinuxino.dts为:

ssp1: ssp@80034000 {
  #address-cells = <1>;
  #size-cells = <0>;
  compatible = "fsl,imx23-spi";
  pinctrl-names = "default";
  pinctrl-0 = <&spi2_pins_a>;
  clock-frequency = <1000000>;
  status = "okay";

  spidev: spidev@0 {
    compatible = "spidev";
    spi-max-frequency = <1000000>;
    reg = <1>;
  };
};

arch/arm/boot/dts/imx23.dtsi: has this config

arch / arm / boot / dts / imx23.dtsi:有这个配置

spi2_pins_a: spi2@0 {
  reg = <0>;
  fsl,pinmux-ids = <
    0x0182 /* MX23_PAD_GPMI_WRN__SSP2_SCK */
    0x0142 /* MX23_PAD_GPMI_RDY1__SSP2_CMD */
    0x0002 /* MX23_PAD_GPMI_D00__SSP2_DATA0 */
    0x0032 /* MX23_PAD_GPMI_D03__SSP2_DATA3 */
  >;
  fsl,drive-strength = <1>;
  fsl,voltage = <1>;
  fsl,pull-up = <1>;
};

Device binding looks correct. When I compile the kernel I get the /dev/spidev1.1. After that I use spidev_test.c and monitor the pins by an oscilloscope. The SCK and MOSI output signals correctly, however, the chipselect is set to the logic high even during the data transfer.

设备绑定看起来正确。当我编译内核时,我得到了/dev/spidev1.1。之后我使用spidev_test.c并通过示波器监控引脚。 SCK和MOSI输出信号正确,但是,即使在数据传输期间,chipselect也设置为逻辑高电平。

Is there any way to determine why spidev cannot set to logic low during the transmission? It seems like either additional things needs to be passed on kernel or there is an issue on spidev that cannot control the chip select . I wonder if I need to change anything on the spidev.h or spidev.c on the driver/spi directory of the kernel? or how can I solve it?

有没有办法确定spidev在传输过程中无法设置为逻辑低的原因?似乎需要在内核上传递额外的东西,或者在spidev上存在无法控制芯片选择的问题。我想知道我是否需要在内核的驱动程序/ spi目录上更改spidev.h或spidev.c上的任何内容?或者我该如何解决?

The reference manual for the processor

处理器的参考手册

1 个解决方案

#1


5  

I never used device tree, but I try to help you anyway.

我从未使用过设备树,但无论如何我都会尽力帮助你。

The kernel create the device /dev/spidev1.1, so spidev is connected to SPI bus 1, chip select 1. The chip select numeration start from 0, and you do not have any other device associated to SPI bus 1.

内核创建设备/dev/spidev1.1,因此spidev连接到SPI总线1,芯片选择1.芯片选择编号从0开始,并且没有任何其他设备与SPI总线1相关联。

As far as I know reg = <1> tell to the SPI core that spidev is connected to chip select 1., but maybe your device is connected to the chip select 0. So, reg = <0>

据我所知reg = <1>告诉SPI内核spidev连接到芯片选择1.,但也许你的设备连接到芯片选择0.所以,reg = <0>

#1


5  

I never used device tree, but I try to help you anyway.

我从未使用过设备树,但无论如何我都会尽力帮助你。

The kernel create the device /dev/spidev1.1, so spidev is connected to SPI bus 1, chip select 1. The chip select numeration start from 0, and you do not have any other device associated to SPI bus 1.

内核创建设备/dev/spidev1.1,因此spidev连接到SPI总线1,芯片选择1.芯片选择编号从0开始,并且没有任何其他设备与SPI总线1相关联。

As far as I know reg = <1> tell to the SPI core that spidev is connected to chip select 1., but maybe your device is connected to the chip select 0. So, reg = <0>

据我所知reg = <1>告诉SPI内核spidev连接到芯片选择1.,但也许你的设备连接到芯片选择0.所以,reg = <0>