WeMos D1 mini (esp8266), debug on secondary UART – Part 3

Spread the love

As you can see in the pinout diagram WeMos D1 mini have 2 UART, one on dedicated pins and a transmit-only UART that can be enabled on GPIO2 (D4).

WeMos D1 mini esp8266 pinout mischianti low resolution
WeMos D1 mini esp8266 pinout mischianti low resolution

This single pin can be used at configuration time to transmit core debug information or custom Serial1 print.

To connect, naturally, you must use a USB to TTL converter, you can find it at 1$.

Exists more expensive FT232RL or FT232 module, but a CH340G or CH340 working very good.

CH340G Module It is my forced choice

You can find here AliExpress USB to TTL CH340G - AliExpress USB to TTL FT232RL


FT232RL Module

Connection schema is very simple.

WeMos D1 mini Serial debug test

Example

/*
 *  WeMos D1 mini (esp8266)
 *  Debug on standard Serial and Serial1 on GPIO2 (D4) pin
 *  by Mischianti Renzo <https://mischianti.org>
 *
 *  https://mischianti.org/wemos-d1-mini-esp8266-debug-on-secondary-uart-part-3/
 *
 */
#include "Arduino.h"

void setup()
{
	Serial.begin(9600);
	Serial1.begin(9600);
}

int i = 0;
void loop()
{
	i++;
	Serial.print("Hi, I'm Serial on standard TX RX pin! --> ");
	Serial.println(i);
	Serial1.print("Hi, I'm Serial1 on D4 pin (GPIO2)! --> ");
	Serial1.println(i);
	delay(1000);
}

Here the serial monitor on standard UART (USB connection).

Hi, I'm Serial on standard TX RX pin! --> 1
Hi, I'm Serial on standard TX RX pin! --> 2
Hi, I'm Serial on standard TX RX pin! --> 3
Hi, I'm Serial on standard TX RX pin! --> 4

Here the serial monitor on D4 pin (USB to TTL converter).

Hi, I'm Serial1 on D4 pin (GPIO2)! --> 1
Hi, I'm Serial1 on D4 pin (GPIO2)! --> 2
Hi, I'm Serial1 on D4 pin (GPIO2)! --> 3
Hi, I'm Serial1 on D4 pin (GPIO2)! --> 4

Core debug

You can activate in Tools --> Debug level core debug that are setted at build time. This flag help to debug core function as WIFI or SSL and so on.

esp8266 debug level

Thanks

  1. WeMos D1 mini (esp8266), specs and IDE configuration
  2. WeMos D1 mini (esp8266), integrated SPIFFS Filesystem
  3. WeMos D1 mini (esp8266), debug on secondary UART
  4. WeMos D1 mini (esp8266), the three type of sleep mode to manage energy savings
  5. WeMos D1 mini (esp8266), integrated LittleFS Filesystem
  6. esp12 esp07 (esp8266): flash, pinout, specs and IDE configuration
  7. Firmware and OTA update management
    1. Firmware management
      1. esp8266: flash firmware binary (.bin) compiled and signed
      2. esp8266: flash firmware and filesystem binary (.bin) compiled with GUI tools
    2. OTA update with Arduino IDE
      1. esp8266 OTA update with Arduino IDE: filesystem, signed and password
    3. OTA update with Web Browser
      1. esp8266 OTA update with Web Browser: firmware, filesystem and authentication
      2. esp8266 OTA update with Web Browser: sign the firmware and HTTPS (SSL/TLS)
      3. esp8266 OTA update with Web Browser: custom web interface
    4. Self OTA uptate from HTTP server
      1. esp8266 self OTA update firmware from server
      2. esp8266 self OTA update firmware from server with version check
      3. esp8266 self OTA update in HTTPS (SSL/TLS) with trusted self signed certificate
    5. Non standard Firmware update
      1. esp8266 firmware and filesystem update from SD card
      2. esp8266 firmware and filesystem update with FTP client
  8. esp32 and esp8266: FAT filesystem on external SPI flash memory
  9. i2c esp8266: how to, network 5v, 3.3v, speed, and custom pins
  10. […]

Spread the love

4 Responses

  1. Mi piace, è conciso: problema e soluzione. Un appunto: non si vede l’alimentazione del convertitore USB-Seriale, faresti meglio a precisare che arriva dall’USB collegata ad un utilizzatore che fornisce tensione.

Leave a Reply

Your email address will not be published. Required fields are marked *