New symlink for spidev0.0

Dear Support,

I am using the imx8 mini with verdin development board.

Since I added the spidev0.0 to the DT, do I need to create a symlink to the dev directory to use it? like verdin-spi-cs0 for spidev1.0?

If Yes, I created a new symlink for spidev0.0 called spisample, but I dont have any SPI signals, and it will disappear after restarting.
I used command below :

> sudo ln -s spidev0.0 spisample

Thanks for your info.
Best regards,
Mehrdad

Greetings @Mehrdad,

Since I added the spidev0.0 to the DT, do I need to create a symlink to the dev directory to use it?

Symlinks are not required to use SPI or any of the interfaces We only add such symlinks ourselves for better naming than the default names for these interfaces.

I was looking at your previous question where you did your device tree changes to add this additional SPI: Modification pins on the Device Tree

In particular I was looking at this device tree change you made here:

/* Verdin SPI_2 TODO_MS */
&ecspi1 {
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart3 >;
	cs-gpios = <&gpio5 9 GPIO_ACTIVE_LOW>;
};

You set the pinctrl-0 node to use the pinctrl_uart3 pins. However, I don’t see where you redefined these pins to be configured for SPI functionality. This is the pinctrl node here:

pinctrl_uart3: uart3grp {
		fsl,pins = <
			MX8MM_IOMUXC_ECSPI1_SCLK_UART3_DCE_RX		0x146	/* SODIMM 137 */
			MX8MM_IOMUXC_ECSPI1_MOSI_UART3_DCE_TX		0x146	/* SODIMM 139 */
			MX8MM_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B	0x146	/* SODIMM 141 */
			MX8MM_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B		0x146	/* SODIMM 143 */
		>;
	};

As you can see the pins defined here are configured for UART functionality. You need to change/redefine these pins for SPI functionality.

As a reference see the pinctrl_ecspi2 node that is used by the default SPI interface:

pinctrl_ecspi2: ecspi2grp {
		fsl,pins = <
			MX8MM_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK		0x6	/* SODIMM 196 */
			MX8MM_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI		0x6	/* SODIMM 200 */
			MX8MM_IOMUXC_ECSPI2_MISO_ECSPI2_MISO		0x6	/* SODIMM 198 */
			MX8MM_IOMUXC_ECSPI2_SS0_GPIO5_IO13		0x6	/* SODIMM 202 */
		>;
	};

Best Regards,
Jeremias

1 Like

Hi @jeremias.tx ,

Thank you so much, I did set the fsl for 0x6 before, but there was no signal, I did not know that I had to change the pins as well, so the new configuration should be like below, I can confirm that the SPI1 is working :slight_smile:

pinctrl_uart3: uart3grp {
fsl,pins = <
MX8MM_IOMUXC_ECSPI1_SCLK_ECSPI1_SCLK 0x6 /* SODIMM 137 was 0x146 /
MX8MM_IOMUXC_ECSPI1_MOSI_ECSPI1_MOSI 0x6 /
SODIMM 139 was 0x146 /
MX8MM_IOMUXC_ECSPI1_MISO_ECSPI1_MISO 0x6 /
SODIMM 141 was 0x146 /
MX8MM_IOMUXC_ECSPI1_SS0_ECSPI1_SS0 0x6 /
SODIMM 143 was 0x146*/
;
};

Last question @jeremias.tx , for using UART3, I want to use GPIO3 and GPIO4 for Tx and Rx, and which pins do I have to use?

MX8MM_IOMUXC_UART3_RXD_UART3_DCE_RX
MX8MM_IOMUXC_UART3_RXD_UART3_DTE_TX
MX8MM_IOMUXC_UART3_RXD_UART1_DCE_CTS_B
MX8MM_IOMUXC_UART3_RXD_UART1_DTE_RTS_B
MX8MM_IOMUXC_UART3_RXD_GPIO5_IO26
MX8MM_IOMUXC_UART3_RXD_TPSMP_HDATA28
MX8MM_IOMUXC_UART3_TXD_UART3_DCE_TX
MX8MM_IOMUXC_UART3_TXD_UART3_DTE_RX
MX8MM_IOMUXC_UART3_TXD_UART1_DCE_RTS_B
MX8MM_IOMUXC_UART3_TXD_GPIO5_IO27
MX8MM_IOMUXC_UART3_TXD_TPSMP_HDATA29

I guess should be like below?

		fsl,pins = <
			MX8MM_IOMUXC_UART3_RXD_UART3_DCE_RX		0x146	
			MX8MM_IOMUXC_UART3_TXD_UART3_DCE_TX		0x146	

		>;
	};

Thank you so much for taking your time.
Best regards,
Mehrdad

That pin configuration looks correct at least when you compare to the other pinctrl_uart* nodes.

One final note pins GPIO3 and GPIO4 are already defined here: imx8mm-verdin.dtsi « freescale « dts « boot « arm64 « arch - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

You should remove them from this pinctrl-0 node that I linked above just to ensure there are no conflicts. This will guarantee they will only be used for UART functionality.

Best Regards,
Jeremias

1 Like

Hello @Mehrdad ,
Did the solution from @jeremias.tx work for you?

Best regards,
Josep

1 Like

Hi Team,

Yes, and I really appreciate your SUPPORT.

I hope you have a wonderful time.

Best regards,
Mehrdad