(I use ESP32 dev kits with Arduino api.)
My dev kit 1 is running my firmware; and I want to measure the current it draws, therefore I don't like to plug the USB in.
As I need to read the logs from the dev kit 1, I want to plug another dev kit that collects the log from the first through the UART.
The dev kit 1 firmware is as it is, but on the dev kit 2, I wrote such a thing:
#include <Arduino.h>
#include <Hardware.h>
HardwareSerial Reader();
void setup() {
Serial.begin(115200);
Reader.begin(115200, SERIAL_8N1, 16, 17);
}
void loop() {
while(Reader.available()) {
Serial.print(Reader.read());
}
}
The wiring is as follows:
| Dev kit 1 | Wiring | Dev kit 2 (sniffer) |
|---|---|---|
| TXD | <=> | RXD (16) |
| RXD | <=> | TXD (17) |
| GND | <=> | GND |
But this doesn't work, that is I can't see anything on the dev kit 2 serial on my computer. Any idea?
[UPDATE] As suggested by @juraj, I simply wire TX to TX, RX to RX and GND to GND and removed the Serial.begin(115200) from the firmware running on dev kit 1. Dev kit 2 firmware is as simple as:
void setup() {
Serial.begin(115200);
//Serial.printf("Serial2 logger RX (%d)<=>TX & TX(%d)<=>RX @ 115200 bauds", RX, TX); Serial.println();
}
void loop() {
static unsigned lastHeartbeat = 0;
const unsigned now =millis();
if (now-lastHeartbeat > 4000) {
lastHeartbeat = now;
Serial.println("Heartbeat");
}
}
Note that on dev kit 1, I commented out the line Serial.begin(115200).
No kit 1 logs appears on my computer.
The wiring of this setup:
