w5500-test on rpi pico, but it doesn't work
This commit is contained in:
parent
bd27ddf9ec
commit
fe42d91e2a
|
@ -20,7 +20,7 @@
|
||||||
riscv64-zephyr-elf
|
riscv64-zephyr-elf
|
||||||
];
|
];
|
||||||
modules = with artemist-packages.packages.${system}.zephyr.modules;
|
modules = with artemist-packages.packages.${system}.zephyr.modules;
|
||||||
[ mbedtls ];
|
[ mbedtls hal_rpi_pico cmsis ];
|
||||||
};
|
};
|
||||||
formatter = pkgs.nixfmt;
|
formatter = pkgs.nixfmt;
|
||||||
});
|
});
|
||||||
|
|
1
zephyr/w5500-test/boards/rpi_pico.conf
Normal file
1
zephyr/w5500-test/boards/rpi_pico.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
CONFIG_TEST_RANDOM_GENERATOR=y
|
10
zephyr/w5500-test/boards/rpi_pico.overlay
Normal file
10
zephyr/w5500-test/boards/rpi_pico.overlay
Normal 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>;
|
||||||
|
};
|
||||||
|
};
|
|
@ -4,8 +4,27 @@ CONFIG_ETH_W5500=y
|
||||||
|
|
||||||
CONFIG_NETWORKING=y
|
CONFIG_NETWORKING=y
|
||||||
CONFIG_NET_IPV6=y
|
CONFIG_NET_IPV6=y
|
||||||
|
CONFIG_NET_IPV4=y
|
||||||
|
CONFIG_NET_DHCPV4=y
|
||||||
CONFIG_NET_TCP=y
|
CONFIG_NET_TCP=y
|
||||||
|
|
||||||
|
CONFIG_NET_MAX_ROUTES=2
|
||||||
|
|
||||||
CONFIG_NET_SOCKETS=y
|
CONFIG_NET_SOCKETS=y
|
||||||
CONFIG_NET_SOCKETS_POSIX_NAMES=y
|
CONFIG_NET_SOCKETS_POSIX_NAMES=y
|
||||||
CONFIG_NET_SOCKETS_POLL_MAX=4
|
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
|
||||||
|
|
|
@ -1,44 +1,14 @@
|
||||||
/*
|
#include <zephyr/logging/log.h>
|
||||||
* Copyright (c) 2016 Intel Corporation
|
LOG_MODULE_REGISTER(w5500_test, LOG_LEVEL_DBG);
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
#include <zephyr/drivers/gpio.h>
|
#include <zephyr/net/net_config.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);
|
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
int ret;
|
LOG_INF("owo");
|
||||||
|
|
||||||
if (!gpio_is_ready_dt(&led)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = gpio_pin_configure_dt(&led, GPIO_OUTPUT_ACTIVE);
|
|
||||||
if (ret < 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
ret = gpio_pin_toggle_dt(&led);
|
k_sleep(K_MSEC(1000));
|
||||||
if (ret < 0) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
k_msleep(SLEEP_TIME_MS);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue