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

Spread the love
  •  
  •  
  •  
  • 2
  •  
  •  
  •  
  •  
  •  
  •  
  •  

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 pinout

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

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://www.mischianti.org>
 *
 *  https://www.mischianti.org/2019/05/12/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
  •  
  •  
  •  
  • 2
  •  
  •  

You may also like...

1 Response

  1. 25 November 2019

    […] Here a complete sketch, pay attention I use Serial1 to debug, refer to Part 3 WeMos D1 mini (esp8266), debug on secondary UART […]

Leave a Reply

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