countrypaul:
Have you tried connecting the matrix to a PC and sending the commands from the PC - does that work?
Have you tried connecting the ESP and converter to a PC and seeing if you get the expected strings on the PC?
sorry for the late reply. i needed to get the usb-rs232 cable for testing and i got some success but not really.
when i connect the pc USB -> esp32 -> ttl/rs232 converter -> rs232_to_usb_cable -> pc and start up Tera Term on my windows and monitor the serialmonitor of the esp32 everything works as expected. i can send and receive from both devices.
when i connect the matrix switch directly to the pc and send the command "MT00SW0100NT" the switch reacts as intended.
when i connect the esp32 -> ttl/rs232 converter -> matrix switch nothing happens.
countrypaul:
I would definitely look at some way of reading the RS232 to/from your devices.
I notice that both your converter and matrix are female DB9, how are you connecting them?
I got a rs232 male-to-male cable db9 for that.
Idahowalker:
Have you done a loop back test to confirm an ability to send / to receive?
see above... yes i think thats what i did.
drmpf:
Do you have another ESP32 that you can connect the ESP32 to and from there to your PC to test the send is OK. I.e. ESP32 -> 3v3 serial -> ESP32 -> PC
Then you can connect the switch and 'tap' into the Switches TX (3v3 TX that connects to the ESP32) line to sniff what is happening on that. Edit: not really much use to do that.
What would be nice would be if you have two converters that you could test back to back and then use one to tap into the TX line from the switch. (I always buy two of things on the basis I will destroy one try to get it to work)
By the way, try adding a newLine '\n' or CR newline '\r''\n' to the command. Not mentioned in the doc but often used for sending commands.
Also check the CTS and RTS and DTR lines you may need to loop the CTS to the RTS
see the bottom of
advantech
You can use a multimeter to check the levels on the CTS, RTS etc lines
see RS232 Voltage Levels - Signals DTR CTS RTS » Electronics Notes
for the levels expected
i tried
Serial2.write("MT00SW0100NT\r");
Serial2.write("MT00SW0300NT\n");
Serial2.write("MT00SW0300NT\r''\n'");
no change... when tested in TeraTerm i also just wrote "MT00SW0100NT" - nothing additional was needed.
I think the esp32 -> esp32 tasks are now redundant now since i got the cable and established that its working that way. I just have one esp32 here...
I could get a multimeter somewhere... but since the usb -> rs232 directly to the matrix switch also works i guess everything is ok on that site?
the code i used to test all this looks like this...
#define RXD2 16
#define TXD2 17
char c;
String readString;
void setup() {
// Note the format for setting a serial port is as follows: Serial2.begin(baud-rate, protocol, RX pin, TX pin);
Serial.begin(115200);
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
Serial2.println("serial2test");
Serial.println("Serial Txd is on pin: " + String(TX));
Serial.println("Serial Rxd is on pin: " + String(RX));
}
void loop() {
while (Serial2.available()) {
c = Serial2.read();
readString += c;
}
if (readString.length() > 0) {
Serial.print(readString);
Serial2.print(readString);
//server.print(readString);
readString = "";
}
Serial2.write("MT00SW0100NT\r");
delay(4000);
Serial2.write("MT00SW0300NT\n");
delay(4000);
}
so everything works... just not esp32 -> ttl/rs232 converter -> hdmi matrix.
can you think of any other tests for me?
thanks a lot for all this input! this is seriously awesome.