Hi,
I am new to Linux and AM437x.
I have a AM437x Starter Kit (with Linux SDK) and I would like to know how to use SPI on this device/board.
Thanks.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Biser,
To make my question simple, my intention is to use SPI2 through J10 connector.
Please let me know if you need further clarification.
Thanks.
Hi Tsvetolin,
Thanks for the information.
As the SPI2 was not configured in the .dts file, I added the following lines of code in it:
&am43xx_pinmux {
/******************************/
spi2_pins: spi2_pins {
pinctrl-single,pins = <
0x260 (PIN_OUTPUT_PULLUP | MUX_MODE0)
0x264 (PIN_INPUT_PULLUP | MUX_MODE0)
0x268 (PIN_INPUT_PULLUP | MUX_MODE0)
0x26c (PIN_OUTPUT_PULLUP | MUX_MODE0)
>;
};
/******************************/
};
&spi2 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&spi2_pins>;
spidev@0 {
spi-max-frequency = <24000000>;
reg = <0>;
compatible = "linux,spidev";
};
I then compiled the .dts file and a new .dtb file is generated.
But I don't see the SPI drivers in the $evm/dev.
Please let me know if my approach is correct and which other files should I edit to enable SPI2. And, how to know if the SPI2 is enabled other than looking at the $evm/dev/ ?
Thanks,
Hi,
I still not able to make the SPI2 on this board working. Please help me in this regard.
Following are the changes I made in the .dts file:
spi2_pins: spi2_pins { pinctrl-single,pins = < 0x260 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* spi_sclk */ 0x264 (PIN_OUTPUT_PULLUP | MUX_MODE0) /* spi_MOSI */ 0x268 (PIN_INPUT_PULLUP | MUX_MODE0) /* spi_MISO */ 0x26c (PIN_OUTPUT_PULLUP | MUX_MODE0) /* spi_cs */ >; }; &spi2 { #address-cells = <1>; #size-cells = <0>; status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&spi2_pins>; spidev@0 { #address-cells = <1>; #size-cells = <0>; compatible = "spidev"; reg = <0>; spi-max-frequency = <16000000>; spi-cpha; }; };
I can see spidev1.0 in the root@am437x-evm:/dev# .
I used the spidev_test.c program to test the SPI2 interface.
Pins 3 and 5 of the J10 are shorted to make a loop back connection.
But I haven't received the expected data, but all 00s.
Could anyone please help me how to enable SPI2 and work with it on this particular board?
Thanks.