PDA

View Full Version : Serial plug-in for Denon receivers



FearTheDentist
January 4th, 2006, 03:56 AM
Well, after a hiatus of several months (sorry) I've finally finished the plugin for serial control of Denon receivers, as well as a .gml and basic .ccf to go along with it. I've only tested this on an AVR-3803, but I've implemented most everything in the latest release of the serial protocol fom Denon, so (hopefully) it should function for pretty much all of them. I would think that with minor modification it work with the latest models with an ethernet connection as well, but I haven't been able to test this.

I've tried to make this as organized and user-friendly as possible (my goal was to put together a package a newbie can drop into their setup and have up and running pretty much "right out of the box". This is my first plug-in so I'm sure there are a few things I neglected to consider, so please post any requests or construcive feedback and I'll see what I can do. I'd also appreciate it if people would post their success or failures with different models of receiver.

Enjoy!

Promixis
January 4th, 2006, 08:46 AM
Cool, if you want, you can also place the file in our downloads area. You goto developer/upload from the fron web page.

FearTheDentist
January 4th, 2006, 03:49 PM
It's already there, just waiting your approval :)

Promixis
January 4th, 2006, 04:24 PM
approved ;)

GadgetComa
January 4th, 2006, 07:20 PM
Thank you! As a newbie with ancient (read - unusable) programming skills, I can attest to the fact that this plugin does work just by dropping in place. I have a Denon 4802R and so far, it's working fine, although I've only used Source, Power and Volume so far. I hope to play around some more and find what the 4802R does that may not be covered yet. Maybe I can help add to it.

Thanks again!

- Leon

FearTheDentist
January 4th, 2006, 11:18 PM
Great, I'm glad to hear that! Hopefully you'll find everything works- I think the serial protocol is the same for all AVR line receivers, and I implemented just about everything listed in the protocol even if it wasn't supported on my 3803.

Load the .CCF in NR and play around with it- it's pretty straightforward. Let me know how everything works!

ellisr63
January 4th, 2006, 11:25 PM
Hi,
Will this also work for G3?

tia,
Ron

FearTheDentist
January 4th, 2006, 11:58 PM
No, this one will only work w\ G4, but use this .ini file:
http://www.promixis.com/php/drops/DENON3805-bidirectional.ini
and this .GML file (DONT use the .ini in the archive, use the above one instead):
http://www.promixis.com/download.php?ID=620 and you should be good.

HOWEVER-

You're going to have to make the jump to G4 sooner or later, the sooner you do it the less painful. The file I wrote for G4 is about as user friendly as it gets (in this realm) so it's a good "jumping off place" to get started w\ G4. Give it a try- you won't regret it. Once you get past the initial learning curve, G4 is so much more user friendly and flexible you'll wonder why you waited so long.

ellisr63
January 5th, 2006, 12:02 AM
I know...I am still trying to get LDJ setup and it is only avail for G3

FearTheDentist
January 5th, 2006, 12:04 AM
I'm kinda in limbo for the same reason (we gotta start cracking the whip!). Fortunately M1Duckett just released the plugin for my Sony777ES changer :) Thanks a step in the right direction!

ellisr63
January 12th, 2006, 01:10 AM
Well, after a hiatus of several months (sorry) I've finally finished the plugin for serial control of Denon receivers, as well as a .gml and basic .ccf to go along with it. I've only tested this on an AVR-3803, but I've implemented most everything in the latest release of the serial protocol fom Denon, so (hopefully) it should function for pretty much all of them. I would think that with minor modification it work with the latest models with an ethernet connection as well, but I haven't been able to test this.

I've tried to make this as organized and user-friendly as possible (my goal was to put together a package a newbie can drop into their setup and have up and running pretty much "right out of the box". This is my first plug-in so I'm sure there are a few things I neglected to consider, so please post any requests or construcive feedback and I'll see what I can do. I'd also appreciate it if people would post their success or failures with different models of receiver.

Enjoy!

Is it possible to get the codes from you so I can use them in Girder 3? I'll input them myself and upload em for others to use.
tia,
Ron

FearTheDentist
January 12th, 2006, 12:00 PM
Is it possible to get the codes from you so I can use them in Girder 3? I'll input them myself and upload em for others to use.
tia,
Ron

Glad to, but Im not sure what you're asking for? Check and see if this plugin has what you're loonkg for:
http://www.promixis.com/download.php?ID=620. BUT- don't use the serial definition file included w\ the plugin (the .ini file)- replace it with this one: http://www.promixis.com/download.php?ID=840. If this doesn't have what you need let me know what you're looking for and I'll be glad to post it. ;)
Brian

ellisr63
January 16th, 2006, 03:09 AM
No, this one will only work w\ G4, but use this .ini file:
http://www.promixis.com/php/drops/DENON3805-bidirectional.ini
and this .GML file (DONT use the .ini in the archive, use the above one instead):
http://www.promixis.com/download.php?ID=620 and you should be good.

HOWEVER-

You're going to have to make the jump to G4 sooner or later, the sooner you do it the less painful. The file I wrote for G4 is about as user friendly as it gets (in this realm) so it's a good "jumping off place" to get started w\ G4. Give it a try- you won't regret it. Once you get past the initial learning curve, G4 is so much more user friendly and flexible you'll wonder why you waited so long.

Where do I put the ini file?
tia,
Ron

ellisr63
January 17th, 2006, 09:42 PM
quick question... Do you use a Null modem cable for the Denon?
tia,
Ron

FearTheDentist
January 18th, 2006, 12:16 AM
Where do I put the ini file?
tia,
Ron

I just have it in my G3 dir., but don't think it matters.
From G3 File->settings->Plugins->select Generic Serial and click settings, click import and select your .ini file. Assign it to the correct com port.

As to serial cable; it's a DB9 to 3.5mm stereo. Rather than try to find one I just made it. I'm attaching .jpg's of the pinouts, basically you only use pins 2, 3, and 5 of the DB9.

