I would like to interface with a ENC28J60 module (ENC28J60 Ethernet Module Communication Interface Adaptor :Elecrow bazaar, Make your making Electronic modules projects easy) using SPI1 interface on the Jetson Nano.
So far, I have done the following:
-
Selected GPIO11 / PZ0 as my interrupt pin, don’t know how to configure a pin as interrupt though.
-
Added TEGRA_GPIO(Z, 0) to gpio-input section on gpio-default devicetree.
-
Configured following on pinmux:
pz0 { nvidia,pins = "pz0"; nvidia,function = "rsvd1"; nvidia,pull = <TEGRA_PIN_PULL_DOWN>; // <TEGRA_PIN_PULL_UP>; nvidia,tristate = <TEGRA_PIN_DISABLE>; nvidia,enable-input = <TEGRA_PIN_ENABLE>; }; spi1_mosi_pc0 { nvidia,pins = "spi1_mosi_pc0"; nvidia,function = "spi1"; nvidia,pull = <TEGRA_PIN_PULL_DOWN>; nvidia,tristate = <TEGRA_PIN_DISABLE>; nvidia,enable-input = <TEGRA_PIN_ENABLE>; }; spi1_miso_pc1 { nvidia,pins = "spi1_miso_pc1"; nvidia,function = "spi1"; nvidia,pull = <TEGRA_PIN_PULL_DOWN>; nvidia,tristate = <TEGRA_PIN_DISABLE>; nvidia,enable-input = <TEGRA_PIN_ENABLE>; }; spi1_sck_pc2 { nvidia,pins = "spi1_sck_pc2"; nvidia,function = "spi1"; nvidia,pull = <TEGRA_PIN_PULL_DOWN>; nvidia,tristate = <TEGRA_PIN_DISABLE>; nvidia,enable-input = <TEGRA_PIN_ENABLE>; }; spi1_cs0_pc3 { nvidia,pins = "spi1_cs0_pc3"; nvidia,function = "spi1"; nvidia,pull = <TEGRA_PIN_PULL_UP>; nvidia,tristate = <TEGRA_PIN_DISABLE>; nvidia,enable-input = <TEGRA_PIN_ENABLE>; }; spi1_cs1_pc4 { nvidia,pins = "spi1_cs1_pc4"; nvidia,function = "spi1"; nvidia,pull = <TEGRA_PIN_PULL_UP>; nvidia,tristate = <TEGRA_PIN_DISABLE>; nvidia,enable-input = <TEGRA_PIN_ENABLE>; };
-
Added enc28j60 devicetree as follows, similar to mcp2515 example (which works for me):
spi@7000d400 { /* SPI 1 to 40 pin header */ status = "okay"; enc28j60: spi@0 { compatible = "microchip,enc28j60"; reg = <0>; interrupt-parent = <&gpio>; interrupts = <TEGRA_GPIO(Z, 0) IRQ_TYPE_EDGE_FALLING>; //GPIO11 corresponds to PZ0 nvidia,enable-hw-based-cs; nvidia,rx-clk-tap-delay = <0x7>; spi-max-frequency = <10000000>; controller-data { nvidia,cs-setup-clk-count = <0x1e>; nvidia,cs-hold-clk-count = <0x1e>; nvidia,rx-clk-tap-delay = <0x1f>; nvidia,tx-clk-tap-delay = <0x0>; }; }; };
-
Made the module connections: (1st col. ENC28J60 module, 2nd col Jetson Nano Dev. Kit 40-pin header)
SI 19 SO 21 SCK 23 CS 24 INT 31 WOL NC RESET NC CLKOUT NC GND GND VCC 3V3
- Enabled ENC28J60 in kernel config
CONFIG_ENC28J60=y
NOTE: My 5V/3A supply didnt arrive yet, so I am powering Jetson Nano from a USB/0.5A.
However, I am getting the following error:
[ 4.176139] enc28j60 spi0.0: enc28j60 Ethernet driver 1.02 loaded
[ 4.185134] enc28j60 spi0.0: enc28j60 chip not found
[ 4.190129] enc28j60: probe of spi0.0 failed with error -5
I am referencing on how this is done with a Raspberry Pi, and Jetson Nano MCP2515 interfacing example.
Is there anything I am missing that would result in the aforementioned error.
Any guidance is appreciated. Thanks.