Author Topic: Denon Receiver Control over Ethernet  (Read 17750 times)

cafedumonde

  • Veteran
  • ***
  • Posts: 122
    • View Profile
Denon Receiver Control over Ethernet
« on: June 30, 2016, 01:46:38 pm »
Hi all,

My LMCE system had been dormant and living in a box for the past few years but life will now afford me an opportunity to rebuild. I have been reviewing the wiki and forums for updates and I am planning my new build. Thanks to all of the developers for keeping the project alive, and a special shout to Tschak for all of the great videos.

My new system will use a Denon AVR3310, which allows for both serial and ethernet control. Support for serial is well documented but it seems that ethernet might also be an option. Release note 28682 for 14.04 briefly mentions updates to IP control for Denon. What is the status of ethernet control for Denon? Is it plug & play? Is it better than control over RS-232? Please provide status or experiences.

Thanks,

CDM
« Last Edit: September 05, 2016, 05:27:01 am by cafedumonde »

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #1 on: June 30, 2016, 08:09:48 pm »
The denon CI series responds to the exact same commands over ethernet as it does over serial.  A few differences, your amp has to be set to not use 'low-power mode' or it will not respond to power on from the ethernet interface.  Use the AVR/AVC (Ethernet) device to control the denon over ethernet.  Your other option is to use HDMI-CEC control, which works great for me here.

J.

cafedumonde

  • Veteran
  • ***
  • Posts: 122
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #2 on: August 13, 2016, 03:16:36 am »

Phenegma & Community,

It turns out that my receiver is an AVR-2307, which does not support Ethernet or CEC. The only option is RS-232. I have connected the receiver to my hybrid using a PCI serial port card with two ports and a db-9 cable. I do not know the pinout of the cable though there are male and female connectors, matching the genders on the equipment.

The wiki page, which is old, describes that this is plug&play. Trying the setup wizard, it is not detected on either port.

Trying to add the receiver manually, I selected Wizard > AV Equipment > Add Device and picked the AVR/AVC (Ethernet) template. It shows two serial ports, ttyS4 and ttyS5. I am ASSUMING that these correspond to the two on my PCI card. I tried both but still no luck after running AVWizard again to assign the inputs. Sending the "off" command through the Admin tool also does not work.

My normal troubleshooting approach with serial devices is to set up a dumb terminal on one side of the connection, send commands, and see the responses. This is the path I'll go down barring any advice. For starters it would be good to know if the use null modem connectors is typically required. Also, are there linux config files to validate the /dev/tty entries associated with my PCI card?

Thanks,

CDM

cafedumonde

  • Veteran
  • ***
  • Posts: 122
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #3 on: August 13, 2016, 02:21:15 pm »

I have had some success this morning. I have tested both serial ports using minicom, connecting them to each other and passing characters both ways with two terminal sessions. Connecting one port to the receiver, I am also able to see status change reports when I press buttons on the ir remote. So, I know which serial port I am on and I know that it is working. I am also receiving characters from the AVR-2307. However, typed characters are not echoed and the receiver does not respond to commands.

Connecting the serial port to the terminal and running AVWizard, I also do not see any characters coming out of the port.

Is this device really plug & play? Is there a detection script? If so, where is it? Is there a way I can trigger it manually?

Also, if there is not a script, how can I add the device manually?

CDM

cafedumonde

  • Veteran
  • ***
  • Posts: 122
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #4 on: August 13, 2016, 02:58:21 pm »

More success but no prize just yet....

I found the detection script which appears to be /usr/pluto/pnp/20_DenonReceiver.sh

Looking at the script, I modified the detection command in order to run from the command line:

Code: [Select]

/usr/pluto/bin/TestSerialPort -p /dev/ttyS5 -P N81 -b 9600 -t "PWSTANDBY\r\s500mPWON\r" -i 1 -s "MON\r"


This works!!! The receiver power cycles as expected.

I now know the following:

1. the serial ports on the PCI card work
2. the serial interface on the receiver works
3. they are communicating in both directions
4. LMCE has a detection script for the Denon over RS-232

However, AVWizard does not seem to trigger this script. Is there another way to trigger? Will it trigger automatically if I wait long enough?

CDM



Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Denon Receiver Control over Ethernet
« Reply #5 on: August 13, 2016, 03:42:57 pm »
It takes a while.

Also, make sure that the PCI card ports got detected. They should show up in web admin.

A tip from the trenches: After your stuff got detected, go ahead and disable serial detection for the media director. Otherwise, LinuxMCE does sometimes mix up stuff.

darkwizard864

  • Veteran
  • ***
  • Posts: 131
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #6 on: August 13, 2016, 03:53:03 pm »

cafedumonde

  • Veteran
  • ***
  • Posts: 122
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #7 on: August 13, 2016, 04:13:21 pm »
Posde,

It looks like LMCE has registered the serial ports. Looking in WebAdmin HOME > MyDevices > CORE , the Available Serial Ports box shows both ports and one that I think is my USB UIRT:

/dev/ttyS4,/dev/ttyS5,pci0000:00/0000:00:1d.0+1.2

Does reloading the router trigger detection? Is there a log file I can look at?

--------------------------

Updating the post...

I tried to connect to the port again using minicom. LMCE is running, with a video paused. I get the fiollowing when trying to connect to /dev/ttyS5..

Code: [Select]

Device /dev/ttyS5 is locked.
root@dcerouter:~# ls -la /dev/ttyS5
crw-rw---- 1 root dialout 4, 69 Aug 13 07:46 /dev/ttyS5
root@dcerouter:~#


Not sure if this is good or bad. Does this mean that LMCE has locked the port? Otherwise could this be a file permission issue and LMCE is locked out? Again, an LMCE log file might give a clue.