ellisr63
January 18th, 2006, 02:00 AM
[quote]

Where do I put the ini file?
tia,
Ron

I just have it in my G3 dir., but don't think it matters.
From G3 File->settings->Plugins->select Generic Serial and click settings, click import and select your .ini file. Assign it to the correct com port.

As to serial cable; it's a DB9 to 3.5mm stereo. Rather than try to find one I just made it. I'm attaching .jpg's of the pinouts, basically you only use pins 2, 3, and 5 of the DB9.[/quote
Why do you use a db9 to 3.5mm stereo? Doesn't your Denon have a rs232 port? Mine has a rs232 port so what whould be the pin out on each end?
tia,
Ron

Rob H
January 18th, 2006, 06:25 AM
It's just a normal serial cable, as you'd use for a modem

FearTheDentist
January 18th, 2006, 03:22 PM
Why do you use a db9 to 3.5mm stereo? Doesn't your Denon have a rs232 port? Mine has a rs232 port so what whould be the pin out on each end?
tia,
Ron

Nope- mine has a 3.5mm stero plug for the serial connection, not a DB9.

ellisr63
January 18th, 2006, 03:59 PM
I have tried a serial cable....nothing happens..I am getting "Bad command passed to the Serial Plugin". Any idea why? Also the logger shows nothing at all being sent.
tia,
Ron

Rob H
January 18th, 2006, 04:50 PM
Is that for every command?

Promixis
January 18th, 2006, 05:26 PM
Ron,

open the denon.lua file and change the loglevel to 0

ellisr63
January 18th, 2006, 10:06 PM
Is that for every command?
Rob,
Yes it is....But if I go in and select the com port again...on some of the commands it will say that it was sent...but still nothing happens.
Ron

ellisr63
January 18th, 2006, 10:06 PM
Ron,

open the denon.lua file and change the loglevel to 0

Mike,
I will try that tonight..
tia,
Ron

ellisr63
January 19th, 2006, 01:58 AM
there is no Lua file that I could find.. This all I have and this is in my plugins dir.

Ron

Rob H
January 19th, 2006, 04:45 AM
The .lua file will be in the plugins\serial directory

ellisr63
January 19th, 2006, 10:41 AM
The .lua file will be in the plugins\serial directory
Al I have is the gml and ini files

Promixis
January 19th, 2006, 11:46 AM
.ini is for G3.3

the G4 files are here http://www.promixis.com/download.php?ID=897

FearTheDentist
January 19th, 2006, 08:49 PM
I'm confused Ron- are you trying to get this working in G3 or G4? You need completely different files for each. If it's G3, it would probably be best to start a new thread in that forum to avoid confusion. It's pretty straightforward in either G3 or G4, but we have to make sure we're "speaking the same language" ;). I'd strongly recommend at least giving G4 a try if you haven't already.

ellisr63
January 19th, 2006, 09:00 PM
I'm confused Ron- are you trying to get this working in G3 or G4? You need completely different files for each. If it's G3, it would probably be best to start a new thread in that forum to avoid confusion. It's pretty straightforward in either G3 or G4, but we have to make sure we're "speaking the same language" ;). I'd strongly recommend at least giving G4 a try if you haven't already.

Sorry about the confusion...I am still trying G3 and I used both of the files you said to download for G3.....Once I have success I plan on trying to merge to G4 as I am getting at least one Sony 777es dvd changer(hopefully 3) this month. Then I will try to setup the Autopatch and the Russound in G4. I would just like to get these working before I jump to G4 (get the gml setup with all the macros and such first).
tia,
Ron

ellisr63
January 22nd, 2006, 12:35 PM
Ok.....I finally nstld G4..Denon seri still doesn't work.Now my error is....


Script Error:Logic Error. (Check Lua Console)

Rob H
January 22nd, 2006, 12:46 PM
And what does it say in the Lua console?

ellisr63
January 22nd, 2006, 03:40 PM
here is a pic

FearTheDentist
January 22nd, 2006, 10:08 PM
I think there's a communication problem w\ your Denon. Open the logger and Lua console and trigger a few actions w\ the Denon remote (volume change, power, whatever..) If your serial link is configured properly you'll see feedback in the logger and\or lua console. Given the description of the problems you've been having I'm pretty positive it's a problem w\ the serial link, not G3 or G4. Are you able to communicate w\ any other serial devices?

ellisr63
January 23rd, 2006, 01:14 PM
I switched the comm port to com#2 and it still won't work (my russound worked fine here)....interesting thing is, if I manually raise the volume or switch inputs the logger shows commands. Now this is in G3. I will have to look at logger in G4 and see if I am getting the same response back from the denon when it is manually controlled.
Ron

Rob H
January 23rd, 2006, 04:36 PM
If you open the variable inspector do you see a table called Denon ?

ellisr63
January 23rd, 2006, 05:52 PM
If you open the variable inspector do you see a table called Denon ?

Yes I do. I have attached the screen shot. Interesting thing is in G4 I can't control the denon from G4 but I can see it log when I manually select inputs and when I change the volume it crashes. now in G3 I have the same results but it will not crash.
tia,
Ron

Rob H
January 23rd, 2006, 06:09 PM
I'm guessing that you've tried the PowerOn and PowerOff commands from the gml?

They both appear to have a bug in that they refer to self.PowerMain - this should be Denon.PowerMain

However, that shouldn't really have any impact on the problem

ellisr63
January 23rd, 2006, 08:12 PM
I'm guessing that you've tried the PowerOn and PowerOff commands from the gml?

They both appear to have a bug in that they refer to self.PowerMain - this should be Denon.PowerMain

However, that shouldn't really have any impact on the problem

Yes I have tried power on and off and I only get the error...not even a log response. It is strange that G3 isn't sending out a correct command but that it does receive commands from the Denon.

Ron

FearTheDentist
January 23rd, 2006, 11:01 PM
I'm guessing that you've tried the PowerOn and PowerOff commands from the gml?

They both appear to have a bug in that they refer to self.PowerMain - this should be Denon.PowerMain

