-
Notifications
You must be signed in to change notification settings - Fork 194
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
http server over ethernet? #529
Comments
Patch all of the sys hal and svc crates to GIT master and try again. |
Did so, updated esp-idf to 5.3.2 as well, that wasn't the issue. I might be stupid really, but when the eth netif on the esp32 receives a packet, does it not try to interpret it for the http server? Do I need to route it there somehow? Because the server is not bound to a specific netif afaik.. I'm a bit confused about this whole thing |
No it must work. The reason why I asked you to update to With that said:
|
Hi, sorry for the delay. I don't know what I changed, but I get a stack overflow in emac_rx when trying to start the eth netif now, except I can't find the related setting in my Kconfig.. The documentation says it should be CONFIG_EMAC_TASK_STACK_SIZE but even setting it manually seems to have no influence on the result. |
OK but were you actually starting the EspEth instance before my suggestion, or not? |
Yes I was |
Then I have no explanation as to why your eth does not work. Another possibility is that you are not keeping around the But this is all speculations. I think it is best if you do a minimal repro case and upload it somewhere. I don't even need your HTTP or mDNS stuff. It should just be the eth stuff - you configure it with a static IP, you start it, then you In fact, you can even take this example as a base, adjust it to not use DHCP but a static IP and then upload somewhere. Or just paste the full code of the non-working example here. As for the stack overflow, as long as you do specify |
This might not even be an issue on the esp's side, I'll try to investigate. What's a good value for CONFIG_EMAC_TASK_STACK_SIZE? I'm at 8192 and it's still crashing.. Is there a way to tell at runtime what the stack size is for a specific task? I'm not sure it's even registered the config properly. Thanks for the help either way, it's always appreciated. |
I have no idea what is a good value, but 8192 should be a good enough value. And then again, if you provide a short repro that does not work or is crashing on stack size (for the latter, I need a full project generated perhaps with esp-idf-template) then I can try to help. But I don't think me continuing to brainstorm based on incomplete information would be helpful. Let me know if you plan to provide a repro, then we can keep this open. Otherwise I'll close. |
Well I think I might have isolated the problem? I don't know really because this is quite different from what I was doing before, but simply using the example seems to timeout on the wait_netif_up() call. I (493) main_task: Calling app_main()
I (523) esp_idf_svc::eth: Driver initialized
I (523) esp_idf_svc::eth: Initialization complete
I (523) esp_idf_svc::eth: Stopping
E (523) esp_eth: esp_eth_stop(310): driver not started yet
I (533) esp_idf_svc::eth: Stop requested
I (533) esp_eth.netif.netif_glue: 08:f9:e0:a7:97:7b
I (543) esp_eth.netif.netif_glue: ethernet attached to netif
I (543) eth: Eth created
I (553) eth: Starting eth...
I (2253) esp_idf_svc::eth: Start requested
I (2253) eth: Waiting for DHCP lease...
I (17263) esp_idf_svc::eth: Stopping
I (17263) esp_idf_svc::eth: Stop requested
I (17263) esp_idf_svc::eth: EspEth dropped
I (17263) esp_idf_svc::netif: Dropped
I (17263) esp_idf_svc::eth: Stopping
E (17273) esp_eth: esp_eth_stop(310): driver not started yet
I (17273) esp_idf_svc::eth: Stop requested
I (17283) esp_idf_svc::eth: Driver deinitialized
I (17283) esp_idf_svc::eth: EthDriver dropped
I (17293) esp_idf_svc::eventloop: System event loop dropped
Error: ESP_ERR_TIMEOUT
I (17303) main_task: Returned from app_main() Here's the repository: https://github.com/indexds/eth I might be stupid really, but you just have to start it and then it's supposed to do its thing right? |
Just don't call |
If you use it with a dhcp and it times out that means either your pins are wrong or your eth is not properly connected with a cable. |
I'm using dhcp, my pins should be fine since I remember using this exact setup with this bridge and I just double checked my cable, it's all the way in. This is very strange. I'd like to think it's a config issue but since this is a blank project there isn't anything configured at all. |
Actually, I might just have oyster brain, my pc wasn't getting an ip because of course it wasn't since the esp wasn't acting as a dhcp server; with these configs I can now ping let mut eth_netif = EspEth::wrap_all(
eth_driver,
EspNetif::new_with_conf(&NetifConfiguration {
ip_configuration: Some(IpConfiguration::Router( <-- Culprit
IpRouterConfiguration {
subnet: Subnet{
gateway: Ipv4Addr::new(192, 168, 1, 1),
mask: Mask(30),
},
dhcp_enabled: true,
dns: None,
secondary_dns: None,
}
)),
stack: NetifStack::Eth,
..NetifConfiguration::eth_default_router()
})?,
)?; Yet I still can't ping |
I'm a bit lost honestly as to what exactly you are doing.
Why don't you start with the absolute simplest example of all, which is this example. Unchanged. And connect your esp32 to a super-standard router and check that that setup works. Only then try to complicate it, and step by step then. |
Because I'm dumb. It didn't work because I was connecting it to another dhcp client (my pc) so both of them were waiting for the other to give them an ip (i think). That's why the timeout occurred.
As you said, connecting directly to a router works fine
That would be the oyster brain in question. What I need to do is have a setup like this: PC <-RJ45-> ESP ETH NETIF <-> ESP HTTP SERVER Now that I make the esp act as the dhcp server in the equation, PC <-RJ45-> ESP ETH NETIF this part works. The esp has address 192.168.1.1 and is assigning my computer's eth card 192.168.1.2. Pinging 192.168.1.1 from the computer works just fine. So now I can ping the esp but the http server running on said esp is still not pingable (ESP ETH NETIF <-> ESP HTTP SERVER). This might honestly be oyster brain syndrome striking again. |
It's an mdns issue, curl 192.168.1.1 works |
I've not used the IDF mDNS since forever, so not sure what is going on. mdns.add_service(
Some("charizhard"), // instance_name
"_http", // service_type
"_tcp", // proto
80, // port
&[], // txt
)?; ... thing. mdns.set_hostname("charizhard")?; should be enough, and then of course you MUST keep around the With that said, you are running an Esp server, you probably should look into the source code of the mDns IDF component if it is intelligent enough to actually figure out what IP to advertise (in your case it should be your fixed ip 192.168.1.1). I would not be surprised if they take some shortcuts, and their code only works if the network is configured with client / DHCP settings. But then again, without actually looking into their code, I'm speculating. |
btw best is to do Also the message you get when trying to do |
Alright thanks for all the info i'll look into it! |
So yeah, using wireshark I saw.. nothing. The esp isn't advertising at all. It's whatever, I'll just use the ip, I can't be bothered to sift through the 5k lines of mdns lib to see how they do it and do it statically x) |
@indexds: I remembered something: actually, if you haven't switched yet to a patched Also since you are using a "router" eth, you might want to set the IF name of your netif to ETH_DEF, if you follow the conversation in that thread ^^^. Also and as per here you might want to put |
Still not working for ethernet. But mdns itself is working fine as connecting both my pc and the esp to my phone's ap allow the pc to resolve charizhard.local, so it's advertising. Just not on the right interface. |
Hello,
I'm trying to understand what I need to be able to have my ethernet netif speak to the http server running on the esp32.
This code starts an http server,
And this other part boots an eth netif.
Both of these things work just fine, but the only way i've managed to connect to my http server is via setting the wifi in ap mode and connecting to it directly. Plugging ethernet and trying to curl
charizhard.local
gets me a timeout.This is probably more a networking issue than a code issue but I'm scratching my head here. Should I be setting everything to DHCP?
What am I missing?
The text was updated successfully, but these errors were encountered: