ESP8266-12: does serial.swap(); disable UART0 on pins 1 (TX) and 3 (RX)?

From the datasheet (and from : A Beginner's Guide to the ESP8266) :

Serial
The ESP8266 has two hardware UARTS (Serial ports):
UART0 on pins 1 and 3 (TX0 and RX0 resp.), and UART1 on pins 2 and 8 (TX1 and RX1 resp.), however, GPIO8 is used to connect the flash chip. This means that UART1 can only transmit data.
UART0 also has hardware flow control on pins 15 and 13 (RTS0 and CTS0 resp.). These two pins can also be used as alternative TX0 and RX0 pins.

Does this mean that pin 1(TX) and pin 3 (RX) cannot be used anymore for their regular TX/RX purposes when Serial.swap() is used?

Not sure I understand the question

To use UART0 (Tx = GPIO1, Rx = GPIO3), you can use the Serial object, just like on an Arduino: Serial.begin(baudrate).

To use the alternative pins (Tx = GPIO15, Rx = GPIO13), use Serial.swap() after Serial.begin. Then GPIO 1 and 3 are no longer active UART pins. (The SWAP IO Register has been updated)

To use UART1 (Tx = GPIO2), use the Serial1 object. (UART1 can only transmit data)

The source code is the ultimate documentation if you want to see what is done:

this is how swap() is defined

void swap()
{
  swap(1);
}

so basically calling this function with 1 as parameter

void swap(uint8_t tx_pin)    //toggle between use of GPIO13/GPIO15 or GPIO3/GPIO(1/2) as RX and TX
{
  uart_swap(_uart, tx_pin);
}

which call the uart_swap() function

"To use the alternative pins (Tx = GPIO15, Rx = GPIO13), use Serial.swap() after Serial.begin. Then GPIO 1 and 3 are no longer active UART pins. (The SWAP IO Register has been updated)"

That answered my question, thank you!!

Keep in mind the USB port is connected to pins 1 & 3 only, Serial.swap() disables that as well.

Deva_Rishi:
Keep in mind the USB port is connected to pins 1 & 3 only, Serial.swap() disables that as well.

Interesting.. now this comment relates to development boards: in that case, when programming then the ESP8266 goes into boot mode where I presume the hardware TX and RX (on pins 1 and 3) will and can be used?

And when using the plain ESP8266-12 the same thing except now not via USB, but through a UART module (ie FTDI, CP210x, ..)?

when programming then the ESP8266 goes into boot mode where I presume the hardware TX and RX (on pins 1 and 3) will and can be used?

Of course, anyway .swap() is a volatile setting a the unit reverts after reset (which is required for putting it in boot mode)

when using the plain ESP8266-12 the same thing except now not via USB, but through a UART module

that is not relevant of course. .swap(0 swaps the port to the other pins, and if you connect Serial to TTL to them, that will work. In fact you can also use swSerial on an Arduino and connect a module to the pins you define if you would want to use that for debugging in case hwSerial is already in use.

TOP! Thank you.