However, that shouldn't really have any impact on the problem

Are you referring to the "Power On" and "Power Off" in the .GML where I have:
Denon:PowerOn ()
NetRemote.SendLabel ('power', (self.PowerMain))

This is redundant, must have forgotten to remove it. However- I'm concerned now, because if you look through the associated .LUA file you'll notice pretty much all of the commands are self.*** I thought I wanted to do it this way, did I do wrong?

Ron- is it possible your com port is misconfigured? The port should be set to 9600,N,1. I'm wondering if maybe it's set to a higher speed or something? Is anyone else having this problem?

ellisr63
January 24th, 2006, 12:05 AM
I'm guessing that you've tried the PowerOn and PowerOff commands from the gml?

They both appear to have a bug in that they refer to self.PowerMain - this should be Denon.PowerMain

However, that shouldn't really have any impact on the problem

Are you referring to the "Power On" and "Power Off" in the .GML where I have:
Denon:PowerOn ()
NetRemote.SendLabel ('power', (self.PowerMain))

This is redundant, must have forgotten to remove it. However- I'm concerned now, because if you look through the associated .LUA file you'll notice pretty much all of the commands are self.*** I thought I wanted to do it this way, did I do wrong?

Ron- is it possible your com port is misconfigured? The port should be set to 9600,N,1. I'm wondering if maybe it's set to a higher speed or something? Is anyone else having this problem?

I have also tried volume up and down in the GMl and they don't work either. My comm port is set to 9600,N,1....... What I find most interesting is that....when I change the volume on the Denon 3806 I see it in the log file in G3 or G4 (whichever one I am trying and I do make sure that the other one is closed before starting). I will try to work on it some more later tonight or in the morning. I am not currently using NetRemote...just trying to get everything up and running in Girder first.
tia,
Ron

ellisr63
January 24th, 2006, 02:37 AM
Downloaded your files again and copied them over the old ones..... Now it works but i get the error still

ellisr63
January 24th, 2006, 02:41 AM
now here is the Lua script......... One thing i have noticed is the power works but the volume doesn't'''I will check the other functions..
tia,
Ron

ellisr63
January 25th, 2006, 06:11 PM
I now have power on and off working in G4...

1: source switching will not work
2: when I adjust the volume from G4 i get the following GP error..

Any Ideas? i am using this on a denon 3806. i have these commands now working in G3.
tia,
ron

FearTheDentist
January 26th, 2006, 01:02 AM
Could you change he source several times w\ the Denon remote and post a screenshot of what the Lua console shows?

I am 99% certain the problem is something to do w\ the serial connection, but I'm not sure what the problem could be. I double-checked the serial protocols from Denon and they are the same.

Do you have a different serial cable you could try? I'm pretty sure the "attempt to index global "self"..." error means the device didn't initialize properly.

ellisr63
January 26th, 2006, 01:41 AM
Ok...I tried changing the source from the denon and here is the Lua....It gpf when I selected tuner.. It also does the gpf on volume up and down. I would be suprised if it was the cable as I just tried the Denon in G3 and it works fine for volume, power and source selection. Do you have any more ideas? I will try the cable tommorrow anyway just to be sure.
tia,
Ron

FearTheDentist
January 26th, 2006, 01:58 AM
Well that's just wierd. The responses you're receiving appear norma, which tells me the plug-in is working to some extent at leastl- clearly something's wrong with sending commands, and I have no idea what could be causing the access violation.

I was sure it was the serial connection, but maybe the problem is something either in your G4 installation or in your system.

Try completely uninstalling G4 and re-installing (I know it's a pain)

Alternatively, do you have a laptop or something you could try this from?

ellisr63
January 26th, 2006, 02:04 AM
Do you think the new 4.02 Girder might help?
tia,
Ron

FearTheDentist
January 26th, 2006, 02:16 AM
I'd certainly give it a try. Has anyone else had problems w\ the plug-in? I'd appreciate if others would chime in with their experience w\ it :)

ellisr63
January 26th, 2006, 02:23 AM
Just uninstalled the old G4 and installed the new 4.02 G4 and only installed the serial plugin and the denon as per instructions...works fine except for the same gpf faults for switching to tuner or raising or lowering volume. could there be something dif in the code in G4 plugin on the lines for volume up and also tuner?
tia,
Ron

Ron
January 26th, 2006, 10:52 AM
We'll work on this bug today. If possible I would like to ask you to run a special debug version of the serial library in a little while.

ellisr63
January 26th, 2006, 01:41 PM
Ron,
Sure just let me know where and when it is available.
tia,
Ron

Ron
January 26th, 2006, 01:47 PM
Looks like I already have the serial compiled with that debug info. So this crash is happening outside of the DLL. Darn.

Let's recap here:

1. Data is flowing into Girder without trouble. -> When something changes in the receiver Girder gets that info no problem.

2. Sometimes when sending a command the crash happens.

3. Are you using a USB to serial converter?

ellisr63
January 26th, 2006, 02:20 PM
Ron,
I have a usb to serial converter...but I am currently running the denon off my comm 2 on the motherboard. The crash only happens when (ultiately I will need to ru soe of my devices from the usb to seral..wc s a Edgeport 8)......
1:Volume is raised or lowered (either from the Denon or from Girder)
2:Source is changed to Tuner (either from the Denon or from Girder)

The interesting part is everything is fine if I run G3 istead of G4.

tia,
Ron

Ron
January 26th, 2006, 02:22 PM
The codebase is completely different for the serial plugin G3-G4.

So in both those cases the crash happens, receive and send?

ellisr63
January 26th, 2006, 02:38 PM
Ron,
That is correct but only in G4. That is why I was wondering if it wa a problem with those lines of code specifically controlling the volume or tuner.
tia,
Ron

Ron
January 26th, 2006, 04:30 PM
Alright please run this dll with debug view enabled.
http://www.sysinternals.com/Utilities/DebugView.html

Please post the output when the crash happens.

