PDA

View Full Version : RS232 control of Harman Kardon AVR635



lmm
June 4th, 2005, 10:49 PM
The HK AVR 635 has a bi-directional protocol.

Well, the receiver continuously blasts over the RS232 port the contents of its front panel display. Commands have a prefix "MPSEND" and a checksum check word at the end.

Anyway, I'm trying to figure out whether I can use this with Girder, or whether I have to write my own application to read the RS232 port. Seems like it would have to continuously wake up to read the state and stuff it into some state variable, though.

Any ideas?

Mark F
June 5th, 2005, 07:47 AM
You should be able to do this with Girder, the Serial plugin and LUA (state) variables. Others have used Girder to auotmate their AVR525s and other receivers.

Could you supply a link to the RS-232 protocol document for the AVR 635? (or attach a .zip file containing the document here) This would allow me to help you more. :)

aok
December 3rd, 2005, 08:40 AM
Trying to resurrect this thread, as I'm not having much luck getting Girder to communicate with my 635. I've attached the word .doc that supposedly "explains" the necessary settings, but it's mostly Greek to me. I can see what the port settings need to be, but beyond that (transmit and receive tweaks) I am totally lost. Any help would be much appreciated.

p.s. If possible, please explain what the LUA (state) variables pertain to (I'm a Girder newbie). Am I correct that they are only needed if one wants to interpret feedback from the AVR?

Promixis
December 3rd, 2005, 08:49 AM
This shold be controlable from Girder. You will need to compute a checksum to add to commands. We can help you getting this working with G4 but not G3.3

aok
December 3rd, 2005, 09:07 AM
We can help you getting this working with G4 but not G3.3

Meaning its not possible with G3.3, or that you no longer support it? Any further tips on computing the checksum (not even sure what that means :oops: ) would be much appreciated.

Promixis
December 3rd, 2005, 09:15 AM
We can help you getting this working with G4 but not G3.3

Meaning its not possible with G3.3, or that you no longer support it? Any further tips on computing the checksum (not even sure what that means :oops: ) would be much appreciated.

We still support 3.3 but are not longer adding any additional functionality. Its doable on 3.3 though. The protocol requires you to compute a checksum which is used to make sure the command is good.

aok
December 3rd, 2005, 10:32 AM
The protocol requires you to compute a checksum which is used to make sure the command is good.

I'm sorry to be so dense, but if you have a spare moment can you point me in the direction of any documents, links, etc. where I might be able to educate myself on what this means, in specific terms, for how to configure Girder correctly. I'd rather stick with Girder 3.3 for now (I'm primarily an Xlobby user, which may have its own RS-232 functionality in the near future, and I'd rather not buy Girder 4 for one small thing I will no longer need).

Bountiful thanks for your time.

lmm
December 5th, 2005, 03:42 PM
Apparently the 635 sends a continuous stream of data out of its RS232 port, always showing the front panel state of the device.

However, Windows XP Pro, when booting, attempts to do device detection on its RS232 ports to see if there is a serial mouse or some other device connected, and the continuous stream of data from the HK 635 seems to have confused it -- my system would crash and it would go into a reboot cycle. So, to reboot the computer, I'd have to detach the 635 first.

On reading the data from the 635, you can ignore the checksum. On writing data to the 635, you can precompute the checksum, but I wasn't successful.

Promixis
December 5th, 2005, 04:09 PM
Apparently the 635 sends a continuous stream of data out of its RS232 port, always showing the front panel state of the device.

However, Windows XP Pro, when booting, attempts to do device detection on its RS232 ports to see if there is a serial mouse or some other device connected, and the continuous stream of data from the HK 635 seems to have confused it -- my system would crash and it would go into a reboot cycle. So, to reboot the computer, I'd have to detach the 635 first.

On reading the data from the 635, you can ignore the checksum. On writing data to the 635, you can precompute the checksum, but I wasn't successful.

strange :)

I wonder if that would happen if you connected via a usb -rs232 dongle?

