Intergrate W5500 with an nRF54L15DK

I am working on a school project and need to set up SPI communication between a wiznet,W5500 and the nRF54L15DK. I can build and run my program but I am getting no responce when I ping the device. When looking over my prj.conf I have a warning associated to CONFIG_ETH_W5500=y that says 

CONFIG_ETH_W5500 was assigned the value y, but got the value n. Missing dependencies:
DT_HAS_WIZNET_W5500_ENABLED.
Here is the prj.conf
# Networking config
CONFIG_NETWORKING=y

# w5500 driver config
CONFIG_SPI=y
CONFIG_NET_L2_ETHERNET=y
CONFIG_ETH_W5500=y


# Network address config
CONFIG_NET_CONFIG_SETTINGS=y
CONFIG_NET_CONFIG_NEED_IPV4=y
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.168.101.52"
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.168.1.1"

# choose RTT console or UART console
CONFIG_SERIAL=y
CONFIG_UART_CONSOLE=y
CONFIG_CONSOLE=y
CONFIG_USE_SEGGER_RTT=n
CONFIG_RTT_CONSOLE=n

# General config
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_NET_LOG=y
Here is the overlay
&pinctrl {
    spi22_default: spi22_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 2, 7)>,
                    <NRF_PSEL(SPIM_MOSI, 2, 6)>,
                    <NRF_PSEL(SPIM_MISO, 2, 8)>; 
        };
    };

    spi22_sleep {
        group1{
            psels = <NRF_PSEL(SPIM_SCK, 2, 7)>,
                    <NRF_PSEL(SPIM_MOSI, 2, 6)>,
                    <NRF_PSEL(SPIM_MISO, 2, 8)>; 
            low-power-enable;
        };
    };
};

// Enable wiznet W5500
&spi22 {
    compatible = "nordic,nrf-spim";
    status = "okay";
    pinctrl-0 = <&spi22_default>;
    pinctrl-1 = <&spi22_sleep>;
    pinctrl-names = "default", "sleep";
    cs-gpios = <&gpio2 9 GPIO_ACTIVE_LOW>;

    w5500: w5500@0 {
        compatible = "wiznet,w5500";
        label = "w5500";
        reg = <0>;
        spi-max-frequency = <8000000>;
        reset-gpios = <&gpio2 10 GPIO_ACTIVE_LOW>;
        int-gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
        status = "okay";
    };
};

// Enable UART for console output
&uart20 {
    status = "okay";
};

// Disable unused LEDS
&led0 {
    status = "disabled";
};

&led2 {
    status = "disabled";
};
main.c
/* 
* W5500 SPI communication test
* Using SPI22 on GPIO port 2
*/

#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/device.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/drivers/gpio.h>

// W5500 Regiser Addresses
#define W5500_VERSIONR 0x04 
#define W5500_COMMON_REG_BLOCK 0x00 

// Get W5500 SPI configuration from devicetree
#define W5500_NODE DT_NODELABEL(w5500)
#define SPI_NODE DT_BUS(W5500_NODE)

static const struct device *spi_dev = DEVICE_DT_GET(SPI_NODE);

// SPI config with cs from devicetree
static struct spi_cs_control cs_ctrl = SPI_CS_CONTROL_INIT(W5500_NODE, 2);

static struct spi_config spi_cfg = {
        .frequency = 8000000, // 8 MHz
        .operation = SPI_WORD_SET(8) | SPI_TRANSFER_MSB, // Mode 0
        .cs = {
                .gpio = SPI_CS_GPIOS_DT_SPEC_GET(W5500_NODE),
                .delay = 2,
        },
};

// Reset GPIO
#if DT_NODE_HAS_PROP(W5500_NODE, reset_gpios)
static const struct gpio_dt_spec reset_gpio = GPIO_DT_SPEC_GET(W5500_NODE, reset_gpios);
#define HAS_RESET_GPIO 1
#else
#define HAS_RESET_GPIO 0
#endif


static void reset_w5500(void)
{
        #if HAS_RESET_GPIO
                printk("Restting W5500 \n");
                gpio_pin_set_dt(&reset_gpio, 1); // Assert reset
                k_msleep(10);
                gpio_pin_set_dt(&reset_gpio, 0); // Release reset
                k_msleep(100);
                printk("Reset complete \n");
        #else
                printk("No rest GPIO configured \n");
        #endif
}


int main(void)
{
        int ret;
        uint8_t version;

        printk("\n\n");
        printk("========================================\n");
        printk(" W5500 SPI test \n");
        printk("========================================\n\n");

        // Check SPI device
        if (!device_is_ready(spi_dev)) {
                printk("ERROR: SPI device not ready!\n");
                return -1;
        }

        printk("SPI device ready! \n");

        // Check CS GPIO form spi_cfg
        if (!gpio_is_ready_dt(&spi_cfg.cs.gpio)) {
                printk("ERROR: CS GPIO not ready!\n");
                return -1;
        }
        printk("CS GPIO ready \n");

        #if HAS_RESET_GPIO
                if(!gpio_is_ready_dt(&reset_gpio)) {
                        printk("ERROR: Reset GPIO not ready! \n");
                        return -1;
                }
                ret = gpio_pin_configure_dt(&reset_gpio, GPIO_OUTPUT_INACTIVE);
                if(ret<0) {
                        printk("ERROR: Failed to configure Reset: %d \n", ret);
                        return -1;
                }
                printk("Reset GPIO configured \n");
        #endif

        reset_w5500();


        return 0;
}
Currently just trying to make the warning go away but also wondering why I can't ping the device. 
Parents
  • Hi

    It seems like you're using P2.03 for an int GPIO in your WIZNET overlay. This one is connected to SPI and not the P2 header on the nRF54L15 DK. You need to use the board configurator app to disable the external flash.

    Additionally, I don't know the specifics of this module, but what voltage does the WIZNET run on?

    For the warning, the configuration option DT_HAS_WIZNET_W5500_ENABLED is not user-configurable. This means that you cannot set this configuration yourself. It can only be configured internally, for example, by other configuration options or devicetree. In this case, it is set by W5500 being enabled in devicetree. Remove this from prj.conf, and the error will disappear.

    Best regards,

    Simon

Reply
  • Hi

    It seems like you're using P2.03 for an int GPIO in your WIZNET overlay. This one is connected to SPI and not the P2 header on the nRF54L15 DK. You need to use the board configurator app to disable the external flash.

    Additionally, I don't know the specifics of this module, but what voltage does the WIZNET run on?

    For the warning, the configuration option DT_HAS_WIZNET_W5500_ENABLED is not user-configurable. This means that you cannot set this configuration yourself. It can only be configured internally, for example, by other configuration options or devicetree. In this case, it is set by W5500 being enabled in devicetree. Remove this from prj.conf, and the error will disappear.

    Best regards,

    Simon

Children
Related