Skip to content
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

DHCP Support #14

Open
jonahbron opened this issue Aug 2, 2019 · 10 comments
Open

DHCP Support #14

jonahbron opened this issue Aug 2, 2019 · 10 comments
Labels
accepting prs Will accept pull requets for this issue

Comments

@jonahbron
Copy link
Contributor

Need to add DHCP support so that an IP address can be dynamically acquired.

@kellerkindt
Copy link
Owner

kellerkindt commented Aug 2, 2019

One needs to send and receive two UDP packages, track the intermediate state and detect the when it needs renewal: https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol

Might be related for duration tracking: rust-embedded/embedded-hal#59

That... might help us https://github.com/Wiznet/W5500_EVB

@jonahbron
Copy link
Contributor Author

Good, this initial direction will help greatly, thank you.

@kellerkindt kellerkindt added the accepting prs Will accept pull requets for this issue label Jun 10, 2020
@ryan-summers
Copy link
Collaborator

One other approach is to actually just use the W5500 in MACRAW mode and put smoltcp on top of it. In this way, you get all the goodness of smoltcp (i.e. DHCP, DNS, mDNS, etc.) without having to duplicate the implementation in this crate. Check out https://github.com/quartiq/booster/blob/main/src/hardware/external_mac.rs for a reference implementation on how to do this. It's on my TODO list to pull the external-mac operation into it's own crate as well to enable this.

@rvdende
Copy link

rvdende commented May 29, 2023

Has anyone got W5500 working with DHCP? I've got TCP working when specifying an ipaddress, but I have no idea how to get DHCP added when initializing the device.

@ryan-summers
Copy link
Collaborator

As I mentioned above, you can get DHCP working by using Smoltcp just fine, and I do this in the booster crate linked above :).

In it's current state, this crate does not support DHCP without using smoltcp.

@rvdende
Copy link

rvdende commented Jun 5, 2023

I tried with smoltcp-nal, not smoltcp itself. Sorry I'm a bit new to rust so its a bit daunting to init the devices. I was hoping a minimal example to get DHCP. At this stage I'm stuck having to hardcode the ip :( Heres my attempt:

So the main branch is working, the smoltcp branch is failing. this is the diff:
netrondev/iotrs_stm32f4@main...smoltcp

@ryan-summers
Copy link
Collaborator

ryan-summers commented Jun 13, 2023

@rvdende Sorry, I don't have a ton of time on my hands, so it's hard for me to review your code and tell you exactly what's wrong. If you want to review a working example used in production, check out Booster's initialization routines, which use the smoltcp-nal, smoltcp. and the W5500:
https://github.com/quartiq/booster/blob/main/src/hardware/setup.rs#L283-L381
https://github.com/quartiq/booster/blob/main/src/hardware/net_interface.rs

@cnmozzie
Copy link

this is my minimal example that I take from the "booster" repo. I hope it can help you

@rvdende
Copy link

rvdende commented Jul 28, 2023

this is my minimal example that I take from the "booster" repo. I hope it can help you

Thank you @cnmozzie !! I'm going to try this as soon as possible.

@rvdende
Copy link

rvdende commented Aug 28, 2023

@cnmozzie thanks again for the example code, I got it working on my stm32F407 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting prs Will accept pull requets for this issue
Projects
None yet
Development

No branches or pull requests

5 participants