Other Parts Discussed in Thread: AM4372
Tool/software: Linux
Hi Everybody!
I recently got my spidev devices registered in /dev (see here for details).
My devices don't seem to work unfortunately. I have only scoped out spidev1.1 so far. I can open the device. When I configre it I do get messages complaining about not using DMA (see below). And then I get a TXS timed out message.
I am using a program really similar to this one. I just added a ton of printing and slowed things down so that I could tell which actions were causing the system log messages.
Here is the output.
root@am437x-evm:/ace/bin# ./helloSpi -C 301
helloSpi ...
...Options selected
device = /dev/spidev1.1
speed = 24000000
delay = 0
bits = 8
mode = 0x04
...Creating device
...Setting SPI option
...Opening file handle
...Committing options <-- 3 ioctl calls in here
[62332.673461] spidev spi1.1: not using DMA for McSPI (-19)
[62332.678907] spidev spi1.1: not using DMA for McSPI (-19)
[62332.689027] spidev spi1.1: not using DMA for McSPI (-19)
...Setting up data transfer
TX = 0x03 0x01 0x00 0x00 0x00 0x00 0x00 0x00
RX = 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
...Performing ioctl data transfer <-- 1 ioctl call in here
[62340.712144] spidev spi1.1: TXS timed out
...Receive buffer
RX = 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Good bye!
I had our electrical team scope the clk, miso, mosi, and cs pin for spidex1.1 and there is no activity.
I also see the cs pin held low the entire time. I think it should only go low when the spi master wants to send data to or retrieve data from that particular device.
Here is my pin mux...
spi2_internal_pins_default: spi2_internal_pins_default {
pinctrl-single,pins = <
0x260 ( PIN_OUTPUT | INPUT_EN | MUX_MODE0 ) /* (N20) spi2_sclk.spi2_sclk */
0x264 ( PIN_OUTPUT | MUX_MODE0 ) /* (P22) spi2_d0.spi2_d0 */
0x268 ( PIN_INPUT_PULLUP | MUX_MODE0 ) /* (P20) spi2_d1.spi2_d1 */
0x1b0 ( PIN_OUTPUT | MUX_MODE4 ) /* (AE17) cam0_hd.spi2_cs1 */
0x1c4 ( PIN_OUTPUT | MUX_MODE4 ) /* (AB19) cam0_data8.spi2_cs2 */
>;
}
&spi2 {
compatible = "ti,omap2-mcspi";
pinctrl-names = "default";
pinctrl-0 = <&spi2_internal_pins_default>;
status = "okay";
ti,spi-num-cs = <4>;
ti,pindir-d0-out-d1-in = <1>;
ksz8895@1 {
compatible = "rohm,dh2228fv";
spi-max-frequency = <100000>;
reg = <0x1>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
};
ksz8895@2 {
compatible = "rohm,dh2228fv";
spi-max-frequency = <100000>;
reg = <0x2>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
};
};
Here are (what I think are pertinent) defconfig settings. In fact here's everything SPI related. I highlighted the ones I think actually matter
root@am437x-evm:/ace/bin# cat /proc/config.gz|gunzip|grep SPI|grep \# -v|grep SPIN -v
CONFIG_REGMAP_SPI=y
CONFIG_MTD_SPI_NOR=y
CONFIG_SPI_CADENCE_QUADSPI=y
CONFIG_WLCORE_SPI=m
CONFIG_INPUT_ADXL34X_SPI=m
CONFIG_SPI=y
CONFIG_SPI_MASTER=y
CONFIG_SPI_BITBANG=m
CONFIG_SPI_GPIO=m
CONFIG_SPI_OMAP24XX=y
CONFIG_SPI_TI_QSPI=y
CONFIG_SPI_SPIDEV=y
CONFIG_SND_SOC_I2C_AND_SPI=y
CONFIG_RTC_I2C_AND_SPI=y
I've seen various posts about differing pinmux settings. I've seen Biser say the clk needs to be an input (I tried, no change), I've seen another post that said they had success with clk as output with input_en flag. So I'm not sure what is the "right" answer.
All thoughts/suggestions/troubleshooting tips are welcome.
Thanks in advance!
Nathan