CDM
« Last Edit: August 13, 2016, 04:40:50 pm by cafedumonde »

cafedumonde

  • Veteran
  • ***
  • Posts: 122
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #8 on: August 13, 2016, 09:32:22 pm »

More progress but still no prize...

I modified the Denon detection script /usr/pluto/pnp/20_DenonReceiver.sh to create a tool for testing the detection. I found that it only works intermittently on my machine. The detection depends on the contents of "$?" in the script after sending a command over the serial port to the Denon.

The test script, DenonPNPTest.sh

Code: [Select]

#!/bin/bash                                                                                                                             

echo "Denon Detection script queue $2"
echo "Arg1=$1 Arg2=$2 Arg3=$3 Arg4=$4"
/usr/pluto/bin/TestSerialPort -p $3 -P N81 -b 9600 -t "PWSTANDBY\r\s500mPWON\r" -i 1 -s "MON\r"
if [[ "$?" -ne 0 ]]; then
echo "It's not a Denon Receiver Resp=$?"
# /usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 0                                                               
else
echo "It is a Denon Receiver Resp=$?"
# /usr/pluto/bin/MessageSend dcerouter -r 0 $1 1 806 224 $2 13 "$4" 44 71                                                               
fi


 And the output of several runs, with lines added in between for readability....

Code: [Select]

root@dcerouter:/usr/pluto/pnp# ./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
It's not a Denon Receiver Resp=!!0

root@dcerouter:/usr/pluto/pnp# !!
./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
PWSTANDBY\rZMOFF\rZ2OFF\rPWON\rZMON\rZ2ON\r
It is a Denon Receiver Resp=1

root@dcerouter:/usr/pluto/pnp# !!
./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
It's not a Denon Receiver Resp=0

root@dcerouter:/usr/pluto/pnp# !!
./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
It's not a Denon Receiver Resp=0

root@dcerouter:/usr/pluto/pnp# !!
./DenonPNPTest.sh foo foo /dev/ttyS5 foo
Denon Detection script queue foo
Arg1=foo Arg2=foo Arg3=/dev/ttyS5 Arg4=foo
It's not a Denon Receiver Resp=0

root@dcerouter:/usr/pluto/pnp#


Could it be that the command is somehow taking too long to populate "$?"  ???

I am not a bash scripter but could I just capture the string returned directly from the serial port test and decide the detection on that? It is frustrating that "$?" does not work reliably given that it is a standard bash scripting feature.

Feedback from developers would be appreciated. Thanks.

CDM

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #9 on: August 13, 2016, 10:41:18 pm »
You're issue $? incorrectly.  I'm on my phone an really unable to respond more than that.  I'll try to elaborate whenever I get home.

Sent from my Nexus 5 using Tapatalk


cafedumonde

  • Veteran
  • ***
  • Posts: 122
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #10 on: August 17, 2016, 01:35:22 am »

Phenegma,

Please follow up on your comment regarding $?. Please check the file for this script in your installation. I did not change this.

After many days, the detection script has not run. Is there a way to trigger?

CDM

phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #11 on: August 17, 2016, 01:54:41 am »
As soon as I have a moment to I will have a look.

Sent from my Nexus 5 using Tapatalk


phenigma

  • LinuxMCE God
  • ****
  • Posts: 1758
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #12 on: August 29, 2016, 02:47:31 am »
Phenegma,

Please follow up on your comment regarding $?. Please check the file for this script in your installation. I did not change this.

After many days, the detection script has not run. Is there a way to trigger?

CDM
The PNP scripts will run after a router reload on each MD that has an un-allocated (unused) serial port.

First thing I see now that I have some time is that you seem to have added the "Resp=$?" portion to the echo command, it will not give you the output you are expecting, but the output of the IF statement result.  The "$?" returns the exit code of the last command executed. 

Second thing is "PWSTANDBY\rZMOFF\rZ2OFF\rPWON\rZMON\rZ2ON\r", which shows in your testing output is not the same as what the script you posted is sending, you must be testing with a different script.  This script should be short and only enough to confirm that it responds to commands, adding in zone power off/on is adding a lot of extra commands that are not necessary for detecting the receiver.

You also indicate that the script works 'sometimes' but not others.  This is usually a result of serial based devices that decide not to respond, they can get 'confused' usually based on some bad codes or text sent to its' port.  Some serial devices are really susceptible to this.  If the script works 'sometimes' I would suggest that the exact sequence of commands could be altered or more pause/delay after each command.  The receiver needs to have time to respond prior to another command being sent.

The Denon detection script has worked for me here on my Denon 3311CI.  That was when I first purchased the amp, since then it does not need to be re-detected.  Honestly my best recommendation is to add the device manually if the detection script isn't doing its' thing properly.  After that it's never required again.

J.

cafedumonde

  • Veteran
  • ***
  • Posts: 122
    • View Profile
Re: Denon Receiver Control over Ethernet
« Reply #13 on: August 30, 2016, 02:15:10 am »

Phenigma,

Thanks very much for looking into this. I will compare my carefully compare my test script to the original in order to appreciate what you have highlighted. My skills are very rusty butI will play with the script some more, and try to adjust the timing of the commands. I would really like to add the device automatically in order to ensure that it is done without error.

Looking at the device templates in WebAdmin, Developers > Device Templates, two are listed: AVC-A1SRA (RS-232) and AVR/AVC series (ethernet). Which should I use? I want to use an AVR device with RS-232.  Is there a device template number?

Sorry to be dense. Obviously if all of the RS-232 commands are the same then it won't matter.

Thanks again.

CDM








Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
Re: Denon Receiver Control over Ethernet
« Reply #14 on: August 31, 2016, 10:44:00 am »
In theory both should work. The RS-232 is the original one, whereas the Ethernet one has been created later.