FearTheDentist
January 27th, 2006, 12:49 AM
There's nothing special about the code for source or volume. A thought I had- does the 3806 have multiple zones? If so, change the source for a different zone and see if you get an error. Also, try changing the record source- the code for this is pretty much identical to the input source code.

ellisr63
January 27th, 2006, 01:01 AM
There's nothing special about the code for source or volume. A thought I had- does the 3806 have multiple zones? If so, change the source for a different zone and see if you get an error. Also, try changing the record source- the code for this is pretty much identical to the input source code.

Yes it does have multiple zones (I believe it has 2 extra zones)...but I don't use them. I'll look into it and see what I have to do to use them. Now you are talking about changing the record source from G4 or the Denon correct...and not in the code correct?
tia,
Ron

ellisr63
January 27th, 2006, 04:50 AM
Now this is very interesting...girder crashedbut if you look at the very bottom of my screen you will see 4 red G4 icons...normally there is only 1 G4 icon...and not only that but i haven't opened G4 up since the crashes. why would it do that? As soon as I moved my mouse over them they disappeared.
tia,
Ron

Rob H
January 27th, 2006, 04:54 AM
If you move your mouse over the tray then then Girder icons should disappear.

ellisr63
January 27th, 2006, 04:58 AM
But why did I have 4 red G4s after G4 crashed and closed? I would have expected it to close the G4 icons too?

FearTheDentist
January 27th, 2006, 05:57 AM
Now you are talking about changing the record source from G4 or the Denon correct...and not in the code correct?
tia,
Ron

Yes, that's correct

Rob H
January 27th, 2006, 06:43 AM
But why did I have 4 red G4s after G4 crashed and closed? I would have expected it to close the G4 icons too?

That's Windows for you. Because G4 crashed it didn't remove the icon from the tray as it normally would. And the tray doesn't check to see whether an application is still present until you move your mouse over it.

Ron
January 27th, 2006, 11:35 AM
Where is the debug output?

ellisr63
January 27th, 2006, 01:10 PM
Where is the debug output?

Hi Ron,

I posted the zip above along with the pic above....I saved the debug log for 3 dif crashes and zipped them.
tia,
Ron

Ron
January 27th, 2006, 01:12 PM
Ah! Thanks, missed that.

Ron
January 27th, 2006, 01:29 PM
Alright, please run this one: (with debugview again.)

ellisr63
January 27th, 2006, 01:55 PM
Hi Ron,
I ran through all the sources...crashed on tuner as usual i also did a volume up and a volume down...crashes on both.
tia,
ron

Ron
January 27th, 2006, 02:02 PM
Thanks I appreciate you helping out here.

I only need one crash report ( make you life easier :-) ) if you could try the source tuner crash that would be great.

Capture debug output again!

ellisr63
January 27th, 2006, 02:39 PM
here is the tuner only debug.
tia,
ron

Ron
January 27th, 2006, 02:43 PM
Alright, I think I nailed it. Please try the attached DLL. If it doesn't fix it please log the debug output again.

Note I think you will get an error in the lua console, please report that. That should be easy to fix.

ellisr63
January 27th, 2006, 02:57 PM
Alright, I think I nailed it. Please try the attached DLL. If it doesn't fix it please log the debug output again.

Note I think you will get an error in the lua console, please report that. That should be easy to fix.

YOU'RE THE MAN RON!!!!!!!! Excellent support and very fast. Works for volume and source tuner now.
thanks, Ron

Ron
January 27th, 2006, 02:58 PM
Fantasitc!!! What was the output on the lua console? There must have been an error..

ellisr63
January 27th, 2006, 03:01 PM
Ron,
Any chance that someone could create a lua for G4 so I can control my Russound cav-6? I have it running in G3 now.
tia,
Ron

Ron
January 27th, 2006, 03:03 PM
A little off-topic :-) Mike usually takes care of these requests.

ellisr63
January 27th, 2006, 03:07 PM
Fantasitc!!! What was the output on the lua console? There must have been an error..
Ron,
There is an error but...it still works:)

Ron

ellisr63
January 27th, 2006, 03:09 PM
A little off-topic :-) Mike usually takes care of these requests.
Sorry.
Maybe if I'm lucky mike will help me.
Ron

Ron
January 27th, 2006, 03:12 PM
Just post a new thread with this question, that's all. If you already did post that, just bump it.

Can you copy and paste the first 10 lines from your Denon3806.lua file from the plugins/serial directory?

ellisr63
January 27th, 2006, 03:55 PM
Ron,
Here you go...a little more than the first 10 lines...



local function DenonVolumeTodb (value)
if value then
if string.len(value) == 2 then
value = value .. '0'
end
return string.format("%.1f",(tonumber(value) / 10) - 80)
end
end

local function rawchan (value)
return (string.gsub(value, "CV(%a+)(%s)(%d+)", "%1"))
end

local function DenonChannelVolumeTodb (value)
if value then
if string.len(value) == 2 then
value = value .. '0'
end
return string.format("%.1f",(tonumber(value) / 10) - 50)
end
end

local function CalcTunerFreq (value)
if value then
if tonumber(value) <= 10800 then
value = string.format("%.1f", (value / 100)) else
value = (value / 100)
end
return (value)
end
end

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

Name = "Denon 3805",
Description = "Denon 3805 Audio Video Receiver",


BaudRate = 9600,
Parity = 0,
StopBits = 0,
DataBits = 8,
FlowControl = 'N',
IntraCharacterDelay = 0,
CallbackType = serial.CB_TERMINATED,
ReceiveTerminator = serial.hextobyte ('0D'),
SendTerminator = serial.hextobyte ('0D'),
IncompleteResponseTimeout = 200,
NoResponseTimeout = 200,
LogLevel = 0,
GlobalName = 'Denon',

Settings = {},
Responses = {},



tia,
Ron

Ron
January 27th, 2006, 03:57 PM
I am confused, maybe someone can help here.

Line 7 does some math, and line 3 checks to make sure value is not nil. Then however the error does say it was nil ???




