Tool/software:
I am using the OSD3358-SM-RED development board to do some SPI testing and am really confused.
This is my first time working with the AM3358 device. This is also my first post so I apologize if it is lacking information or in the wrong category. Please ask me questions on things I have missed and/or move it to a different thread.
We are using a kernel from the Yocto Warrior release (I know it is old, but it was easy for us to get the board to boot). The kernel version is 5.0.13.
I have added the following to the device tree after using the pinmux tool and referring to the various technical reference manuals.
&spi1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&myspi1_pins_default>;
num-chipselects = <1>;
is-decoded-cs = <0>;
spi@0 {
compatible = "linux,spidev";
spi-max-frequency = <48000000>;
reg = <0>;
};
myspi1_pins_default: myspi1-default-pins {
pinctrl-single,pins = <
/* Pins that are assigned to SPI1 */
AM33XX_IOPAD(0x990, PIN_OUTPUT | MUX_MODE3) /* (A1:A13) mcasp0_aclkx.spi1_sclk - SPI1_SCLK */
AM33XX_IOPAD(0x994, PIN_INPUT | MUX_MODE3) /* (A2:B13) mcasp0_fsx.spi1_d0 - SPI1_D0 */
AM33XX_IOPAD(0x998, PIN_OUTPUT | MUX_MODE3) /* (B2:D12) mcasp0_axr0.spi1_d1 - SPI1_D1 */
AM33XX_IOPAD(0x99c, PIN_OUTPUT | MUX_MODE3) /* (B1:C12) mcasp0_ahclkr.spi1_cs0 - SPI1_CS0 */
>;
};
I configured the device tree to bring out the 4 signals (clk, mosi, miso and cs) to one of the Cape Headers on the development board. I have an analyzer connected to the clk and the mosi line. I also have the mosi and miso lines connected together so everything should be getting looped back.
When I boot the processor using the above device tree I do get a SPI device created (/dev/spidev1.0). I pulled down spidev_test.c (https://github.com/rm-hull/spidev-test/blob/master/spidev_test.c) and used it to test my configuration. Using the analyzer and bits_per_word set to 32, I see the correct number of clocks (32) and the correct data being driven out. However no matter what I try, I continually get 0 back.(spidev_test always indicates 0 is being transferred in). I have also tied the miso pin and still read nothing.
Since I am a newbie in this area I am not sure what to try next. It seems like everything is configured correctly but I am most likely missing something. No matter what I try I don't get anything being fed back to spidev_test. Any suggestion on what to try would be very beneficial. Again sorry if the above is lacking in detail. Please ask question and I will follow-up with more information.
Thank you in advance for your support and ideas.