Configuring and interface nRF52480DK with ENC28J60.

Hi there! 
I'm trying to use a ENC28J60 shield on a nRF52480DK.

I tried this pins connection I found in another 4 years old ticket here on devzone:

=================    ===================================
NRF52840 PCA10056    ENC28J60 (pin numbers on the board)
=================    ===================================
P0_19                              SCK
P0_21                              SO
P0_20                              SI
GND                                CS
VDD                                 VCC
GND                                GND
=================    ===================================

I found an overlay file here on webzone as follow:

&spi1 {
    compatible = "nordic,nrf-spi";
    /* Cannot be used together with i2c0. */
    /* status = "okay"; */
    sck-pin = <13>;
    mosi-pin = <29>;
    miso-pin = <31>;
	
	enc28j60: ethernet@0 {
        compatible = "microchip,enc28j60";
        label = "ENC28J60";
        reg = <15>;
        int-gpios = <&gpio0 17 0>;
        spi-max-frequency = <10000000>;
        local-mac-address = [00 00 00 00 00 00];
    };
};

but I'm seeing on nrf-spi-common.yaml that mosi-pin is deprecated.

I tried to enable ENC28J60 on KConfig but it seems to be locked in some way and it's impossible to me to enable the Ethernet Controller


So, what's the way to enable it, to have an overlay file that make my project compile and unlock this situation? 

Thank you in advance for your help.

BR 
Denis

  • Hi Denis,

    I am taking a look at this and will get back to you.

    Best regads,

    Håkon

  • Hi Denis, sorry for the delay.

    I tried this pins connection I found in another 4 years old ticket here on devzone:

    There has been changes to how pins are defined in nRF Connect SDK over the years. The main difference is the introduction of Pin Control. Which nRF Connect SDK version are you using now?

    I'm trying to use a ENC28J60 shield on a nRF52480DK.

    Exactly which board/shield are you using? Could you please provide a link or some documentation? You could borrow from the shield MikroElektronika ETH Click and add SPI configurations in accordance with the the new Pin Control style. I will try to set up an example.

  • I created this overlay as a demonstration. I checked that there are no errors when compiling, however, I have not performed any further testing.

    &pinctrl {
        spi3_default: spi3_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 29)>,
                    <NRF_PSEL(SPIM_MISO, 0, 31)>;
            };
        };
    
        spi3_sleep: spi3_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 13)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 29)>,
                    <NRF_PSEL(SPIM_MISO, 0, 31)>;
                low-power-enable;
            };
        }; 
    };
    
    
    
    &spi3 {
        compatible = "nordic,nrf-spim";
        status = "okay";
        cs-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&spi3_default>;
        pinctrl-1 = <&spi3_sleep>;
        pinctrl-names = "default", "sleep";
    
        enc28j60: ethernet@0 {
            compatible = "microchip,enc28j60";
            reg = <0x0>;
            local-mac-address = [00 00 00 01 02 03];
            /* Errata B7/1 specifies min 8Mhz, 20MHz max according to RM */
            spi-max-frequency = <10000000>;
            int-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;	/* INT */
        };
    };

Related