local function DenonVolumeTodb &#40;value&#41;
if value then --line 3
if string.len&#40;value&#41; == 2 then
value = value .. '0'
end
return string.format&#40;"%.1f",&#40;tonumber&#40;value&#41; / 10&#41; - 80&#41; -- line 7
end
end

Ron
January 27th, 2006, 03:59 PM
can tonumber return a nil?

Rob H
January 27th, 2006, 04:10 PM
yes, tonumber will return nil if what you pass it can't be converted to a number

Ron
January 27th, 2006, 04:12 PM
Then we found our bug. Seems like this device does not work in the way mike expects it to.

Rob H
January 27th, 2006, 04:21 PM
Looking at the code, I'm puzzled to see how that bit of code is being called, since it should only be called when an MV response is received. I can't see that in the console log.

Rob H
January 27th, 2006, 04:24 PM
That's assuming that the code I have is the same as is being discussed here.

Ron
January 27th, 2006, 04:26 PM
Agreed. I can't see why that function is being called. See what Mike has to say.

Promixis
January 27th, 2006, 09:20 PM
Agreed. I can't see why that function is being called. See what Mike has to say.

I didn't write it 8)

Rob H
January 27th, 2006, 09:22 PM
This thread is in danger of getting very confusing with two Rons and two Mikes!

Ron
January 27th, 2006, 09:28 PM
Will the real author of that piece of code stand up?

ellisr63
January 27th, 2006, 09:35 PM
This thread is in danger of getting very confusing with two Rons and two Mikes!

:D maybe I can start to sign mine ron instead of Ron?

FearTheDentist
January 28th, 2006, 12:36 AM
Will the real author of that piece of code stand up?

8)

Hey- this is my 100th post :D
I can hardly take credit though- I just did the grunt work, you guys did the hard stuff. I'll go through it again, but I cant see why it's being called.

ellisr63
January 28th, 2006, 12:39 AM
Will the real author of that piece of code stand up?

8)

Hey- this is my 100th post :D
I can hardly take credit though- I just did the grunt work, you guys did the hard stuff. I'll go through it again, but I cant see why it's being called.

Could this be something that is dif in the 3806?

FearTheDentist
January 28th, 2006, 01:23 AM
Could this be something that is dif in the 3806?

I don't think so. I'll try to make a long story short about how this works. The function that seems to be tripping things up is one I put in to allow for the two different methods Denon receviers have of reporting volume. "Direct set" volume commands (as opposed to up\down commands) are in the format of "MVXX"- the resulting volume on the receiver is -80 + XX. Older models like mine only allow changes in 1db increments ie. MV41 MV42 MV43 corrospond to volumes of -39db, -38db, -37db, etc. Newer models allow 0.5db increments by recognizing commands in the form of "MVXXX" as well as "MVXX", so MV41, MV415, MV42 corrospond to -39db, -38.5db, -38db, etc. I wasn't sure how to write the code to allow for both methods, so I posted a ? and RAH99 wrote up that nifty piece of code you posted earlier (local function DenonVolumeTodb (value)) to take care of it (we'll blame him ;)). Looking at the protocol for the 3806, the volume is reported the same as other receivers, and I don't see any other differences, so I don't think it's something unique about the 3806.

Now- what I can't understand is why that code is being called when you change your source on the receiver. In order to correctly report volume level, input source, etc to NR, the script is written to scan the feedback from the receiver for specific character sets. For example, G4 watches for the characters "MV" in the feedback received from the receiver. If G4 notes a response of "MV415" from the receiver, strips the "MV' from the response and passes "415" to the DenonVolumeTodb function as a numeric value (as opposed to a string), calculates the volume level (-38.5), then passes the result on to NR. There's a similar function watching for "SI" (input) which returns the current input source to NR, for "CV" to report channel volume levels, etc.

The DenonVolumeTodb function should only run when G4 sees a response from the receiver containing "MV". G4 converts the digits following MV from a string to a numeric value which is passed to the function. However, say the characters following "MV" are not digits- then G4 passes "nil" to the function. So- say you got a response from the receiver "IMVERYFRUSTRATED"- G4 would see "MV" in the string, and convert the following characters from string to value- but instead of the expected numeric characters, it gets "ERYFR...." which obviously doesn't translate to a numeric value, so "nil" is passed to the function. This is where your error seems to be occuring.

So- the question remains- why is that function being called??? Looking at your screenshots, I don't see and "MV" in the responses that would trigger that function...Look for any responses containing "MV" (volume) or "SI" (source). Do you have any other serial devices connected?

Sorry if some of my terminology is wrong guys- I'm coming along, but this is a whole new field for me :)
Hopefully this helps- I'm afraid this is a bit over my head beyond this :(

ellisr63
January 28th, 2006, 02:29 AM
I have an idea..... When I switch sources the Denon also sets the levels for each input (I remember seeing this when you have a multi channel source, so the tuner internal and is stereo only...it might be recalibrating to stereo and adjusting the volume)...maybe that is why it's sending the volume command? I only have the component video and the digital coax hooked up to one input on the Denon (I use the Autopatch for switching this). I also have a analog video and analog audio hooked up for one input for the Russound. All other inputs are not even hooked up.
Ron

2parts
July 28th, 2006, 11:31 PM
Time to revive the thread :)

All,

Have a Denon 3806 receiver. Here is information..

1.) From COM 1 on motherboard to Serial on Denon
2.) Using Girder 4
3.) Using Generic Serial Plug-in
4.) GML for generic Denon receivers from downloads page.

Issue is, I am unable to do anything with the Denon at all. From change volume, source, or anything else for that matter.

Here is some example code from the LUA Script when I try to change to DVD Source.

