esp32/8266 as station and TCP or UDP server for multiple connections

 I have been working on esp32 for serial to udp or tcp server, the idea was to get serial data like GPS or NMEA to be shared over local net work.

I did this before, and found out that if your run softAP and TCP server on same core, it could "core 0 panic"

I separated then into 2 core, but still failed when 2-3 connected after a while of working.

from this post, it seems 8266 is more stable than esp32 on wifi handling?!

As broadcasting data, a UDP is more suitable than TCP, Bidirectional communication is not available for the UDP/broadcast protocol.

this seems to be a good start:

 1 Wifi communication between ESP8266 and PC using TCP/IP or UDP/broadcast protocol

I tested it with apmode and udp, but it shows ip unset

if I do it in station mode, it does not show "connected to wifi"

This one is 3 TCP to serial ports on esp32

https://github.com/AlphaLima/ESP32-Serial-Bridge

https://github.com/yuri-rage/ESP-Serial-Bridge

This fork allow UDP and 8266, but it says:"PROTOCOL_UDP (software limitation) are not available on the ESP8266."

I tested with a esp32 in ap mode and udp broadcast, the plat form is a wemos 32, 

do some config in the config file, I'm able to send data through uart to 2 udp connection, but not all received data, some lost few data. and chip get hot.

https://github.com/roboremo/ESP8266-WiFi-UART-Bridge

old project, designed for 8266, no broadcast, but test ok on 1 udp ap mode.

after changing as following

// adding IPAddress broadcast(192, 168, 0, 255);

// and change the to boradcast IP  udp.beginPacket(broadcast, port); 

 I tested with 3 devices all get data.


May be it would be better to do udp broadcast on 8266....




留言

這個網誌中的熱門文章

Meshtastic 03 adding GPS on TTGO lora32 V2

AIS0. understanding AIS NMEA 0183: How it's coded

ELRS on Pixhawk 2.4 with ardupilot