aok
December 7th, 2005, 08:12 AM
How about booting the computer when the 635 is powered off? In any case, I haven't experienced the same problem and I'm also running XP. Is it also possible that you have the wrong kind of cable (you don't want a null-modem cable, you want a straight through DB-9 male to DB-9 female RS232 cable like one of these (http://www.radioshack.com/product/index.jsp?productId=2036255).

nwang
February 12th, 2006, 04:30 PM
Apparently the 635 sends a continuous stream of data out of its RS232 port, always showing the front panel state of the device.

However, Windows XP Pro, when booting, attempts to do device detection on its RS232 ports to see if there is a serial mouse or some other device connected, and the continuous stream of data from the HK 635 seems to have confused it -- my system would crash and it would go into a reboot cycle. So, to reboot the computer, I'd have to detach the 635 first.


My XP install occasionally detects the 635 as a serial mouse also, but it does successfully boot up. Unfortunately, when the serial mouse is "detected", XP seems to grab control of the serial port, denying access to any other program.

I was able to work around this issue by going into "Device Manager" and disabling the serial mouse. This setting appears to be consistent across reboots! If you can somehow get XP to boot up (safe mode?), maybe my solution would work for you as well.

nwang
February 12th, 2006, 04:40 PM
Trying to resurrect this thread, as I'm not having much luck getting Girder to communicate with my 635. I've attached the word .doc that supposedly "explains" the necessary settings, but it's mostly Greek to me. I can see what the port settings need to be, but beyond that (transmit and receive tweaks) I am totally lost. Any help would be much appreciated.

p.s. If possible, please explain what the LUA (state) variables pertain to (I'm a Girder newbie). Am I correct that they are only needed if one wants to interpret feedback from the AVR?

I looked all over the web for the serial port interface information, and this is the only place where I found it!

I was able to get it working, but I hacked together a solution with freeware. So I can't help with your Girder specific questions. I just wanted to point out some things that were missing in the word document, to help save some frustration for future readers.

1) The data type and length fields are not specified in ASCII - they should be transmitted as 0x2, 0x3, 0x4, and 0x30. In hindsight, this makes sense - but I initially assumed it was ASCII because the Transmission field was specified as such.
2) In generating the check word, the transmission field is made up of 2 byte words. This was never stated explicitly in the word document. It would have been nice to include the check words in the list of commands :). E.g., the power on command is 0x80 0x70 0xc0 0x3f, so the check word is 0x30 0x4f (0x80 ^ 0xc0 = 0x30, and 0x70 ^ 0x3f = 0x4f).

Hopefully this clears up more than it confuses!!!

aok
February 15th, 2006, 04:57 PM
I was able to get it working, but I hacked together a solution with freeware. !

Any chance you'd be willing to share your secret with the freeware apps? I'd rather do this w/o Girder anyway... If so, please email me: mb@mindserai.com

Many thanks in advance...

barca0
March 11th, 2006, 07:49 PM
mike (& Co.),

i guess i have to come back to your offer for some help on this issue. I tried nwangs solution and it works just fine (txs again nwang). so appearently the whole rs232 stuff should be fine. now I tried so send the very same hex code with girder and (almost) nothing happens. the log shows the sent hex code, there is a return from the amp (it is always the same) and a message saying that no answer was recieved.


