-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add ethernet support to eval-pqmon #2550
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a builds.json
i see this project doesn't have one, but i would add it at this stage to ensure we don't break this project or the w5500 networking infrastructure
and make sure to review the #ifdefs you added, they seem to break some existing projects that use networking |
67f111d
to
695a872
Compare
I pushed a v2 with some fixes for now: v1 -> v2
|
Rename the "ethernet" build option to "ethernet_t1l" to clarify that it refers specifically to the ADIN1100 T1L Ethernet PHY. This change prepares for the future addition of WIZ850io (W5500-based) Ethernet support as an alternative interface option. Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Add low-level driver for the WIZnet W5500 Ethernet controller chip. The driver provides SPI interface communication, socket management, and TCP/UDP/MACRAW protocol implementations. Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Add adapter layer to integrate the W5500 Ethernet controller with the generic network_interface API. This enables the W5500 driver to be used with no-os TCP/IP socket implementations. Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Add W5500 Ethernet controller support to the IIO subsystem by extending the network interface conditionals to include NO_OS_W5500_NETWORKING. This allows applications to use W5500-based network connectivity for IIO communication alongside existing UART and LWIP options. Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
Add support for standard Ethernet connectivity to the eval-pqmon project using the W5500 Ethernet controller. This introduces a new "ethernet" build option alongside the existing USB, serial, and ethernet_t1l options. Configure necessary hardware parameters, SPI interface, and network stack integration for the WIZ850io module. Signed-off-by: Alisa-Dariana Roman <alisa.roman@analog.com>
695a872
to
8eb9d6e
Compare
v2 -> v3
|
ok, i'm dropping the requirement to add builds.json at this point, that's a separate discussion because any build of this project requires pqlib and i am not sure we have the infrastructure now, that can be a separate pr |
ret = w5500_socket_open(net_dev->mac_dev, new_physical_id, W5500_Sn_MR_TCP, 2); | ||
if (ret) | ||
return ret; | ||
|
||
ret = w5500_socket_bind(net_dev->mac_dev, new_physical_id, | ||
server_socket->local_port); | ||
if (ret) | ||
return ret; | ||
|
||
ret = w5500_socket_listen(net_dev->mac_dev, new_physical_id); | ||
if (ret) | ||
return ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open, bind and listen should have been called for a server socket prior to accept()
. Why is it necessary to add this sequence here?
new_socket = &net_dev->sockets[new_physical_id]; | ||
new_socket->sock_id = sock_id; | ||
new_socket->local_port = server_socket->local_port; | ||
new_socket->in_use = 1; | ||
new_socket->role = W5500_ROLE_SERVER; | ||
|
||
server_socket->sock_id = net_dev->next_virtual_id++; | ||
server_socket->role = W5500_ROLE_CLIENT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain what is happening here? Are we changing the socket associated with the server?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood correctly, in the iio module where accept is called, it expects a new client socket to be created and the server socket keeps listening for new connections. But for W5500, the socket that is listening changes status and becomes a "client" socket. To bypass this, in the w5500 accept function I created a new socket that will be the server socket, thus the 3 function callings above, then I switch the virtual ids. Should I extract this switch in another static function to make things clearer?
|
||
socket = &net_dev->sockets[physical_id]; | ||
|
||
socket->role = (proto == PROTOCOL_TCP) ? W5500_ROLE_CLIENT : W5500_ROLE_UNUSED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you can know if the socket will be used by a client or server at this point
struct w5500_dev *mac_dev; | ||
struct w5500_network_dev *net_dev; | ||
|
||
status = w5500_init(&mac_dev, &w5500_ip); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can move this part in the w5500_network_init()
function in order to simplify the application code.
.gpio_reset = w5500_rst_gpio_ip, | ||
.gpio_int = w5500_int_gpio_ip, | ||
.mac_addr = {0x00, 0x08, 0xDC, 0x01, 0x02, 0x03}, | ||
.ip_addr = {192, 168, 1, 110}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to support DHCP besides the static IP assignment? Also, it would be nice if you could define a macro for the IP address and netmask (similarly to this approach: https://github.com/analogdevicesinc/no-OS/blob/main/projects/apard32690/Makefile#L13-L16 , however you can set it directly into the init param). I think that would provide a simple way of building the project with different ip addresses for the server.
Pull Request Description
This PR adds support for the W5500 Ethernet controller chip, providing standard Ethernet connectivity for no-os projects. The implementation includes:
PR Type
PR Checklist