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.

SK-AM62: SK-AM62 spidev support

Part Number: SK-AM62
Other Parts Discussed in Thread: SYSCONFIG

Hello,

Much like Emanuele in the related post, I am struggling with spidev on the SK-AM62. I have repeated their steps, enabling "User mode SPI device driver support" in the kernel and loading that, modifying the device tree as they did where the SPI0 pins that are routed to the expansion header have been added to both the pinmux and spi0 sections of the device tree, and have cross-compiled spidev_test and loaded that. The clock signal (pin 23 of the header) and chip select (CS0, pin 24 of the header) work properly.

In the device tree, I have set D0 as the output and D1 as the input

	main_spi0_pins_default: main-spi0-pins-default {
		pinctrl-single,pins = <
			AM62X_IOPAD(0x01C0, PIN_OUTPUT, 0) /* (B13) SPI0_D0 */
			AM62X_IOPAD(0x01C4, PIN_INPUT, 0)  /* (B14) SPI0_D1 */
			AM62X_IOPAD(0x01B4, PIN_OUTPUT, 0) /* (A13) SPI0_CS0 */
			AM62X_IOPAD(0x01BC, PIN_OUTPUT, 0) /* (A14) SPI0_CLK */			
		>;
	};

However, D0 seems to float at 0.5V and is noisy during the byte transmissions, while D1 appears to be the output pin and has shows the data that is supposed to be sent.

Did I misconfigure something in the device tree as the D0 and D1 lines are not behaving as I would expect.

Thank you for your time.

Regards,

Andy

  • Hi Andy,

    I am not sure what causes the issue, but can you please try to set "PIN_INPUT" on all the 4 SPI0 pins? This is what configured in SysConfig tool.

  • Hello - thank you for the reply. I did try that previously, as well as again right now, but unfortunately it results in the same behavior as the original issue.

    By the way, when I use SysConfig 1.15.0+2826, and select SPI0, Use Case = Controller SPI Full Duplex, the CLK line does switch to an input, but D0 and CS0 remain as output. Is there a different use case I should be using?

  • Hi Andy,

    However, D0 seems to float at 0.5V and is noisy during the byte transmissions, while D1 appears to be the output pin and has shows the data that is supposed to be sent.

    Do you have any SPI device attached to the SPI interface? On my SK-AM62, I don't have any SPI device attached, and I can see D0 and D1 are both float around 0.5v, but D0 reflects the data which are transmitted on D1 with much less altitude. I am not a hw expert but I thought this is just a signal reflection since there is no device attached to D0 and D1.

    Did I misconfigure something in the device tree as the D0 and D1 lines are not behaving as I would expect.

    What behavior do you expect?

  • I do not have any devices connected to the expansion header. I have an oscilloscope connected to the CLK and CS lines, and then the output of the peripheral which is apparently D1. I agree with you that D0 seems to just be radiating the signals of D1. If this was working, I was hoping to tie D0 and D1 together so I could test my SPI driver via loopback.

    As I configured the D0 pin to be an output and the D1 pin to be an input, I would have expected the D0 pin to act as a SPI MOSI line, and D1 to act as a SPI MISO line. So is there a way to configure which pin is the output and which is the input, or is this fixed somewhere else and the entry in the device tree doesn't matter?

  • Hi Andy,

    The kernel SPI driver by default configures D0 as the input, and D1 as the output. If you want to reverse the polarity, please add DT property "ti,pindir-d0-out-d1-in" to the main_spi0 node.

    BTY, I just read the following note in the AM62x TRM, so please set PIN_INPUT to the pinmux of SPI0_CLK pin.

  • That was it! Everything is working as I expect now. Thank you so much for the help!