Serial: HK 435 : Simple Send: 50 43 53 45 4E 44 02 04 80 70 9F 60 1F 10 00 PCSEND..€pŸ`...
Serial: HK 435 : Simple Receive: Data Code: 16384
Serial: HK 435 : ERROR: No response to last command

for "amp off" I send

504353454e44020480709f601f1000
from the tree with "hex" ticked

and this is my ini file:

local device = serial.Classes.Simple:New({

Name = "HK 435",
Description = "HK Audio Video Receiver",

BaudRate = 38400,
Parity = 0,
StopBits = 1,
DataBits = 8,
FlowControl = 'N',
GlobalName = 'Harman_Kardon',

Initialize = function (self)
gir.LogMessage(self.Name, 'Communications OK',3)
self.Status = "Communication OK"
return serial.Classes.Queued.Initialize (self)
end,
})
serial.AddDevice(device)


pls - this is the last part in the puzzle

thanks in advance
barca

Rob H
March 12th, 2006, 02:35 AM
Not sure if this is the problem, but you are basing your device on serial.Classes.Simple but then calling serial.Classes.Queued.Initialize from your own Initialize function.

I'd try changing the serial.Classes.Simple to serial.Classes.Queued first and let's see where that gets us.

barca0
March 12th, 2006, 06:02 AM
edit: with both "qeued" it says


Serial: HK 435 : Command queued: 50 43 53 45 4E 44 02 04 80 70 9F 60 1F 10 00 PCSEND..€pŸ`... at postion 1
Serial: HK 435 : Simple Send: 50 43 53 45 4E 44 02 04 80 70 9F 60 1F 10 00 PCSEND..€pŸ`...
Serial: HK 435 : Simple Receive: Data Code: 16384
Serial: HK 435 : ERROR: No response to last command

with both "simple"


Serial: HK 435 : Simple Send: 50 43 53 45 4E 44 02 04 80 70 9F 60 1F 10 00 PCSEND..€pŸ`...
Serial: HK 435 : Simple Receive: Data Code: 16384
Serial: HK 435 : ERROR: No response to last command

by the way, when varying commands once I received this massive data stream from the amp described above and once it says "ERROR:incomplete response..." but I canīt reproduce either. let me know if you need more information.

Promixis
March 12th, 2006, 10:37 AM
edit: with both "qeued" it says


Serial: HK 435 : Command queued: 50 43 53 45 4E 44 02 04 80 70 9F 60 1F 10 00 PCSEND..€pŸ`... at postion 1
Serial: HK 435 : Simple Send: 50 43 53 45 4E 44 02 04 80 70 9F 60 1F 10 00 PCSEND..€pŸ`...
Serial: HK 435 : Simple Receive: Data Code: 16384
Serial: HK 435 : ERROR: No response to last command

with both "simple"


Serial: HK 435 : Simple Send: 50 43 53 45 4E 44 02 04 80 70 9F 60 1F 10 00 PCSEND..€pŸ`...
Serial: HK 435 : Simple Receive: Data Code: 16384
Serial: HK 435 : ERROR: No response to last command

by the way, when varying commands once I received this massive data stream from the amp described above and once it says "ERROR:incomplete response..." but I canīt reproduce either. let me know if you need more information.

Don't worry about the ERROR: .... that just means G4 didn't hear back from the amp.

Did the commands you sent work?

barca0
March 12th, 2006, 11:41 AM
well, no. the amp is quite unimpressed...

it works with nwangs solution though. he uses a serial program with the following parameters (I hope itīs ok that I am posting his stuff):

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "F:\Program Files\BEL\Realterm\realterm.exe baud=38400 port=1 flow=0 data=8N1 visible=0 sendquit=f:\control\avr_on_binary.txt",7,false"

and I took the hex codes that I am using in girder exactly from the file he is calling in this script

Promixis
March 12th, 2006, 11:43 AM
can you attach the entire lua file here?

barca0
March 12th, 2006, 11:49 AM
what I called ini file in my first post is all.
then I use the serial command in the tree to send the code. Am I missing the point? :-)

Rob H
March 12th, 2006, 05:50 PM
Change

StopBits = 1
to

StopBits = 0

barca0
March 13th, 2006, 05:09 AM
makes no difference. girder opens the com port (a logger cannot access it while girder is active). I looked into the code coming from the amp - exactly like in the spec. I double checked the hex code that I am sending. I guess thatīs what you would call clueless.....

Rob H
March 13th, 2006, 05:13 AM
Add the following line after the GlobalName = ... line


LogLevel = 0,
Then post the output from the interactive Lua console

barca0
March 13th, 2006, 05:42 AM
Serial: HK 435 : Opened Device: HK 435 Port: 1 Settings: 38400 N 0 8 1
Serial: HK 435 : Callback Installed 2
Serial: HK 435 : Simple Send: 50 43 53 45 4E 44 02 04 80 70 9F 60 1F 10 00 PCSEND..€pŸ`...
Serial: HK 435 : Simple Receive: Data Code: 16384
Serial: HK 435 : ERROR: No response to last command

