Using second UART on esp8266

#1

I want to communicate with a serial device connected to the non-usb connected uart on the 8266.
I plan to us JS in this project.
How do I setup my system to achieve this?

NodeMCU V3 ESP8266 UART Read
#2

UART1 on ES8266 is only tx.

#3

Is there anyway of connecting the Tx/Rx pins on my slave device to the pins on the esp8266? Are these the pins labelled Tx/Rx ?
Also, is it possible to turn of the mongoose os debug output?

#4

To disable the debug output

 - ["debug.stdout_uart", -1]
 - ["debug.stderr_uart", -1]

or to redirect to UART1

 - ["debug.stdout_uart", 1]
 - ["debug.stderr_uart", 1]
#5

Thank you for this - which file do I put this in?

#6

mos.yml section config_schema

config_schema:
 - ["debug.stdout_uart", -1]
 - ["debug.stderr_uart", -1]

The boot messages will still go to UART0.

#7

Is it possible to suppress the boot messages?

#8

Yes.

#9

I have additional question in this topic.

  • After I setup up the
  • [“debug.stdout_uart”, 1]
  • [“debug.stderr_uart”, 1]

(Question #1) - I try change the baudrate to higher number but output stay @115200

mgos_app_init()
{
struct mgos_uart_config ucfg1;
ucfg1.baud_rate = 4*115200;
ucfg1.num_data_bits = 8;
ucfg1.parity = MGOS_UART_PARITY_NONE;
ucfg1.stop_bits = MGOS_UART_STOP_BITS_1;
mgos_uart_config_set_defaults(1, &ucfg1); // UART_1
if (!mgos_uart_configure(1, &ucfg1)) // UART_1
{
return MGOS_APP_INIT_ERROR;
}
}

(Question #2) - In the “init.js”

  • The output Log stop after I try to setup LED port

let led = Cfg.get(‘board.led1.pin’); // Built-in LED GPIO number
GPIO.set_mode(led, GPIO.MODE_OUTPUT);
GPIO.write(led, level);

When I disable the lines, output log works again

#10

There is no USB on the ESP9266. Each UART is using a set of GPIOs depending on your hardware, you will use one of the other available UARTs depending on the available pins your hardware provides. Check your hardware datasheet, check your chip datasheet.
Somewhere in the uart code, which you can find starting at the uart docs, there are the typical pins used and how to configure them. If you search for this in the forum you are likely to find it, as it has been answered several times before.
The fastest solution is: if your hardware uses the most common pinout, you simply change the uart number parameter in your call to UART.setConfig():

let uartNo = 1;   // UART number used for this example

// Configure UART at 115200 baud
UART.setConfig(uartNo, {
  baudRate: 115200,