I am using esp32 code where it connects with wifi and sends data over mqtt.But on any MQTT failure,it does not reconnect. We should not need to reboot the device from outside, it should get back online whenever the problem is solved. The machine may restart after a long time when it is needed ,but remember on any failure it should not keep rebooting.
Related
I'm a beginer with ESP32 programming.
I'm trying to play with the example provided in https://github.com/espressif/esp-idf/tree/master/examples/wifi/getting_started/station/main and it works perfectly with my iPhone in tethering mode, however it's impossible to connect to my home access point.
I (776) wifi:mode : sta (30:c6:f7:29:c6:48)
I (776) wifi:enable tsf
I (786) wifi station: wifi_init_sta finished.
I (996) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (1746) wifi:state: init -> auth (b0)
I (2746) wifi:state: auth -> init (200)
I (2746) wifi:new:<1,0>, old:<1,0>, ap:<255,255>, sta:<1,0>, prof:1
I (2756) wifi station: retry to connect to the AP
Each try fails. I tried to play with some parameters but nothing improves the situation. Any idea on how to collect more information to set the connection properly?
By the way I'm able to scan every visible network with https://github.com/espressif/esp-idf/blob/master/examples/wifi/scan/main/scan.c so this is why I guess it's configuration related...
I was having this issue. I found that, for me, the issue was not in the ESP32. It was the WiFi Router. I had the security on the router set to 'WEP' in the router. When I changed the security to 'WPA2-PSK' the ESP32 device connected right away.
I am building a project utilizing Wifi on the ESP32 module. Using RTOS, I am running a web server on 1 core and a web client on another core. This works very well and I can access the web server remotely via my browser and the WiFi provided IP address. The Web client reads some sensors and sends the data via WiFi to my database. All good and everything works as desired.
Now I need to do the next step and move beyond the reach of the WiFi and reproduce the same result via 3/4G cellular. I looked at the "easy" solution to use an industrial 3/4G WiFi router and simply keep what I have. Cost of these "industrial" type routers are on the high side, where as 3/4G module which also include a GPS chip are around half or less. Problem is that I cannot get my head around how I will "replace" my current WiFi functionality with one of these modules. The modules seems to expect you to connect via serial (rs232) and using modem AT commands establish a connection to the internet. Question is, after connecting to the internet, how do you continue to have "network functionality" same as with the built-in WiFi? Is there some library that will do ethernet over the serial port? Can I still have the WiFi and the "serial ethernet" running at the same time or switch between the two?
Thanks!
I have a NDIS light-weight filter (LWF) driver to capture all network traffic. It's open-sourced here. The installer is provided here.
The issue is that I found my filter will cause all Wi-Fi adapters can't receive any packets. I have received many complaints here: https://github.com/nmap/nmap/issues/373
The reproduce steps are:
Installed this filter using the installer (npcap-0.10-r14.exe).
Launch Wireshark GUI (latest stable version Wireshark 2.2.1), then only Wi-Fi connections are broken. Wired connections are not affected.
During the connection loss, I try to capture packets on the no-connection Wi-Fi adapter via Wireshark, I can still see outgoing traffic, but no incoming traffic. (most outgoing traffic will be the ARP requests after a few seconds because no packets received)
Wait for 90-100 seconds, then the Wi-Fi connections are recovered. Everything is fine now.
Close and re-start Wireshark now will not cause this issue again.
But if I restart my filter (like using net stop npcap and net start npcap) or re-install it via the installer. And repeat from step 2, then this issue happens again.
So this issue seems to only happen when the NDIS filter loads at the first time, and only happen to Wi-Fi adapters.
Then I checked the debug trace of my NDIS filter in DbgView (via installing the debug version npcap-0.10-r14-debug.exe). I saw that my ReceiveNetBufferListsHandler function NPF_TapEx is never called during the connection loss. The SendNetBufferListsHandler function NPF_SendEx is still working fine.
So I believe some things happened when launching Wireshark causes NDIS doesn't pass on the received packets. So my NDIS filter and upper Windows OS doesn't receive any incoming packets at all.
I noticed that Microsoft said Optional NDIS Lightweight Filters (LWF) could cause 90-second delay in network availability here. But it only happens when:
If an optional NDIS Lightweight Filter (LWF) driver is installed and the driver is not started, the network will not be available for up to 90-seconds.
However, my filter driver has been started by the installer, not by launching the Wireshark GUI. And this connection loss only happens to Wi-Fi connections. So I believe this is not the cause.
I'm testing this issue on Win10 14393 x64. But it seems to happen for all platforms. Does anyone have any ideas that why this issue happens? Thanks!
I am using RN42 on embedded device connected to UART. Baudrate is 115200 ( I tried lowering it but didnt help. )
I am using default settings.
Every time when I pair a device with PC I can open a serial port to remote device, but as soon as i Close the port, and I try to open it again It will fail with "semaphore timeout error".
If I want to restore connection I have to delete device from PC and add it again, then it will work for 1st time and fail again.
Does anyone have similar issues or maybe solution to this? If you need more info ask, I realy dont know what info to supply in this case.
On PC side I have USB Bluetooth device and integrated one. The both behave the same.
On embedded side RN42 is connected to UART of AM3517.
I hope you can help me.
Regards,
Luka
I found the issue. It was PIN3 (GPIO6) connected high. This way after 1 connection module switched to auto master and was unable to connect to other masters.
I have a application which I suspects to get into problems because network nodes closes its sockets to various other servers it communicates to.
I would like to mimic that behaviour by shutting down one or severel connections that can be seen in netstat.
I'm not an expert in networking on OS level, so this question may be stupid, if so do you have any other suggestion on how to mimic the situation?
Before attempting to simulate the problem, you can diagnose the situation with certainty by using Wireshark or, on *nix, tcpdump. You should be able to capture the traffic and observer whether one of the server(s) is sending you a RST or not.
If you are receiving RST then this may be due to the servers themselves (time-outing and closing the connection while waiting for you to send them a response or data, or closing the connection because of server bugs or load limits), to your ISP's network equipment, or to your own network equipment (e.g. your wireless link going up and down.)
Disconnecting your router, network cable or wireless interface can simulate to various degrees connection issues that you can encounter at any time when talking to your servers. Disconnecting your PC's network cable should simulate a forceful closing of the connection with RST, whereas disconnecting a cable between you and the internet, but not the cable that directly connects your PC (e.g. disconnecting the cable between your router and your cable/DSL modem, or disconnecting the cable/DSL modem from the cable company's cable/telco's wall jack) will allow you to simulate timeout conditions.
You can use TCP View. You can view all the connections from your machine to another, or within the same machine. You can close a connection, thus breaking the connection.