-->
Page 1 of 2

ESP8266 and softwareserial

PostPosted: Mon Aug 03, 2015 8:13 am
by matbor
Hi all, new to Arduino and ESP8266,

Quick question can SoftwareSerial work on the ESP8266.

Code: Select all#include <SoftwareSerial.h>


Would like to connect a Serial GPS to one.

Thx
Matt.

Re: ESP8266 and softwareserial

PostPosted: Tue Aug 04, 2015 5:01 am
by tytower
Have not seen it mentioned specifically so I don't think so -this from github/esp8266/Arduino readme if its of any use.
Serial

Serial object works much the same way as on a regular Arduino. Apart from hardware FIFO (128 bytes for TX and RX) HardwareSerial has additional 256-byte TX and RX buffers. Both transmit and receive is interrupt-driven. Write and read functions only block the sketch execution when the respective FIFO/buffers are full/empty.

Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling Serial.swap() after Serial.begin. Calling swap again maps UART0 back to GPIO1 and GPIO3.

Serial1 uses UART1, TX pin is GPIO2. UART1 can not be used to receive data because normally it's RX pin is occupied for flash chip connection. To use Serial1, call Serial1.begin(baudrate).

By default the diagnostic output from WiFi libraries is disabled when you call Serial.begin. To enable debug output again, call Serial.setDebugOutput(true). To redirect debug output to Serial1 instead, call Serial1.setDebugOutput(true).

You also need to use Serial.setDebugOutput(true) to enable output from printf() function.

Both Serial and Serial1 objects support 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call Serial.begin(baudrate, SERIAL_8N1), Serial.begin(baudrate, SERIAL_6E2), etc.

Re: ESP8266 and softwareserial

PostPosted: Tue Aug 04, 2015 8:51 am
by martinayotte
matbor wrote:Quick question can SoftwareSerial work on the ESP8266.
Would like to connect a Serial GPS to one.


That is all depends of the speed of your GPS Serial.
If it is too fast, you can get into troubles.

Re: ESP8266 and softwareserial

PostPosted: Fri Aug 14, 2015 6:28 am
by plingboot
I'm also using it to connect to a serial GPS module. I'm using hardware serial to receive at 9600 on GPIO1 and GPIO3 (just disconnect the programmer after the upload adn restart) and hardware Serial1 (TX only) to output debug stream of GPS sentences . Works great.