[string "Danon AVR-3805.gml:\Select Source\DVD"]:1: attempt to index global `Denon' (a nil value)
stack traceback:
[string "Danon AVR-3805.gml:\Select Source\DVD"]:1: in main chunk


The logger lists it as a script error:Logic Error check LUA


Any ideas on what might be the problem?

Rob H
July 29th, 2006, 06:15 AM
You need to go to the settings for the serial plugin (File|Settings|Plug-in settings and select the 'Serial' tab). Then select COM1 and assign it to the Denon serial device.

2parts
July 30th, 2006, 06:48 PM
Thanks,

I made this assignment in Girder.

It still produces the "Script Error: Logic Error (Check Lua Console) message in the Log Display. I reset the Lua Engine but that didn't fix the problem.

In girder, is says that it is unable to open port 1.

2parts
July 30th, 2006, 11:16 PM
I could open COM1 with the SerialWatcher but only when Girder was closed. Disabling events in girder would still give me an error message in SerialWatcher that the port was in use and could not be opened.

With Girder shut down, I opened COM1 and then rebooted the DMS. COM1 showed that it was still assigned to the Denon in the Girder settings but was showing closed in SerialWatcher. Using NR still produced the script errors.

Is the this a Girder configuration issue, ya think?

Rob H
July 31st, 2006, 03:02 AM
With Girder closed can you try using Hyperterm to open a connection to your Denon over COM1?

2parts
July 31st, 2006, 11:47 AM
Are their any specific commands, or just make a connection?

Rob H
July 31st, 2006, 12:11 PM
First of all, try to make a connection at 9600 8N1. Then try adjusting the volume on the Denon (using the remote or the volume control on the receiver itself).

If the connection is successful you should see feedback from the Denon.

2parts
July 31st, 2006, 12:14 PM
Will give it a try, thanks.

2parts
August 1st, 2006, 10:15 AM
Exited Girder
Opened Serial Watcher
Opened COM1
Check serial settings (they were set at:
9600bps
Data width: 9 bits
Stops bits: 1
Party: None
Hard and Soft Handshake: None

Moved the volume on the Denon down one increment
(-0.5db) and got the following received by Serial
Watcher:
77 86 54 50 53 13 77 86 77 65 88 32 57 56 13

Tried a few other buttons on the Denon and it produces more numbers in Serial Watcher.

Fired up NR on the DMS and it does nothing in Serial Watcher (which makes sense..I think...because Girder is shut down.

Fired up Girder. It says that it is unable to open
COM1 (Serial Watcher still shows that COM1 is open).
Tried NR again on the DMS and it produces no change.

That's where I'm at. Let me know what I should try next.

Rob H
August 1st, 2006, 11:05 AM
So, were you doing this with Hyperterm? Did anything appear on the Hyperterm window?

What is serial watcher? Do you have a URL for it?

I assume you meant 8 bits not 9?

2parts
August 1st, 2006, 01:13 PM
Here is the link to SerialWatcher

http://www.devhood.com/tools/tool_details.aspx?tool_id=780

Serial Watch is a very simple but very effective and useful serial input terminal. Its one of those great one file programs. It has all the serial settings on the main screen for easy access. Supports ASCII, Decimal, and Hex input display. The Hex display is extremely useful for working with hardware. Note, it is just for serial input/watching, does not output data to the com port.

RobBishop
August 1st, 2006, 01:38 PM
2parts, Sorry to jump on this thread.

I have the same issue, specifically:

Denon3806 - Logger receives the manual control Serial Inputs OK
Denon GML commands produce the following:

Serial: Denon 3805 : Command queued: 50 57 4F 4E PWON at postion 1
Serial: Denon 3805 : Simple Send: 50 57 4F 4E 0D PWON.
[string "Denon AVR-3805.gml:\Zone Controls\Main Zone..."]:2: attempt to index global `self' (a nil value)
stack traceback:
[string "Denon AVR-3805.gml:\Zone Controls\Main Zone..."]:2: in main chunk
Serial: Denon 3805 : Simple Receive: Data Code: 0


If I can help with the debug process etc.

Rob

FearTheDentist
August 1st, 2006, 10:19 PM
Well, I've been off the board for quite a whille, time to get back up to speed...

When you start up G4 and open the Lua console, does it show any communication with the Denon? (it should say Communications OK)

It sounds to me like it may be a serial settings problem. If G4 is properly communicating with the Denon, any change on the Denon will be reflected in the Lua console- volume changes, input, etc. So- what do you see in the Lua console when you change the volume on the Denon?

Did you try the other Denon plugin? I looked it over- somebody took mine and stripped a lot of the "extras" out of it and reposted it. I built in a lot of extra functionality into the plugin that's not necessary for basic control of the receiver. It's conceivable that I may have "overengineered" things and introduced unforseen problems. If you haven't done so already, try the other plugin and see what happens.

RobBishop
August 2nd, 2006, 03:50 AM
Hi FTD, welcome back!

Last evenings LUA console as follows;

