I have a quirky question today.
I have an Arduino MEGA 2560 with a very simple setup. It's connected to my pc over usb, and has one device connected on its onboard TX/RX2 port group. Whenever I open the COM port on my pc I see a short spike in voltage on the TX2 pin. An analogous behavior happens on even the simplest sketches so I don't think it's the library I'm using to talk to this device.
With the sketch below instead of a short spike in voltage, the TX2 line stays high and when the pc's COM port is opened that TX2 line drops to 0v for maybe a half second.
Not super relevant info about device
It's a Noritake GU140X32F-7000 display. The mfg website doesn't list it's model directly but the
info on the 'B' variant, and it's supplied AVR code, work just fine.
MFG Website for this model>> https://noritake-vfd.com/gu140x32f-7000b.aspx
Code Library>> https://www.noritake-elec.com/codeLibrary.php#gu7000
Relevant bare-minimum code to see this effect on an oscilloscope connected GRD <-> AVR Ground, POS <-> Pin16(TX2)
void setup() {
Serial.begin(115200); // Connection to computer
Serial2.begin(38400); // Connection to TX2 pin 16
Serial2.write('akjlahsdkjahsdkjlhasdkjhaskldjhaksjhd');
}
uint8_t serialByte = 0;
void loop() {
if (Serial.available() > 0) {
serialByte = Serial.read();
}
}
What happens, which I don't want happening, is after I've had the Arduino draw to the Noritake screen, and I open or reopen the COM port from my pc to the Arduino, the screen blanks itself. Doesn't matter if I use PUTTY, python's serial library with
ser = serial.Serial('COM4', 115200, R timeout=0,parity=serial.PARITY_NONE, rtscts=1)
or Serial Port Monitor's trial version from https://www.com-port-monitoring.com/ via the send dialog - it happens either way.
Especially weird is I don't see data going over this COM port in the Serial Monitor software when the COM port is opened and yet my oscilloscope (fairly crappy DSO138) catches a spike in voltage happen the moment this serial line is opened from my pc. When I use the Noritake library the TX line is normally low when there's no data, whereas the Arduino built in Serial2 line is normally high until there's data. Then when I connect it goes low for about a half second. The code Noritake uses to communicate over this serial line is a bit odd, not actually using the Serial or Stream built in classes, instead opting to write data manually to this port and only including these two external libraries.
#include <avr/pgmspace.h>
#include <util/delay_basic.h>
What causes Serial2 to go low when my PC opens the COM port to Serial on my Arduino? What can I do to prevent it from writing to Serial2?