Hi all!
Setup:
- Arduino Mega 2560
- Nextion tft screen connected to RX1 and TX1. Both GND sides are connected as well as the 5v line.
Test sketch:
void setup() {
Serial1.begin(9600);
delay(500);
Serial1.print("baud=115200");
Serial1.write(0xff);
Serial1.write(0xff);
Serial1.write(0xff);
Serial1.end();
Serial1.begin(115200);
Serial.begin(115200);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
}
void loop() {
if (Serial1.available() > 0) {
digitalWrite(13, HIGH);
Serial.println(Serial1.read());
}
}
Problem: If I power up the Arduino board using the barrel jack connector or an only-power USB (such as a USB charger), Serial1 does not become available despite I'm sending serial data from the Nextion screen to the Arduino (with a button)
Workaround: If I connect the USB port to my computer and then open the serial monitor, Serial1 becomes available when I push the button on the Nextion screen and everything works great.
What am I missing here?
I found several topics about this, double checked everything but seems to be ok on my setup.
- SOLVED - No serial1 output without connected serial USB?!? - MKRWAN1310 - Arduino Forum
- Can't user Serial1 and Serial when cable is not connected - Programming Questions - Arduino Forum
- Serial1 and USB Arduino M0 PRO - Project Guidance - Arduino Forum
Thanks in advance
** New tests **
I've been curious on this problem, so I did a DTR reset (setting the RESET pin low for a moment) and bingo! It works. May there's something that's occurring too fast during the setup?