NR Loaded
Welcome to Promixis Girder 4.0!
Serial: Denon 3805 : Opened Device: Denon 3805 Port: 1 Settings: 9600 N 0 8 0
Serial: Denon 3805 : Callback Installed 2
TreeScript (golua): ...Files\Promixis\Girder\/plugins/treescript/G2G UI.lua:196: attempt to index global `g2g' (a nil value)
stack traceback:
...Files\Promixis\Girder\/plugins/treescript/G2G UI.lua:196: in function <...Files\Promixis\Girder\/plugins/treescript/G2G UI.lua:195>
client table error: NetRemote not enabled
TreeScript (golua): ...Promixis\Girder\/plugins/treescript/NetRemote UI.lua:79: attempt to concatenate field `Version' (a nil value)
stack traceback:
.................................................. .................................................. ...................stack traceback:
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: in function `DenonVolumeTodb'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1000: in function `func'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:977: in function <... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:968>
Main Volume: -30.0
Serial: Denon 3805 : Simple Receive: Data 4D 56 35 30 MV50 Code: 1
Serial Error (CallLua): ... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: attempt to perform arithmetic on a nil value
stack traceback:
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: in function `DenonVolumeTodb'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1000: in function `func'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:977: in function <... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:968>
Main Volume: -29.5
Serial: Denon 3805 : Simple Receive: Data 4D 56 35 30 35 MV505 Code: 1
Serial Error (CallLua): ... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: attempt to perform arithmetic on a nil value
stack traceback:
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: in function `DenonVolumeTodb'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1000: in function `func'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:977: in function <... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:968>
Main Volume: -29.0
Serial: Denon 3805 : Simple Receive: Data 4D 56 35 31 MV51 Code: 1
Serial Error (CallLua): ... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: attempt to perform arithmetic on a nil value
stack traceback:
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: in function `DenonVolumeTodb'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1000: in function `func'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:977: in function <... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:968>
Main Volume: -28.5
Serial: Denon 3805 : Simple Receive: Data 4D 56 35 31 35 MV515 Code: 1
Serial Error (CallLua): ... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: attempt to perform arithmetic on a nil value
stack traceback:
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: in function `DenonVolumeTodb'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1000: in function `func'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:977: in function <... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:968>
Main Volume: -28.0
Serial: Denon 3805 : Simple Receive: Data 4D 56 35 32 MV52 Code: 1
Serial Error (CallLua): ... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: attempt to perform arithmetic on a nil value
stack traceback:
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: in function `DenonVolumeTodb'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1000: in function `func'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:977: in function <... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:968>
Main Volume: -27.5
Serial: Denon 3805 : Simple Receive: Data 4D 56 35 32 35 MV525 Code: 1
Serial Error (CallLua): ... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: attempt to perform arithmetic on a nil value
stack traceback:
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: in function `DenonVolumeTodb'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1000: in function `func'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:977: in function <... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:968>
Main Volume: -27.0
Serial: Denon 3805 : Simple Receive: Data 4D 56 35 33 MV53 Code: 1
Serial Error (CallLua): ... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: attempt to perform arithmetic on a nil value
stack traceback:
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1107: in function `DenonVolumeTodb'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:1000: in function `func'
... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:977: in function <... Files\Promixis\Girder\/plugins/serial/Denon3805.lua:968>
Power: STANDBY
Serial: Denon 3805 : Simple Receive: Data 50 57 53 54 41 4E 44 42 59 PWSTANDBY Code: 1
Serial: Denon 3805 : Simple Receive: Data 5A 4D 4F 46 46 ZMOFF Code: 1
Zone 1 Power: OFF
Serial: Denon 3805 : Simple Receive: Data 5A 32 4F 46 46 Z2OFF Code: 1
Serial: Denon 3805 : Simple Receive: Data 5A 33 4F 46 46 Z3OFF Code: 1
Surround Mode: DOLBY PL2 C
Serial: Denon 3805 : Simple Receive: Data 4D 53 44 4F 4C 42 59 20 50 4C 32 20 43 MSDOLBY PL2 C Code: 1


I have had no luck with any other Denon plugin/gml combo thus far. This one appears to be receiving though!

Rob

Rob H
August 2nd, 2006, 04:30 AM
Try this one (note that it requires the init.lua in the zip file unless you are running the latest version of Girder 4.0.6).

I'm afraid that this version doesn't have a GML, but you should be able to modify the one that you already have from FearTheDentist.

This has currently only been tested with the 2805 - if you have another model then edit the Initialize method on line 224 and change the '2805' to suit your own model. In theory it will adjust the zones to suit.

Let me know if you have any problems with it.

RobBishop
August 2nd, 2006, 10:29 AM
Rob,

Tried the files:

Loading Denon AVR
NR Loaded
Welcome to Promixis Girder 4.0!
[string "Danon AVR-3805.gml:\Master Volume\Scripting"]:1: attempt to index global `Denon' (a nil value)
stack traceback:
[string "Danon AVR-3805.gml:\Master Volume\Scripting"]:1: in main chunk
[string "Danon AVR-3805.gml:\Master Volume\Volume Do..."]:1: attempt to index global `Denon' (a nil value)
stack traceback:
[string "Danon AVR-3805.gml:\Master Volume\Volume Do..."]:1: in main chunk


Now seem to have lost all comms with AVR - no input values from Denon3806 available

rgs, Rob

RobBishop
August 2nd, 2006, 10:50 AM
OK upgradedto 4.0.6

Altered Denon3805.lua to initialize 3806

Now logging the following;

Time Date Source Details Payloads
15:48:14:930 8/2/2006 Denon AVR Denon.Receiver.Surround:Mode DOLBY PL2 C
15:48:14:899 8/2/2006 Denon AVR Denon.Receiver.Parameters:SurroundBackMode OFF
15:48:14:852 8/2/2006 Denon AVR Denon.Receiver.Parameters:ToneDefeat OFF
15:48:14:821 8/2/2006 Denon AVR Denon.Receiver.Main:Source CD
15:48:13:399 8/2/2006 Denon AVR Denon.Receiver.Main:Source Tape
15:48:11:086 8/2/2006 Denon AVR Denon.Receiver.Surround:Mode STEREO
15:48:11:055 8/2/2006 Denon AVR Denon.Receiver.Parameters:SurroundBackMode OFF
15:48:11:024 8/2/2006 Denon AVR Denon.Receiver.Parameters:ToneDefeat ON
15:48:10:993 8/2/2006 Denon AVR Denon.Receiver.Main:Source DVD
15:48:09:821 8/2/2006 Denon AVR Denon.Receiver.Main:Source Tape
15:48:01:383 8/2/2006 Denon AVR Denon.Receiver.Main:Source CD
15:47:56:852 8/2/2006 Denon AVR Denon.Receiver.Main:Source Phono
15:47:54:274 8/2/2006 Denon AVR Denon.Receiver.Main:Volume 33
15:47:53:961 8/2/2006 Denon AVR Denon.Receiver.Main:Volume 33
15:47:53:743 8/2/2006 Denon AVR Denon.Receiver.Main:Volume 34
15:47:53:555 8/2/2006 Denon AVR Denon.Receiver.Main:Volume 34
15:47:53:399 8/2/2006 Denon AVR Denon.Receiver.Main:Volume 35
15:47:53:274 8/2/2006 Denon AVR Denon.Receiver.Main:Volume 35
15:47:53:149 8/2/2006 Denon AVR Denon.Receiver.Main:Volume 36
15:47:53:039 8/2/2006 Denon AVR Denon.Receiver.Main:Volume 36
15:47:45:758 8/2/2006 TaskSwitch girder.exe
15:47:43:867 8/2/2006 TaskSwitch girder.exe
15:47:43:836 8/2/2006 TaskSwitch girder.exe
15:47:43:789 8/2/2006 TaskSwitch girder.exe
15:47:43:742 8/2/2006 TaskSwitch girder.exe
15:47:43:696 8/2/2006 TaskSwitch girder.exe
15:47:43:633 8/2/2006 TaskSwitch girder.exe
15:47:26:805 8/2/2006 Denon AVR Communications OK
15:47:25:070 8/2/2006 NetRemote Disabled
15:47:24:570 8/2/2006 Girder2Girder Not Loaded - Requires Communications Server Plugin
15:47:24:555 8/2/2006 Audio Mixer Plugin Loaded, Version: 2.0.0.1


