0

I have successfully added enc2860 using spi0, I followed https://www.raspberrypi-spy.co.uk/2020/05/adding-ethernet-to-a-pi-zero/ to get it working without any issue on eth0.

But I now want to add 2nd Ethernet port over second SPI because of stable network that ethernet provides versus the wifi. I checked about USB to Ethernet adapters but thats not an option due to certain other pheripheral using the same.

I found some hints using Using ENC28J60 on /dev/spidev1.0 or /dev/spidev1.2 as well but when I try this, its not adding one more interface but replacing the existing ethernet. Is there anything I am missing w.r.t steps I followed below:

Step 1:

Enabling eth0 using spi-0 https://www.raspberrypi-spy.co.uk/2020/05/adding-ethernet-to-a-pi-zero/

Step 2: Adding eth1 using spi1

Added new dts for spi1:

// Overlay for the Microchip ENC28J60 Ethernet Controller - SPI1
// Interrupt pin: 25
/dts-v1/;
/plugin/;

/ {
    compatible = "brcm,bcm2708";

    fragment@0 {
        target = <&spi1>;
        __overlay__ {
            /* needed to avoid dtc warning */
            #address-cells = <1>;
            #size-cells = <0>;

            status = "okay";

            eth1: enc28j60@0{
                compatible = "microchip,enc28j60";
                reg = <0>; /* CE0 */
                pinctrl-names = "default";
                pinctrl-0 = <&eth1_pins>;
                interrupt-parent = <&gpio>;
                interrupts = <25 0x2>; /* falling edge */
                spi-max-frequency = <12000000>;
                status = "okay";
            };
        };
    };

    fragment@1 {
        target = <&gpio>;
        __overlay__ {
            eth1_pins: eth1_pins {
                brcm,pins = <25>;
                brcm,function = <0>; /* in */
                brcm,pull = <0>; /* none */
            };
        };
    };

    __overrides__ {
        int_pin = <&eth1>, "interrupts:0",
                  <&eth1_pins>, "brcm,pins:0";
        speed   = <&eth1>, "spi-max-frequency:0";
    };
};

compiling with:

sudo dtc -I dts -O dtb -o /boot/overlays/enc28j60-sp1.dtbo enc28j60-spi1-overlay.dts

adding overlay to /boot/config.txt

dtparam=spi=on          #enable spi
dtoverlay=spi1-1cs      #enable spi1 (and CE0, CE1)
dtoverlay=enc28j60-spi1 #enable enc28j60 module on spi1 port

but when I check ifconfig after the reboot, it only shows eth0

It does not populate eth1 or add one more interface, just shows no difference. Am I missing anything?

Edit 2:

Added few more diagnostics listing class/net :

ls /sys/class/net

Ouput ->

lo  wlan0

listing /dev/spi command:

ls /dev/spi* 

output:

/dev/spidev0.0  /dev/spidev0.1

SPI 1 Connection (2nd ENC):

enter image description here

SPI 0 Connection (1st ENC):

enter image description here

Edit 3: Sorry I did not reboot after configuration, so spi1 was not visible in listing

post reboot:

ls /dev/spi*

output:

/dev/spidev0.1  /dev/spidev1.0  /dev/spidev1.1  /dev/spidev1.2
6
  • @Milliways Thanks, I have added steps & diagnostics Nov 17, 2022 at 7:51
  • You have still omitted connection details & meaningful diagnostics (ifconfig is deprecated and doesn't tell you what interfaces you have - try ls /sys/class/net) ls /dev/spi* will show SPI devices. I can't comment on your dts. I still wonder WHY people who want networking buy a device without!
    – Milliways
    Nov 18, 2022 at 0:30
  • @Milliways Thanks for the thought. I have added few more diagnostics. We have chosen pi-zero for networking because we have rest all our stacks built on the same. we have very good grip over all variants of pi, incase we want to upgrade our device its just hardware change for us. specially Pizero because its saving us few bucks. Its more assured of production stocks. It has a community like you guys. If you believe a good alternative for soley networking please give a hint, I will check. Nov 18, 2022 at 6:54
  • 1
    DO NOT post barely legible pictures of text post TEXT. Your problem is that you DO NOT have a SPI1 interface so all the rest is irrelevant.
    – Milliways
    Nov 18, 2022 at 9:27
  • Sorry, Some mistake from me. now its showing up spi1 in ls /dev/spi Nov 18, 2022 at 9:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.