38 (*spi_handle)->frame_end();
39 reg_wizchip_spi_cbfunc((*spi_handle)->read_byte, (*spi_handle)->write_byte);
40 reg_wizchip_spiburst_cbfunc((*spi_handle)->read_buffer, (*spi_handle)->write_buffer);
41 reg_wizchip_cs_cbfunc((*spi_handle)->frame_start, (*spi_handle)->frame_end);
44 uint8_t memsize[2][8] = {
45 {2, 2, 2, 2, 2, 2, 2, 2},
46 {2, 2, 2, 2, 2, 2, 2, 2}
49 if (ctlwizchip(CW_INIT_WIZCHIP, (
void*)memsize) == -1)
51 printf(
"W5500 init failed (CW_INIT_WIZCHIP)\r\n");
58 wiz_NetInfo net_info = {.mac = {0x02, 0x08, 0xDC, 0x12, 0x34, 0x56},
59 .ip = {192, 168, 29, 11},
60 .sn = {255, 255, 255, 0},
61 .gw = {192, 168, 29, 1},
63 .dhcp = NETINFO_STATIC};
65 network_initialize(net_info);
66 print_network_information(net_info);
73 printf(
"Starting UDP echo on port %u...\r\n", (
unsigned)
UDP_PORT);
81 printf(
"socket() failed, ret=%d\r\n", (
int)ret);
87 printf(
"Socket opened successfully in blocking mode\r\n");
90 uint8_t recv_buf[2048];
94 printf(
"Entering main echo loop (blocking mode)...\r\n");
102 int32_t recv_len = recvfrom(
UDP_SOCK, recv_buf,
sizeof(recv_buf), remote_ip, &remote_port);
107 printf(
"RX %ld bytes from %u.%u.%u.%u:%u\r\n", (
long)recv_len, remote_ip[0],
108 remote_ip[1], remote_ip[2], remote_ip[3], remote_port);
113 sendto(
UDP_SOCK, recv_buf, (uint16_t)recv_len, remote_ip, remote_port);
116 printf(
"sendto() error %ld\r\n", (
long)sent_len);
122 printf(
"recvfrom() error %ld\r\n", (
long)recv_len);
wiznet_spi_handle_t spi_handle
static void w5500_init_no_linkwait(void)
static void configure_network(void)
static void run_udp_echo_server(void)