问题描述
我正在开发自定义 PCBA,并试图弄清楚如何从 Linux 的 CPLD 读取定义的值。我在 AM335x 处理器和 MAX V CPLD 之间连接了一个 SPI 总线,其中在 CPLD 中定义了以下内容:
version : STD_LOGIC_VECTOR := x"0100"); --data width in bits
COMPONENT spi_slave
GENERIC ( cpol : STD_LOGIC := '0'; cpha : STD_LOGIC := '1'; d_width : INTEGER := 16 );
PORT
(
data : IN STD_LOGIC_VECTOR(d_width-1 DOWNTO 0);
sclk : IN STD_LOGIC;
ss_n : IN STD_LOGIC;
mosi : IN STD_LOGIC;
miso : OUT STD_LOGIC
);
END COMPONENT;
以下是设备树中的配置:
spi@481a0000 {
compatible = "ti,omap4-mcspi;
#address-cells = <0x1>;
#size-cells = <0x0>;
reg = <0x481a0000 0x400>;
interrupts = <0x7d>;
ti,spi-num-cs = <0x2>;
ti,hwmods = "spi1";
dmas = <0x2c 0x2a 0x0 0x2c 0x2b 0x0 0x2c 0x2c 0x0 0x2c 0x2d 0x0>;
dma-names = "tx0","rx0","tx1","rx1";
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <0x3c>;
ti,pindir-d0-out-d1-in;
cpld_spidev@0 {
status = "okay";
compatible = "linux,spidev";
spi-max-frequency = <0xf4240>;
reg = <0x0>;
};
};
我已经能够向spidev0.0发送消息,但是我收到的大部分信息都是垃圾。如何从 SPI 从设备取回 0x0100?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)