Home AMX User Forum AMX Technical Discussion

RS232C help please

Sorry, but I am just starting out and trying to learn AMX programming.

Can someone please help me with sending RS232 commands. I'm trying to learn the commands to control a Yamaha RX-V1600 Receiver.

I've got the RS-232 protocol document from yamaha here:

http://www.yamaha.com/yec/customer/codes/RX-V1600_V2600_RS232C_ST.pdf

Problem is, I don't know how to translate the information on the doc to a useful SEND_STRING command. BTW, I'm using an Axcent Pro3 controller.

Anyone controlled a Yammie amp via RS-232 before? Help!

Comments

  • TurnipTruckTurnipTruck Posts: 1,485
    Well you certainly picked a doozie to start with.

    Do you understand the concepts of serial communication? The relationship between ASCII, binary and hex? These things are important before you begin trying to decode the document you referred to.
  • I agree with Turnip. The Yahmaha receiver 232 codes are tough to understand, especially for your first try at 232 commands.

    AMX has pre-written modules for products that really help when controlling a piece like the Yamaha...but it is written for the newer NI series processors and not the Axcent. (Sort of a double whammy for you.) Instead of deciphering Yamaha's code, you simply do a send_command to the virtual device with something like 'power=1:1' and zone one turns on. All of the hard work is done for you.
  • frthomasfrthomas Posts: 176
    Yup, certainly looks like a hard nut to crack, this Yamaha.

    If you're just looking at learning the ropes, I would recommend finding some other, simpler, serial device to begin. If you need to get it working for a project, I'd also recommend using the ready made module as a first step.

    Which step do you have a problem with?

    HTH

    Fred
  • Thomas HayesThomas Hayes Posts: 1,164
    Extron is a nice and simple RS-232 code to start learning with.
  • pdabrowskipdabrowski Posts: 184
    For a little more advanced RS232, try the Sony projectors - once you get the hang of calculating checksums, it all falls together quickly.
  • Rabbie13Rabbie13 Posts: 16
    Thanks all,

    I just knew this wasn't going to be easy.
    I have a fair understanding about serial concepts like, HEX, ASCII etc, I've worked in IT for 13 years.
    However, I've just started a small services company and I would like to learn this stuff for future projects. At the moment, I'm just dealing with the basics, like plasma installations and multiroom AV installs.
    I bought the AMX kit so I could have some equipment to learn on and I was going to use my own Home cinema setup as my first project.
    At the moment I'm just using the Yamaha's universal remote to control some of my kit along with a couple of sorce equipment remotes , but the family struggle with knowing how to power everything on.
    Hence, trying to get the AMX VPT-CP/Axcent Pro3 programmed to control my Yammie, my Pioneer PDP435 and my Speakercraft MZC66. I don't have the AMX IRIS, and I cannot seem to find the IR files to import into the AMX IR database, so I thought IR control is a nono. Beside RS232 looks more flexible.
    I'm just trying to learn the sequence of hex codes I need to send to the Yammie just to get a response.
    Once I'm off and running, I know I'll pick it up fairly quickly.

    Any more suggestions are appreciated.
    Gary, could you explain a little more to me about using this Virtual Device idea?
  • HedbergHedberg Posts: 671
    First, use the search functionality in the forums to find a previous discussion of Yamaha RS 232 protocol. Search for "yamaha" and find the thread titled:
    "YAMAHA YSP 1 232 Woes" Very briefly, it explains that you must first establish a proper physical connection and it gives you the hex codes for the
    "DC1 TOUT0 TOUT1 TOUT2 ETX" command. i.e. "$11,$00,$00,$00,$03"
    If you make the proper connection with handshaking and send that command, the Yamaha will respond with all that configuration garbage. If you are having trouble with the handshaking, you can try a 7 to 8 loopback on the Yamaha end -- that probably will fake it into working (maybe). Like the thread I mentioned says -- you're not going to be able to get it to work until you get good com, and the "Ready" command followed by the "configuration" report from the Yamaha will tell you that.

    To see where the $11 and the $03 come from, look at the last page of the protocol where Yamaha gives you a translation table. The important thing to note is that where ever the manual says "STX" it really wants $02 and where it says "ETX" it wants $03. See the translations for DC1, DC2, etc and that explains the construciton of the command above.

    Now, look at the section about "command switch" on page 4 of the protocol. It explains that the command is 7 bytes long, beginning with STX ($02) and ending with ETX ($03). My interpretation is that the SW byte can either be $00 for a remote control function or $02 for a system command. To see the available commands, see section 3.1 for the system commands and 3.2 for the Remote control commands. The tables give you the necessary values for SW, CMDT0, CMDT1, CMDT2, and CMDT3. i.e., the values for the five middle bytes of the commands.

    Now, normally, I'd expect to see the command for turning on a device with this protocol as:

    SEND_STRING dvYAM, "$02, $00, $07, $0A, $01, $0D, $03"

    _BUT_ it says "HEX expression in ASCII" in the command switch section. So, I checked out the Cr$$$$on module for this device where I find the string for turning the device on to be:

    \x0207A1D\x03 Which I think translates to be:

    SEND_STRING dvYAM, "$02,'07A1D',$03"

    So, instead of encoding the middle five bytes as Hex, you need to put in the hex number as an ASCII character. Go figure (how stupid is that?) Or, you could code those middle five bytes as hex ($30,$37,$41,$31,$44).

    the off string would be:

    SEND_STRING dvYAM, "$02,'07A1E',$03"

    Does any of this make sense or help?
  • Rabbie13Rabbie13 Posts: 16
    Thanks Hedberg,

    Yes It does make sense and it is a great help, thank you very much.

    At least now I know that I have been sending the correct READY command string to the Yamaha. However, I haven't been getting the CONFIGURATION response. I'm pretty sure my cabling is OK (5 wire comms, as per protocol doc for RXV1600) and I have set the right communication parameters using the SET BAUD and HSON commands, but I still don't get the configuration response.
    I've tried sending the string from a Terminal Window in Netlinx Studio 2 and also from the OpenAxcess Program, but neither give me feedback. Should I be getting feedback in these programs?

    I can also see where your coming from with the YSP1 control. BTW, I could'nt find that thread using the search tool for ALL forums. So I just downloaded the YSP1 protocol doc from yamaha.com and took a look at it and I can understand all of what you have said.

    However, the protocol setup for the RX-V1600 looks different (PDF Attached) and I'm not sure how I should structure the string for that. Any chance you could give me your thoughts on that one?

    .RAB
  • HedbergHedberg Posts: 671
    It looks to me like the protocol is the same. To turn the device on (all zones), for example, should be:

    SEND_STRING dvYAM, "$02,'07A1D',$03"

    According to the doc, when you send the ready command, it should give the configuration reply. In other words, yes, you should be getting feedback. You should be able to see the response in the Open Axcess program.

    I note that the cabling described in the Protocol doc indicates it is crossed or Null modem wired. If the Yamaha has male pins on the DB9, you should try to connect with the same type of cable that you use to connect to your master from your computer. If you're not having success, try switching the wires. Note that if you connect 2 to 3 and visa versa, you will typically connect 7 to 8 and visa versa. One trick that you can try which sometimes eliminates a lot of messing around is to short pins 7 and 8 on the device (Yamaha) end. This tricks the device into doing it's own hardware handshaking. Also, you can connect two of the serial ports on the Axcent three together (null cable) and send string back and forth in order to practice setting up your software to see what you're sending and receiving.

    One recommendation: if you are going to be doing very much AMX programming, you should get yourself some decent terminal emulation software. That stupid windows program HyperTerminal is FUBAR and working through a Netlinx Studio terminal window (in my estimation) is almost as bad. I don't know the guy personally, but there is a fellow who obviously has AMX experience who has created a very handy terminal emulator called Indigo. Check out www.shadeblue.com. It does both RS232 and telnet (which is good for Netlinx masters but not Axcent). You can check it out on a trial basis.

    Following is that previous message about Yamaha protocol that I referred to
    Hi Rolo,
    Don't have a lot of time to spend on this issue but the first thing you must do is make the connection as descriped in the manual. Also it's important to use the hardware handshake (cts and rts). Dealing with hardware handshakes isn't easy. But maybe you can do the following trick to test things (aslong as you don't send the commands to quick to the device) Connect CTS and RTS together on the YSP-1 side in this way you fools the device because it thinks it's getting handshake.
    Next thing to do is to send the command to put the YSP-1 in host mode.It goes like this:

    SEND_STRING YSP-1,"$11,$00,$00,$00,$03"
    Where $11=DC1 ,$00 (3x) = no time out,$03=etx (see the ascii table on page 19 of the protocol)
    If you done this you must see the device give you back the configuration info. Then you know there is communication and you can go one with trying things.
    The sample i give you is what i would try when begining to program. Maybe there are other people who haved programmed this device before. I programmed once a Yamaha O2R96. It took me three weeks to get things work fine. Most important is that you read the protocoll very carefull. Ready it over and over it becomes more clear.
    Good luck
    __________________
    Leo de Blank
    ACE expert

  • Rabbie13Rabbie13 Posts: 16
    Excellent thanks,

    The protocol doc was my fault. It is as you you said. My Adobe Reader didn't have all the required updates, so the document wasn't complete on my system and didn't have the info you were referring to. Sorry about that....LOL

    I'll take your advice about the emulation software and the cabling and see how I go. I'll have to try this over the weekend, busy busy, so have a nice one.
  • DHawthorneDHawthorne Posts: 4,584
    A note on terminal programs.

    Yes, the version of Hyperterminal that comes with Windows is terrible. But if you upgrade to Private Edition, it works perfectly. I use it exclusively for both Telnet and RS-232 terminal applications.

    This is my usual routine when I have acommunications problem:

    Connect the device to my computer with a stock cable and Hyperterminal. If the computer won't connect that way, I throw a null modem adapter on the cable and see how that works. IF a stock cable doesn't work, I put a breakout box in line and start experimenting. Usually, it's a combination of RTS, CTS, DTR, and DSR connections that need to be made. Normally, a stock cable will do this, but some devices don't use standard signalling. Once I have it working, I make note on my breakout box what lines are high, and which are low. Then I connect with my AMX with the breakout in line, and make whatever wiring changes are necessary to duplicate the working configuration from Hyperterminal.

    If that sounds confusing, it's because it is :). I do not consider myself anything like an expert, but I have had good success getting some really odd devices to work. I even had a case where I had to splice a 9V power supply into one of the lines to force it high to make the thing talk. I use a breakout box I got from B&B Electronics.
  • Rabbie13Rabbie13 Posts: 16
    Got a little further today, but still having issues.

    I'm now getting some kind of response in the Open Axcess program from the yamaha, which I guess is the report command, albeit it's not readable. I've also noticed that this response is only given if the Receiver is already powered on and it will not respond if its in Standby. Bummer for powering it on using the AMX controller.

    I then tried sending a power off command, which translates to the following string of $02,07E7F,$00 as Hedberg has suggested. BTW, $02,'07E7F',$00 wouldn't send from the Open Axcess program. Something to do with syntax checking for the Axcent Pro3 maybe. Anyway, the receiver didn't do anything at all, although the comm port did respond with the exact same report command as for the previously sent Ready command.

    I then tried sending the string as all hex, ie. $02,$00,$37,$45,$37,$46,$03 but this just gave the same result. I tried various different ways to send the string but I still cannot get the receiver to do anything.

    I also tried the trick with shorting the pins 7&8 at the receiver end of the comms cable, but still the same.

    I've also tried taking the AMX controller out of the equation and just using PC to Yamaha connection, but I cannot find a decent Terminal emulator that will allow me to send strings through the comms port and watch the response like the AMX Open Axcess program does. They all just seem a little complex to set-up, although I'm inclined to beleive that this is the way to go initially.

    If anyone can advise a good comms program that would be great. Indigo was a bit to complex and Hyperterm PE doesn't have the functionality to send strings like the way the Open Axcess does.

    I've attached a couple of screen shots of the Open Axcess program.

    Still hoping.......

    Rab
  • Rabbie13 wrote:
    I then tried sending a power off command, which translates to the following string of $02,07E7F,$00 as Hedberg has suggested.

    The ETX command is $03, not $00, so if you were sending $00 the command isn't terminated properly.
    I then tried sending the string as all hex, ie. $02,$00,$37,$45,$37,$46,$03 but this just gave the same result.

    Try changing $00 to $30. '0' ascii is $30 hex

    Also, you mentioned being unable to find IR codes. You can pull the Phillips Pronto codes from a site like remotecentral and paste them into IRedit.

    --John
  • Rabbie13 wrote:
    I've also noticed that this response is only given if the Receiver is already powered on and it will not respond if its in Standby. Bummer for powering it on using the AMX controller.

    System commands and power commands can be received even when the unit not powered on.

    --John
  • HedbergHedberg Posts: 671
    Ok, it's very good that you have a response coming back from the Yamaha -- that implies to me that you've a good chance of being physically connected up properly and actually having the handshaking working. In my experience (which does not include this Yamaha device) if the device you're trying to communicate expects handshaking and doesn't get it, it won't send you a string at all. Also, the string appears to match what the protocol says it should: model = R0191 version H followed by 91 bytes of stuff.

    Now, as to trying to do this with Open Axcess: I don't know if it's possible, but it surely is not possible the way you are trying to do it. You are not sending the hex string to the device that you think you are sending. If you send the string $11 using Open AXCESS the way you are, you are _not_ sending the one byte string HEX11 to the device. You are sending three bytes, ie $, 1, 1. or, in HEX, that's HEX 24, HEX31, HEX31.
    You can see this, by the way. In the OpenAXCESS program in the popup for the serial ports, you can set the display for both the "sent" window and the "Received" window to hex by right clicking in the window and selecting the desired display. You can do this in the diagnostic popup as well. If you do this, you'll see the actual hex codes you are sending. Note that in the screenshots, you have ASCII only selected.

    So, I've not actually done this with a Yamaha device, but Open AXCESS, in the "Sent" pane, shows me a string that might turn your Yamaha on. the string to send is EXACTLY:

    ''2,'07A1D',3

    This expression has four parts:

    1. two single quotes which is a string of length zero. It looks like a double quote, but it is not, it's two single quotes.

    2. the decimal number 2 (followed by a comma) which just happens to be exactly equal to HEX02 which is STX

    3. The string literal 07A1D (followed by a comma). Note the single quotes to delimit the string

    4. decimal 3 (HEX03) which is ETX

    When I enter this into the "Send_Text" pane and hit "String", it seems to output the desired string with a HEX22 appended. I don't know what's up with that, but I'm guessing that your Yamaha may ignore it as it seems to be extraneous from the command delimitted with STX and ETX.

    Another thing that was the subject of discussion recently. Axcent3 serial ports will not receive in their default condition. In order to receive text on an Axcent3 serial port you must either have a buffer set up to receive the string or you have to send the device an RXON command. See the Axcent3 manual section on the serial ports. You seem to be getting proper strings back from the Yamaha so you must have already figured this out -- or maybe your Axcent3 has buffer management code already loaded into its program.
  • HedbergHedberg Posts: 671
    About using the HypertermPE software -- this is probably a lot easier than trying to coax OpenAXCESS into doing what you want. Just connect to your master and type in:

    echo on

    send_string 1,"$02,'07A1D',$03"

    that should turn the main power on. to turn it off:

    send_string 1,"$02,'07A1E',$03"

    As far as other terminal emulation software (and I just downloaded and looked at Hyperterminal PE and it looks ok) there are a bunch of possibilities. I've used a program called Realterm (just search for realterm in google) and it's pretty good, in my estimation, though it requires some experimentation.
  • Rabbie13Rabbie13 Posts: 16
    Hedberg, your a genius, that string works fine on the yamaha from the Open Axcess program.

    Cannot believe I missed that tip with the HEX display on the Open Axcess Serial Box. I could probably have sussed that my strings were rubbish ages ago.

    However, that's why us novices come here for your expert advice.

    Thanks very much, now I can really get busy and get down to the next step of learning to code the system.

    Cheers guys
Sign In or Register to comment.