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
How to enable esp_pppos component to connect internet and modbus tcp/ip via ethernet or wifi at the same time ? (IDFGH-7031) #8648
Comments
Thank you for this issue. I would like to get some clarification (confirmation) of this issue to make sure I correctly understand your environment. So, your Modbus TCP slave device is I need to reproduce this issue first. So, any additional information and artifacts (examples, logs) can help. Please also clarify the ESP-IDF version. Thanks. |
@alisitsyn Thanks for your support. I have added detail information as below. Please help me to check it. Environment
Debug Logs
Other items if possible
|
Thank you for your information. This will take some time to investigate and fix. The issue started to go through the formal process. |
@NguyenMinhTri My guess is that the DNS gets updated after getting the DHCP lease on the Ethernet interface and rewrites the DNS information acquired from the PPP server. You can use this API:
(please try to set the DNS servers manually or get the information using |
@NguyenMinhTri Thanks for reporting, would you please help share if any further updates? Thanks. |
Hello David, esp-idf/components/esp_netif/lwip/esp_netif_lwip.c Lines 1503 to 1513 in d756745
Am i right ? Thanks. |
Thank you, I have used this API but my issue still not fixed. Hi @alisitsyn alisitsyn, Can you help me to that how to use SIM for internet connection and ethernet for modbus connection in esp32 ? |
@NguyenMinhTri The code is not very readable from the screenshot, but it looks like both interfaces are created with their default configs, correct? If so, the default route-prio for Ethernet is higher, so that the HTTP request is routed via this interface. (no DNS issue at this point, as the DNS was resolved in the previous step (first call of
@sengulhamza This is correct, thanks for mentioning. will fix! |
To update the routing priority for Ethernet interface, you can replace your esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH();
esp_netif_t *eth_netif = esp_netif_new(&cfg); with esp_netif_inherent_config_t esp_netif_config = ESP_NETIF_INHERENT_DEFAULT_ETH();
esp_netif_config.route_prio = 10;
esp_netif_config_t config = {
.base = &esp_netif_config,
.stack = ESP_NETIF_NETSTACK_DEFAULT_ETH
};
esp_netif_new(&config); |
@david-cermak thank you for your interest, fix is very helpful to me. |
Hi @NguyenMinhTri, Could you try the suggestion from @david-cermak posted above with your hardware? I can not check it quickly with modem HW right now. The modbus uses LWIP transport with its socket API and needs the configured netif pointer. The above solution looks reasonable to me. If you still have issues with the modbus and client disconnection I will try to reproduce the issue on my side in order to find the solution. |
Currently, I'm using esp_pppos component to connect the internet via 4G SIM, and now I want to enable modbus tcp/ip via wifi or ethernet but they do not work at the same time.
What should I do?
My sample code
`
The text was updated successfully, but these errors were encountered: