1

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?

  • How have you connected this? – Mikael Patel Mar 17 '16 at 10:25
  • I can't tell how you have it physically connected. So I can't tell if it's wrong. It should work indeed. But you'll need the exact right settings and probably an (correct me if I'm wrong) uart<->RS232 converter. – Paul Mar 17 '16 at 10:25
  • @MikaelPatel I edited the description above to include how I connected everything for each scenario. Let me know if I need to be more clear on anything. Thanks! – john Mar 17 '16 at 18:50
  • @Paul I edited the description above to include how I connected everything for each scenario. Let me know if I need to be more clear on anything. Thanks! – john Mar 17 '16 at 18:50
  • You might want to check if inverting the Rx and Tx lines does something. But judging from the tests you've done, it shouldn't make a difference. Worst case, you could try an ossiloscope and compare the actual raw electrical output of the working and non-working examples. Are you sure you need an CR + LF? Maybe your putty settings only send an LF (and does work for that reason) – Paul Mar 17 '16 at 19:00
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, did you read the “SparkFun RS232/TTL Shifter connected to Galileo UART” part of the question? – James Waldby - jwpat7 Mar 17 '16 at 17:10
  • Nope. Missed that. – Majenko Mar 17 '16 at 17:11
  • @jwpat7 and Majenko, I edited the description above to include how I connected everything for each scenario. Let me know if I need to be more clear on anything. Thanks! – john Mar 17 '16 at 18:51
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.