Rob H
March 13th, 2006, 06:53 AM
I'm not clear where that trailing 00 comes from that you're sending. That doesn't seem to be right

Rob H
March 13th, 2006, 06:58 AM
Can you post the avr_on_binary.txt file?

barca0
March 13th, 2006, 07:09 AM
I see your point. the hex code I typed in the serial command has no trailing spaces though.

edit: These "00" belong to the checkword

I compared it to some other logs and there might be leading spaces (here F0 follows straight after Data):

Serial: Russound CAV6.6 : Simple Receive: Data F0 7D 00 00 00 00 7......


In this other program you can dump the file I attached to the com port. that works. but when I enter the same code manually it doesnīt. At least in the format "0x50 0x43 ...." it appears in the logger window in the same form as the data that comes from the amp. It might be that "5043..." and send as hex is not the right format. (but I guess I tried every possible combination though)

Rob H
March 13th, 2006, 07:20 AM
Can you try this one instead - the one you've been using has two CRLFs at the end. If this one fails to work then we may have a solution.

barca0
March 13th, 2006, 07:51 AM
sorry, my fault. the "on" command is not working from the other program either. can we do the same thing with mute?

Rob H
March 13th, 2006, 07:58 AM
okay, and that one works when using RealTerm?

barca0
March 13th, 2006, 07:59 AM
yes

Rob H
March 13th, 2006, 08:02 AM
can you post the log of what happens when you try that one with Girder?

barca0
March 13th, 2006, 08:10 AM
this is what I send with the "Serial Send Action" as Hex (mute command)


504353454e4402048070c13e414e00

and this is the log


Serial: HK 435 : Command queued: 50 43 53 45 4E 44 02 04 80 70 C1 3E 41 4E 00 PCSEND..€pÁ>AN. at postion 1
Serial: HK 435 : Simple Send: 50 43 53 45 4E 44 02 04 80 70 C1 3E 41 4E 00 PCSEND..€pÁ>AN.
Serial: HK 435 : Simple Receive: Data Code: 16384
Serial: HK 435 : ERROR: No response to last command

Rob H
March 13th, 2006, 08:12 AM
Try it without the 00 at the end - it's not part of the command

barca0
March 13th, 2006, 08:43 AM
yeeeeees - that was it!

when I am done, I will post the whole thing here.
thanks a lot for your help!!

barca

Rob H
March 13th, 2006, 09:03 AM
:)
You might also want to add the following function


Command = function(self, words, asHex)
local data
if asHex then
data = serial.hextobyte(words)
else
data = words
end
local csodd = 0
local cseven = 0
for i = 1, string.len(data) - 1, 2 do
csodd = math.bxor(csodd, string.byte(data, i))
csevent = math.bxor(cseven, string.byte(data, i + 1))
end
self:SendCommand('PCSEND'..serial.hextobyte('0204' )..data..csodd..cseven)
end,


That should, in theory, calculate the checksum for you - you'd call it from
a GML using e.g. Harman_Kardon:Command('8070C13E', true)

barca0
March 14th, 2006, 03:59 AM
good idea. I already started hard wiring it with an online xor calculator. at some point I might add to readout the hk display, which is kind of cool too.

anyways, thatīs it.

Promixis
March 14th, 2006, 07:42 AM
thanks,

would you mind uploading to http://www.promixis.com/uploads_list.php

that way its easy for everyone to see, and you get your name in lights :D

cjean
August 30th, 2007, 11:19 PM
good idea. I already started hard wiring it with an online xor calculator. at some point I might add to readout the hk display, which is kind of cool too.

anyways, thatīs it.


Hi barca0,

Can you have a look at this? I have an AVR 445 that use the same protocol. I have a serious problem in sending the commands reliably. It works but it seems that Girder is struggling with all the incoming traffic from the receiver. I can send commands but the receiver just can't get them all the time. I have disabled all I could in Girder but still the same. Do you have the same problem?

I'm looking for a solution!

Thank you

Charles