rgs, Rob

Rob H
August 2nd, 2006, 11:02 AM
That seems to be working okay, although as I said before it won't work directly with the GML that you have.

RobBishop
August 2nd, 2006, 12:45 PM
OK, what do I need to change in the GML to give me control over the 3806 now that the 232 is configured OK?

rgs, Rob

Rob H
August 2nd, 2006, 02:08 PM
Now, that's a good question. A lot of the commands should be the same, although the zone commands may be different. The event handlers will also need to be changed if there are any.

Fearthedentist is probably the person to ask about it really.

RobBishop
August 2nd, 2006, 05:27 PM
FTD - Can you help?

Cheers, Rob

FearTheDentist
August 3rd, 2006, 07:02 PM
FTD - Can you help?

Cheers, Rob

I'll see what I can do, it may be a few days though (family visiting). In the meantime I'd look at why you have bidirectional communication using Rob's .lua but wierd stuff with mine.

Failing that, I'll see about re-doing my .gml to fit Rob's .lua- it looks like a much more efficient implementation (whadaya expect, I'm a dentist :D). That may take a bit longer though. I'll stay on this though...

RobBishop
August 4th, 2006, 02:44 AM
You are a very kind dentist :-)

Any help you can give is appreciated, Rob

Ginsonic
August 4th, 2006, 03:57 AM
Rob,

You could also try my implementation for the very similar Denon 4306. You will find it in the Girder plugin section.

Regards,
Dieter

RobBishop
August 4th, 2006, 01:11 PM
Hi Dieter,

I cannot see the 4803 plugin files in the plugins section. Could you send me a link to the file you are referring to?

Cheers, Rob

Ginsonic
August 6th, 2006, 12:10 PM
Hi Rob,

I am so sorry, I mixed something up ! In the download section there is the complete plugin for my new sound system (Arcam), but I did never upload my old Denon plugin. This plugin was based on Dentists work, so it would not help You more than the one, You already have.

Regards,
Dieter

RobBishop
August 6th, 2006, 05:23 PM
Dieter,

thanks anyhow, Rob

toml0006
September 3rd, 2006, 05:57 PM
Try this one (note that it requires the init.lua in the zip file unless you are running the latest version of Girder 4.0.6).

I'm afraid that this version doesn't have a GML, but you should be able to modify the one that you already have from FearTheDentist.

This has currently only been tested with the 2805 - if you have another model then edit the Initialize method on line 224 and change the '2805' to suit your own model. In theory it will adjust the zones to suit.

Let me know if you have any problems with it.

looking through this, I can't figure out where I can get the variables to send to NetRemote. Maybe in the Notify() function?

Rob H
September 4th, 2006, 03:00 AM
Well, the Denon serial device already sends a series of Denon.Receiver.* events so you could set up an event handler for those in a bit of Lua e.g.


myHandler = gir.AddEventHandler('Denon%.Receiver%..*', 10030, 10030, myfunc)

where myfunc would be something like


function myfunc(eventstring, device, modifier, payloads)
NetRemote.SetVariable(eventstring, payloads[1] or '')
end

Something more complicated may be needed in the function, but that's the sort of idea

RobBishop
September 10th, 2006, 05:40 PM
Here are the serial commands for the Denon 3806:

http://www.usa.denon.com/AVR-3806SerialProtocol_Ver(4.5).pdf

Can any one create a gml?

Rob

toml0006
September 10th, 2006, 09:28 PM
I tried to create a GML that recieves the events and sends them to NR, but it doesn't work; it will constantly lock up my system with the only solution being to 'reset lua scripting engine'. Currently I am using the original GML file with code to send variables to NR in the luascript file. It seems to work well, but I only have control over the main zone, and I cannot set the channel levels.

Rob H
September 11th, 2006, 03:53 AM
That's not good Tom, I can't see any reason for my Denon plugin locking up Girder. What Girder version is this?

toml0006
September 11th, 2006, 10:54 AM
Tried again last night, I should have been a little more careful with my words... Girder doesn't lock up. What happens is - nothing. An event will be generated but no variables are updated in NR. I have an update NR variable action tied to a specific DenonAVR event (such as Volume and source selection). It seems that whenever a source is selected, the channel volumes are verified, and when this happens NR stops getting updates. It seems as though NR/Girder get overwhelmed with the responses from the receiver (running on an Athlon 3800 with 2GB RAM). The only solution to this is to reset lua.

As I have mentioned, this was all done in the GML. I have not tried to set up a 'Receive Response' function in lua yet since setting the NR variables in directly in the lua script seems to be working just fine for me.

If I knew the syntax of how to set other zones and channel levels, I could complete the GML and upload it :)

Rob H
September 11th, 2006, 11:22 AM
What version of Girder is this?

My machine is a slightly lower spec than yours and manages to keep pace quite happily.