w5500-test on rpi pico, but it doesn't work

This commit is contained in:
Artemis Tosini 2023-11-16 06:21:41 +00:00
parent bd27ddf9ec
commit fe42d91e2a
Signed by: artemist
GPG key ID: EE5227935FE3FF18
5 changed files with 37 additions and 37 deletions

View file

@ -20,7 +20,7 @@
riscv64-zephyr-elf
];
modules = with artemist-packages.packages.${system}.zephyr.modules;
[ mbedtls ];
[ mbedtls hal_rpi_pico cmsis ];
};
formatter = pkgs.nixfmt;
});

View file

@ -0,0 +1 @@
CONFIG_TEST_RANDOM_GENERATOR=y

View file

@ -0,0 +1,10 @@
&spi0 {
cs-gpios = <&gpio0 17 GPIO_ACTIVE_LOW>;
w5500@0 {
compatible = "wiznet,w5500";
reg = <0>;
int-gpios = <&gpio0 15 GPIO_ACTIVE_LOW>;
spi-max-frequency = <10000000>;
};
};

View file

@ -4,8 +4,27 @@ CONFIG_ETH_W5500=y
CONFIG_NETWORKING=y
CONFIG_NET_IPV6=y
CONFIG_NET_IPV4=y
CONFIG_NET_DHCPV4=y
CONFIG_NET_TCP=y
CONFIG_NET_MAX_ROUTES=2
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y
CONFIG_NET_SOCKETS_POLL_MAX=4
CONFIG_NET_CONFIG_AUTO_INIT=y
CONFIG_NET_CONFIG_NEED_IPV6=y
CONFIG_NET_CONFIG_NEED_IPV6_ROUTER=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_LOG_PRINTK=y
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG=y
CONFIG_NET_CONFIG_LOG_LEVEL_INF=y
CONFIG_NET_LOG=y
CONFIG_NET_SHELL=y

View file

@ -1,44 +1,14 @@
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(w5500_test, LOG_LEVEL_DBG);
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS 1000
/* The devicetree node identifier for the "led0" alias. */
#define LED0_NODE DT_ALIAS(led0)
/*
* A build error on this line means your board is unsupported.
* See the sample documentation for information on how to fix this.
*/
static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);
#include <zephyr/net/net_config.h>
int main(void)
{
int ret;
if (!gpio_is_ready_dt(&led)) {
return 0;
LOG_INF("owo");
while(1) {
k_sleep(K_MSEC(1000));
}
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
if (ret < 0) {
return 0;
}
while (1) {
ret = gpio_pin_toggle_dt(&led);
if (ret < 0) {
return 0;
}
k_msleep(SLEEP_TIME_MS);
}
return 0;
}