2

Problem:

I have an HDMI switch that is controllable via RS232

  • Scenario 1:
    • Setup: PC connected to HDMI switch using USB -> serial adapter
    • Test: Opening PuTTY on COM port and sending command "sw i01" from my PC
    • Results: HDMI switch input changes to port 1 [Good]
  • Scenario 2:
    • Setup: Arduino UART port connected to TTL->RS232 adapter connected to serial->USB adapter connected to PC with PuTTY program open on COM port
    • Test: Sending command "sw i01" from Arduino to PC using code below
    • Results: "sw i01" prints repeatedly on the Putty terminal [Good]
  • Scenario 3:
    • Setup: Arduino UART port connected to TTL->RS232 adapter connected to HDMI switch serial port
    • Test: Sending "sw i01" from Arduino repeatedly to HDMI switch using code below
    • Results: HDMI port does not switch from port2 to port1 [Bad]

Hardware:

Code:

[Note: Galileo Gen 2 requires Serial1 for UART communication]

void setup() {
    Serial1.begin(19200);
}

void loop() {
    Serial1.print("sw i01");
    Serial1.write(13);    // CR
    Serial1.write(10);    // LF
    delay(1000);
}

Question:

It seems like Scenario 1 and 2 confirm that the Arduino->HDMI switch communication should work, but it doesn't. Am I missing something regarding physical connectivity? Does manually typing "sw i01" in PuTTY send different commands than I have in the Arduino code?

Greenonline
  • 3,152
  • 7
  • 36
  • 48
john
  • 21
  • 1
  • 4

2 Answers2

1

Your HDMI switcher, and your USB to RS-232 converter speak RS-232. The Arduino speaks TTL UART.

While the concept behind them, and the overall format of the data, is the same there are major differences:

  • RS-232 uses a ±10V NRZ signalling method, TTL UART uses a 0-5V signalling method
  • RS-232 uses inverse logic compared to TTL UART

That means that you need to convert the Arduino's TTL UART to ±10V NRZ with inverse logic in order to communicate with the IOGear.

Fortunately that's a simple enough task using a special interface chip. These are readily available and can be bought for tiny amounts as a breakout board or even a full shield if you like (such as this one from Sparkfun). The chip is known as a MAX232 in its most common form, though other manufacturers may use different letters.

If you pop on eBay (or your favourite budget seller site) and search for "Arduino MAX232 DB9" (the DB9 is the type of plug on the board - the 9-pin D connector) you will get lots of hits to choose from.

Majenko
  • 105,851
  • 5
  • 82
  • 139
0

I found it is was related to the physical connection!

In Scenario 3, I originally had the Sparkfun TTL/RS232 adapter that had a female DB9 connector wired to the HDMI switch female DB9 connector using a male/male serial cable. The serial cable I bought was a straight through cable.

I swapped it out with a null modem cable and it worked right away.

Looking at the wiring diagram, I thought swapping the Tx/Rx pins on the Sparkfun adapter would have achieved the same result as the null modem cable, but apparently not.

If anybody can point out why the null modem cable made the difference, that would be something good to know for the future.

john
  • 21
  • 1
  • 4