I wanted to perform a SPI loopback test on ECSPI3 of the IMX6ULLEVK board to make sure my devicetree is correct and the SPI is working. I can see the /dev/spidev2.0 and I have shorted the MISO and MOSI on the IMX6ULLEVK's arduino header J1703, and when I run the spidev_test I am not receiving the string which I am sending as below
root@xxxx~# spidev_test -D /dev/spidev2.0 -v -p "Hello World"
spi mode: 0x0
bits per word: 8
max speed: 500000 Hz (500 kHz)
TX | 48 65 6C 6C 6F 20 57 6F 72 6C 64 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |Hello World|
RX | FF FF FF FF FF FF FF FF FF FF FF __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ |...........|
and my devicetree for the corresponding is below
&iomuxc {pinctrl_ecspi3: ecspi3grp {fsl,pins = <MX6UL_PAD_UART2_RTS_B__ECSPI3_MISO 0x100b1MX6UL_PAD_UART2_CTS_B__ECSPI3_MOSI 0x100b1MX6UL_PAD_UART2_RX_DATA__ECSPI3_SCLK 0x100b1MX6UL_PAD_UART2_TX_DATA__ECSPI3_SS0 0x100b1>;};};&ecspi3 {pinctrl-names = "default";pinctrl-0 = <&pinctrl_ecspi3>;status = "okay";fsl,spi-num-chipselects = <1>;spidev@0 {reg = <0>;compatible = "rohm,dh2228fv";spi-max-frequency = <20000000>;};};
when I generate the iomux value for the ecspi3 using the nxpconfig tool, the values were
MX6UL_PAD_UART2_CTS_B__ECSPI3_MOSI 0x000010B0
MX6UL_PAD_UART2_RTS_B__ECSPI3_MISO 0x000010B0
MX6UL_PAD_UART2_RX_DATA__ECSPI3_SCLK 0x000010B0
MX6UL_PAD_UART2_TX_DATA__ECSPI3_SS0 0x000010B0
I tried changing to the PAD values to 0x000010B0, still FF FF FF on the loopback test. Can someone lead me whether something is wrong or missing?
Info: Using linux-imx 5.15.71 kernel
Thanks in advance!!!
Solved! Go to Solution.
Hello,
As I said before, please note that UART2_CTS =/= UART2_CTS_BB, I don't know if this is documented, because UART2_CTS_BB is not an actual mux, UART2_CTS is, it's just a name conveniently used when designing the base board.
You'll need to pay close attention to the actual pins and the muxed option, please take a look to the schematic SODIMM 200 connector:
Also, I believe that using ECSPI3 on the EVK may be difficult since all its muxing options are already on use, if you wish to test ECSPI I would recommend using ECSPI4 instead and populate the 0ohm resistors.
Best regards/Saludos,
Aldo.
Hello,
Please note that UART2_CTS and UART2_RTS are not rooted to the arduino header.
UART2_CTS_BB is rooted to UART3_TXD and UART2_RTS_BB to UART3_RXD, so your device tree is not muxed correctly.
Best regards,
Aldo.
Hello AldoG,
Thanks for your reply!!!
What I understood from the IMX6ULLEVK schematics of Arduino header J1703 above is
1. D0 of J1703 is connected to UART2_RXD (ALT8 is ECSPI3_SCLK)
2. D1 of J1703 is connected to UART2_TXD (ALT8 is ECSPI3_SS)
3. D2 of J1703 is connected to UART2_RTS_BB (ALT8 is ECSPI3_MISO)
4. D3 of J1703 is connected to UART2_CTS_BB (ALT8 is ECSPI3_MOSI)
"UART2_CTS and UART2_RTS are not rooted to the arduino header. UART2_CTS_BB is rooted to UART3_TXD and UART2_RTS_BB to UART3". --> Please can you explain a little bit more on this? where can I see this information?
Is it possible for you to give me the MUX configuration for ECSPI3 for doing SPI loopback test by connecting D2 and D3 of J1703?
Thanks in advance !!!
Hello,
As I said before, please note that UART2_CTS =/= UART2_CTS_BB, I don't know if this is documented, because UART2_CTS_BB is not an actual mux, UART2_CTS is, it's just a name conveniently used when designing the base board.
You'll need to pay close attention to the actual pins and the muxed option, please take a look to the schematic SODIMM 200 connector:
Also, I believe that using ECSPI3 on the EVK may be difficult since all its muxing options are already on use, if you wish to test ECSPI I would recommend using ECSPI4 instead and populate the 0ohm resistors.
Best regards/Saludos,
Aldo.
Hello AldoG,
Thank you for the clear explanation and I misinterpreted the schematics.
I made the spi loopback test to work after switching from ecspi3 to ecspi4 also with removal of 0ohm resistors on R1633, R1634, R1635, R1636 and mounting them on R1724, R1725, R1726, R1727.
Thanks again!!!