-->
Page 1 of 2

Tips for simple TCP implementation + question about serial

PostPosted: Mon Jan 25, 2016 3:53 am
by rambutan2000
Hi all, I was wondering if someone could nudge me in the right direction to get a simple TCP server up and running. I've seen the ESP8266_TCP library and am wondering if that's what people use or is there a more vanilla way just using the stock ESP8266WiFi library?

I don't want to use HTTP because it will have too much overhead on my client side but UDP is overkill.

Also I've seen references to serial1 in some examples. I'm sending my Arduino sketches directly to a ESP8266 breakout (not to a ESP8266 connected to a Uno for example).

Does the second serial connection refer to an internal connection to ESP8266 inner workings or is it more to do with sending serial data to a socket?

Thanks in advance for any help.

G

Re: Tips for simple TCP implementation + question about seri

PostPosted: Mon Jan 25, 2016 8:53 am
by martinayotte
Did you look at this example if it meet your needs ?
https://github.com/esp8266/Arduino/blob ... Serial.ino

Re: Tips for simple TCP implementation + question about seri

PostPosted: Mon Jan 25, 2016 9:58 am
by xtal
I'v been happy using ESP8266WiFi.h lib... as for serial1 I have not used , but think GPIO2 is Tx
I don't recall any Rx being available....
also found the commands which are helpful , they are apparently part of ESP core...
there are probable some more I havn't found.....

heap = ESP.getFreeHeap();
Serial.println(ESP.getBootMode());
Serial.println(ESP.getSdkVersion();
Serial.println(ESP.getBootVersion());
Serial.println(ESP.getChipId());
Serial.print("ESP.getFlashChipSize(); ");
Serial.println(ESP.getFlashChipSize());
Serial.println(ESP.getFlashChipRealSize());
Serial.println(ESP.getFlashChipSizeByChipId());
Serial.print("ESP.getFlashChipId(); ");
Serial.println(ESP.getFlashChipId());

Re: Tips for simple TCP implementation + question about seri

PostPosted: Tue Jan 26, 2016 2:46 am
by rambutan2000
martinayotte wrote:Did you look at this example if it meet your needs ?
https://github.com/esp8266/Arduino/blob ... Serial.ino


Hi martinayotte thanks for your reply!

Yes I've looked at that example, it compiles and runs fine but I'm a noob and confused about the serial and serial1 ports. I get that some Arduino hardware has multiple hardware UART ports so you can send serial data to something other than serial (0?) but how is this working in the context of network data? Is serial being used to send data over TCP and serial1 used to send data over the COM part back to the PC?

When I try that example and read serial data back to the PC over USB (to debug code) all I get is :


ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16
tail 0
chksum 0x42
csum 0x42
~ld

on baud 74880 even though the code says 115200, I imagine this is some kind of hard coded debug message?

Basically I'd like to use the library and send serial debug messages back to the PC over USB. At least until my mini OLED comes in the mail :)

Thanks!

G