NRF52840 Lan8651

Hello, I'm trying to use the Lan865x (two-wire eth click) chip with the nrf52840dk board, using zephyr 3.7. I'm getting always this error while trying a net sample code : <err> oa_tc6: Header transmission error! <err> eth_lan865x: SPI communication not working, -19 .

here my device DT :

&spi3 { compatible = "nordic,nrf-spim"; status = "okay"; // Enable the SPI interface cs-gpios = <&gpio1 10 GPIO_ACTIVE_LOW>; pinctrl-0 = <&spi3_default>; pinctrl-1 = <&spi3_sleep>; pinctrl-names = "default", "sleep"; lan865x: lan865x@0 { status = "okay"; compatible = "microchip,lan865x"; spi-max-frequency = <20000000>; local-mac-address = [00 19 05 00 00 04]; reg = <0>; rst-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>; int-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; plca-enable; plca-node-id = <3>; plca-node-count = <8>; plca-burst-count = <0x0>; plca-burst-timer = <0x80>; plca-to-timer = <0x20>; }; };

I can see that the clock and the MOSI are working with the osciloscope but no data from the LAN865x to the nordic board, even thouth I've tested the lan865x with a raspberry and linux driver and it's working fine, any insights would be helpful, thanks.

Best regards,

  • Hi,

    I don't have experience with Lan865x but I expect it should be possible to get it to work. Can you share the device treein a more readable way (you can add code blocks using Inster -> Code). Please add also add the pinctrl configuration where you set the SPI pins? It could also be intersting to see the plot from the oscilliscope/logic analyzer.

  • Hi Einar

    Here the DT that I've used : 

    &arduino_spi {
    
        status = "okay";
        lan865x: lan865x@0 {
    		status = "okay";
    		compatible = "microchip,lan865x";
    		spi-max-frequency = <20000000>;
    		local-mac-address = [00 19 05 00 00 04];
    		reg = <0>;
    		rst-gpios = <&gpio0 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
    	        int-gpios = <&gpio0 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
    	        plca-enable;
                    plca-node-id = <3>;
                    plca-node-count = <8>;
                    plca-burst-count = <0x0>;
                    plca-burst-timer = <0x80>;
                    plca-to-timer = <0x20>;
    
      };
    };
    
    

    for the pinctl in the dtsi file : 

    /*
     * Copyright (c) 2022 Nordic Semiconductor
     * SPDX-License-Identifier: Apache-2.0
     */
    
    &pinctrl {
    	uart0_default: uart0_default {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 6)>,
    				<NRF_PSEL(UART_RTS, 0, 5)>;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_RX, 0, 8)>,
    				<NRF_PSEL(UART_CTS, 0, 7)>;
    			bias-pull-up;
    		};
    	};
    
    	uart0_sleep: uart0_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_TX, 0, 6)>,
    				<NRF_PSEL(UART_RX, 0, 8)>,
    				<NRF_PSEL(UART_RTS, 0, 5)>,
    				<NRF_PSEL(UART_CTS, 0, 7)>;
    			low-power-enable;
    		};
    	};
    
    	uart1_default: uart1_default {
    		group1 {
    			psels = <NRF_PSEL(UART_RX, 1, 1)>;
    			bias-pull-up;
    		};
    		group2 {
    			psels = <NRF_PSEL(UART_TX, 1, 2)>;
    		};
    	};
    
    	uart1_sleep: uart1_sleep {
    		group1 {
    			psels = <NRF_PSEL(UART_RX, 1, 1)>,
    				<NRF_PSEL(UART_TX, 1, 2)>;
    			low-power-enable;
    		};
    	};
    
    	i2c0_default: i2c0_default {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
    				<NRF_PSEL(TWIM_SCL, 0, 27)>;
    		};
    	};
    
    	i2c0_sleep: i2c0_sleep {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 0, 26)>,
    				<NRF_PSEL(TWIM_SCL, 0, 27)>;
    			low-power-enable;
    		};
    	};
    
    	i2c1_default: i2c1_default {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
    				<NRF_PSEL(TWIM_SCL, 0, 31)>;
    		};
    	};
    
    	i2c1_sleep: i2c1_sleep {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 0, 30)>,
    				<NRF_PSEL(TWIM_SCL, 0, 31)>;
    			low-power-enable;
    		};
    	};
    
    	pwm0_default: pwm0_default {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 13)>;
    			nordic,invert;
    		};
    	};
    
    	pwm0_sleep: pwm0_sleep {
    		group1 {
    			psels = <NRF_PSEL(PWM_OUT0, 0, 13)>;
    			low-power-enable;
    		};
    	};
    
    	spi0_default: spi0_default {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 26)>,
    				<NRF_PSEL(SPIM_MISO, 0, 29)>;
    		};
    	};
    
    	spi0_sleep: spi0_sleep {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 27)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 26)>,
    				<NRF_PSEL(SPIM_MISO, 0, 29)>;
    			low-power-enable;
    		};
    	};
    
    	spi1_default: spi1_default {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 30)>,
    				<NRF_PSEL(SPIM_MISO, 1, 8)>;
    		};
    	};
    
    	spi1_sleep: spi1_sleep {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 31)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 30)>,
    				<NRF_PSEL(SPIM_MISO, 1, 8)>;
    			low-power-enable;
    		};
    	};
    
    	spi2_default: spi2_default {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 19)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 20)>,
    				<NRF_PSEL(SPIM_MISO, 0, 21)>;
    		};
    	};
    
    	spi2_sleep: spi2_sleep {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 0, 19)>,
    				<NRF_PSEL(SPIM_MOSI, 0, 20)>,
    				<NRF_PSEL(SPIM_MISO, 0, 21)>;
    			low-power-enable;
    		};
    	};
    
    	qspi_default: qspi_default {
    		group1 {
    			psels = <NRF_PSEL(QSPI_SCK, 0, 19)>,
    				<NRF_PSEL(QSPI_IO0, 0, 20)>,
    				<NRF_PSEL(QSPI_IO1, 0, 21)>,
    				<NRF_PSEL(QSPI_IO2, 0, 22)>,
    				<NRF_PSEL(QSPI_IO3, 0, 23)>,
    				<NRF_PSEL(QSPI_CSN, 0, 17)>;
    			nordic,drive-mode = <NRF_DRIVE_H0H1>;
    		};
    	};
    
    	qspi_sleep: qspi_sleep {
    		group1 {
    			psels = <NRF_PSEL(QSPI_SCK, 0, 19)>,
    				<NRF_PSEL(QSPI_IO0, 0, 20)>,
    				<NRF_PSEL(QSPI_IO1, 0, 21)>,
    				<NRF_PSEL(QSPI_IO2, 0, 22)>,
    				<NRF_PSEL(QSPI_IO3, 0, 23)>;
    			low-power-enable;
    		};
    		group2 {
    			psels = <NRF_PSEL(QSPI_CSN, 0, 17)>;
    			low-power-enable;
    			bias-pull-up;
    		};
    	};
    
    	spi3_default: spi3_default {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
    				<NRF_PSEL(SPIM_MISO, 1, 14)>,
    				<NRF_PSEL(SPIM_MOSI, 1, 13)>;
    		};
    	};
    
    	spi3_sleep: spi3_sleep {
    		group1 {
    			psels = <NRF_PSEL(SPIM_SCK, 1, 15)>,
    				<NRF_PSEL(SPIM_MISO, 1, 14)>,
    				<NRF_PSEL(SPIM_MOSI, 1, 13)>;
    			low-power-enable;
    		};
    	};
    
    };

    and for the lan8651 I'm using this evaluation board which I have tested with a Raspberry pi and it works fine : 

    https://www.mikroe.com/two-wire-eth-click?srsltid=AfmBOoq4voSZdUgfa4Wwms7uturBa8gQrzeUtw5B4xtBP4m3zquLWpQm

    Thanks,

Related