Author Topic: Denon AVR RS232 protocol users - help!  (Read 26982 times)

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Denon AVR RS232 protocol users - help!
« on: January 06, 2009, 09:21:18 pm »
I am having problems connecting my AVR-2807 via RS232, so I hooked it up to a laptop and tried with Hyperterminal. Has anyone else done this? I can't get any response. I found the following info on AVS forum:

Quote
RS232 To start with, I could NOT get the RS232 to work, despite me being an experienced comms type person. Eventually, reading between the lines in the manual I worked out. Here is the recipe (please don't ask me for support on basic PC stuff like Windows, Hyperterminal etc - you'll find that elsewhere)
- You need the RS232 Protocol manual from the USA Denon site (not available in my home country - the UK)
- Connect a laptop with a straight RS232 cable
- Use Hyperterminal at 9600,n,8,1 and NO flow control (that's important)
- Type the word PWSTANDBY and one linefeed into a Notepad document, copy this into the Clipboard (this must be in upper case)
- Now turn on the Denon with the Standby button, and while it is starting up use Edit, Copy clipboard to host in Hyperterminal
- If it has worked, the Denon will turn off.

Thereafter, you can control the Denon via RS232. Prior to that, it is deaf and dumb (at least - mine was). My conclusion was that you have to zap it with the command in a short space of time after going from Standby to On. If you try to type the command in to Hyperterminal, you can't get it in fast enough to be recognised.


I tried this but still no luck. Does anyone have any tips?

Regards,

Chris

nosilla99

  • Veteran
  • ***
  • Posts: 120
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #1 on: January 06, 2009, 10:51:38 pm »
Hi Chris,

I can only confirm that I am using the same receiver without any problems. I didn't experience any of the timing issues described in the article you quote from the AVS forums.  Are you sure your RS232 cable is of the correct type ie straight through and not crossed ?

Just one other thing to note is that when I used the Denon template supplied with LMCE for some reason non of the ruby code was present to manually add the code snippets.  I used the protocol manual for the AVR-3805 from the USA site.

NOS

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #2 on: January 06, 2009, 11:26:24 pm »
I have checked my cable with a multimeter and it goes pin 1 -> pin 1 etc. The metal shell of one plug connects to the metal shell of the other plug, but does not connect to any of the pins. I have read somewhere that some pins might need to be connected to ground - can you comment on this?

I added the device without having to add any code like you, using the template AVC-A1SRA (RS232). When the device starts I see in the log the entire device ruby code is spat out, but with no error messages. I tried testing commands through the web GUI but nothing at all is logged. Is this weird?

Code: [Select]
== FRESH START ==
1 01/06/09 22:19:54 /usr/pluto/bin/Spawn_Device.sh 155 (spawning-device) device: 155 ip: dcerouter cmd_line: Generic_Serial_Device
0 01/06/09 22:19:54 155 (spawning-device) Entering 155
========== NEW LOG SECTION ==========
1 01/06/09 22:19:54 155 (spawning-device) Starting... 1
1 01/06/09 22:19:54 155 (spawning-device) Found /usr/pluto/bin/Generic_Serial_Device
01 01/06/09 22:19:57.424 Paritybit/Stopbit 8N1 NOT supported. <0x42003950>
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_155 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:conn_.Send("MVUP\r")
   8:
   9:return @returnParamArray
  10:end
  11:#### 90 ####################################################################
  12:def cmd_90(repeat_command, cmd=nil)
  13:@returnParamArray.clear
  14:conn_.Send("MVDOWN\r")
  15:
  16:return @returnParamArray
  17:end
  18:#### 97 ####################################################################
  19:def cmd_97(cmd=nil)
  20:@returnParamArray.clear
  21:if(@mute)
  22:  conn_.Send("MUOFF\r")
  23:
  24:else
  25:  conn_.Send("MUON\r")
  26:
  27:end
  28:@mute=!@mute
  29:return @returnParamArray
  30:end
  31:#### 149 ####################################################################
  32:def cmd_149(cmd=nil)
  33:@returnParamArray.clear
  34:conn_.Send("MSJAZZ CLUB\r")
  35:
  36:return @returnParamArray
  37:end
  38:#### 150 ####################################################################
  39:def cmd_150(cmd=nil)
  40:@returnParamArray.clear
  41:conn_.Send("MSROCK ARENA\r")
  42:
  43:return @returnParamArray
  44:end
  45:#### 153 ####################################################################
  46:def cmd_153(cmd=nil)
  47:@returnParamArray.clear
  48:conn_.Send("MSCLASSIC CONCERT\r")
  49:
  50:return @returnParamArray
  51:end
  52:#### 161 ####################################################################
  53:def cmd_161(cmd=nil)
  54:@returnParamArray.clear
  55:conn_.Send("SITV\r")
  56:
  57:return @returnParamArray
  58:end
  59:#### 162 ####################################################################
  60:def cmd_162(cmd=nil)
  61:@returnParamArray.clear
  62:conn_.Send("SICD\r")
  63:
  64:return @returnParamArray
  65:end
  66:#### 163 ####################################################################
  67:def cmd_163(cmd=nil)
  68:@returnParamArray.clear
  69:conn_.Send("SIPHONO\r")
  70:
  71:return @returnParamArray
  72:end
  73:#### 165 ####################################################################
  74:def cmd_165(cmd=nil)
  75:@returnParamArray.clear
  76:conn_.Send("SIDVD\r")
  77:
  78:return @returnParamArray
  79:end
  80:#### 166 ####################################################################
  81:def cmd_166(cmd=nil)
  82:@returnParamArray.clear
  83:conn_.Send("SITUNER\r")
  84:
  85:return @returnParamArray
  86:end
  87:#### 174 ####################################################################
  88:def cmd_174(cmd=nil)
  89:@returnParamArray.clear
  90:conn_.Send("SIMD/TAPE2\r")
  91:
  92:return @returnParamArray
  93:end
  94:#### 176 ####################################################################
  95:def cmd_176(cmd=nil)
  96:@returnParamArray.clear
  97:conn_.Send("SIVDP\r")
  98:
  99:return @returnParamArray
 100:end
 101:#### 192 ####################################################################
 102:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
 103:@returnParamArray.clear
 104:conn_.Send("PWON\r")
 105:
 106:sleep(2)
 107:conn_.Send("MUOFF\r")
 108:
 109:@mute = false
 110:
 111:return @returnParamArray
 112:end
 113:#### 193 ####################################################################
 114:def cmd_193(pk_pipe, cmd=nil)
 115:@returnParamArray.clear
 116:conn_.Send("PWSTANDBY\r")
 117:
 118:return @returnParamArray
 119:end
 120:#### 281 ####################################################################
 121:def cmd_281(cmd=nil)
 122:@returnParamArray.clear
 123:conn_.Send("SIDBS/SAT\r")
 124:
 125:return @returnParamArray
 126:end
 127:#### 282 ####################################################################
 128:def cmd_282(cmd=nil)
 129:@returnParamArray.clear
 130:conn_.Send("SIVCR-1\r")
 131:
 132:return @returnParamArray
 133:end
 134:#### 283 ####################################################################
 135:def cmd_283(cmd=nil)
 136:@returnParamArray.clear
 137:conn_.Send("SIVCR-2\r")
 138:
 139:return @returnParamArray
 140:end
 141:#### 284 ####################################################################
 142:def cmd_284(cmd=nil)
 143:@returnParamArray.clear
 144:conn_.Send("SIVCR-3\r")
 145:
 146:return @returnParamArray
 147:end
 148:#### 285 ####################################################################
 149:def cmd_285(cmd=nil)
 150:@returnParamArray.clear
 151:conn_.Send("SIV.AUX\r")
 152:
 153:return @returnParamArray
 154:end
 155:#### 286 ####################################################################
 156:def cmd_286(cmd=nil)
 157:@returnParamArray.clear
 158:conn_.Send("MSPURE DIRECT\r")
 159:
 160:return @returnParamArray
 161:end
 162:#### 287 ####################################################################
 163:def cmd_287(cmd=nil)
 164:@returnParamArray.clear
 165:conn_.Send("MSMULTI CH IN\r")
 166:
 167:return @returnParamArray
 168:end
 169:#### 288 ####################################################################
 170:def cmd_288(cmd=nil)
 171:@returnParamArray.clear
 172:conn_.Send("MSMULTI CH DIRECT\r")
 173:
 174:return @returnParamArray
 175:end
 176:#### 289 ####################################################################
 177:def cmd_289(cmd=nil)
 178:@returnParamArray.clear
 179:conn_.Send("MSMULTI CH PURE D\r")
 180:
 181:return @returnParamArray
 182:end
 183:#### 290 ####################################################################
 184:def cmd_290(cmd=nil)
 185:@returnParamArray.clear
 186:conn_.Send("MSDOLBY PRO LOGIC\r")
 187:
 188:return @returnParamArray
 189:end
 190:#### 291 ####################################################################
 191:def cmd_291(cmd=nil)
 192:@returnParamArray.clear
 193:conn_.Send("MSDOLBY PL2\r")
 194:
 195:return @returnParamArray
 196:end
 197:#### 292 ####################################################################
 198:def cmd_292(cmd=nil)
 199:@returnParamArray.clear
 200:conn_.Send("MSDOLBY DIGITAL\r")
 201:
 202:return @returnParamArray
 203:end
 204:#### 293 ####################################################################
 205:def cmd_293(cmd=nil)
 206:@returnParamArray.clear
 207:conn_.Send("MSDOLBY D EX\r")
 208:
 209:return @returnParamArray
 210:end
 211:#### 294 ####################################################################
 212:def cmd_294(cmd=nil)
 213:@returnParamArray.clear
 214:conn_.Send("MS6.1 SURROUND\r")
 215:
 216:return @returnParamArray
 217:end
 218:#### 295 ####################################################################
 219:def cmd_295(cmd=nil)
 220:@returnParamArray.clear
 221:conn_.Send("MSDTS NEO:6\r")
 222:
 223:return @returnParamArray
 224:end
 225:#### 296 ####################################################################
 226:def cmd_296(cmd=nil)
 227:@returnParamArray.clear
 228:conn_.Send("MSDTS SURROUND\r")
 229:
 230:return @returnParamArray
 231:end
 232:#### 297 ####################################################################
 233:def cmd_297(cmd=nil)
 234:@returnParamArray.clear
 235:conn_.Send("MSDTS ES DSCRT6.1\r")
 236:
 237:return @returnParamArray
 238:end
 239:#### 298 ####################################################################
 240:def cmd_298(cmd=nil)
 241:@returnParamArray.clear
 242:conn_.Send("MSDTS ES MTRX6.1\r")
 243:
 244:return @returnParamArray
 245:end
 246:#### 299 ####################################################################
 247:def cmd_299(cmd=nil)
 248:@returnParamArray.clear
 249:conn_.Send("MSHOME THX CINEMA\r")
 250:
 251:return @returnParamArray
 252:end
 253:#### 300 ####################################################################
 254:def cmd_300(cmd=nil)
 255:@returnParamArray.clear
 256:conn_.Send("MSTHX5.1\r")
 257:
 258:return @returnParamArray
 259:end
 260:#### 301 ####################################################################
 261:def cmd_301(cmd=nil)
 262:@returnParamArray.clear
 263:conn_.Send("MSTHX U2 CINEMA\r")
 264:
 265:return @returnParamArray
 266:end
 267:#### 302 ####################################################################
 268:def cmd_302(cmd=nil)
 269:@returnParamArray.clear
 270:conn_.Send("MSTHX MUSIC MODE\r")
 271:
 272:return @returnParamArray
 273:end
 274:#### 303 ####################################################################
 275:def cmd_303(cmd=nil)
 276:@returnParamArray.clear
 277:conn_.Send("MSTHX6.1\r")
 278:
 279:return @returnParamArray
 280:end
 281:#### 304 ####################################################################
 282:def cmd_304(cmd=nil)
 283:@returnParamArray.clear
 284:conn_.Send("MSTHX SURROUND EX\r")
 285:
 286:return @returnParamArray
 287:end
 288:#### 305 ####################################################################
 289:def cmd_305(cmd=nil)
 290:@returnParamArray.clear
 291:conn_.Send("MSWIDE SCREEN\r")
 292:
 293:return @returnParamArray
 294:end
 295:#### 306 ####################################################################
 296:def cmd_306(cmd=nil)
 297:@returnParamArray.clear
 298:conn_.Send("MS5CH STEREO\r")
 299:
 300:return @returnParamArray
 301:end
 302:#### 307 ####################################################################
 303:def cmd_307(cmd=nil)
 304:@returnParamArray.clear
 305:conn_.Send("MS7CH STEREO\r")
 306:
 307:return @returnParamArray
 308:end
 309:#### 308 ####################################################################
 310:def cmd_308(cmd=nil)
 311:@returnParamArray.clear
 312:conn_.Send("MSDIRECT\r")
 313:
 314:return @returnParamArray
 315:end
 316:#### 309 ####################################################################
 317:def cmd_309(cmd=nil)
 318:@returnParamArray.clear
 319:conn_.Send("MSMATRIX\r")
 320:
 321:return @returnParamArray
 322:end
 323:#### 310 ####################################################################
 324:def cmd_310(cmd=nil)
 325:@returnParamArray.clear
 326:conn_.Send("MSMONO MOVIE\r")
 327:
 328:return @returnParamArray
 329:end
 330:#### 311 ####################################################################
 331:def cmd_311(cmd=nil)
 332:@returnParamArray.clear
 333:conn_.Send("MSSTEREO\r")
 334:
 335:return @returnParamArray
 336:end
 337:#### 312 ####################################################################
 338:def cmd_312(cmd=nil)
 339:@returnParamArray.clear
 340:conn_.Send("MSSUPER STADIUM\r")
 341:
 342:return @returnParamArray
 343:end
 344:#### 313 ####################################################################
 345:def cmd_313(level, cmd=nil)
 346:@returnParamArray.clear
 347:conn_.Send("MV" + level + "\r")
 348:
 349:SetDeviceDataInDB( device_.devid_, 158, level ) # 158 = DEVICEDATA_Volume_Level_CONST
 350:print "volume and corresponding device data set\n"
 351:
 352:return @returnParamArray
 353:end
 354:#### 350 ####################################################################
 355:def cmd_350(cmd=nil)
 356:@returnParamArray.clear
 357:#event  31 A 06 14:50 Denon AVC
 358:buff = readLine()
 359:print buff,"\n"
 360:return @returnParamArray
 361:end
 362:#### 355 ####################################################################
 363:def cmd_355(cmd=nil)
 364:@returnParamArray.clear
 365:#31-May-06 14:13 init Denon AVC
 366:
 367:initok=false
 368:
 369:
 370:# It doesn't respond to anything but power on when it's off.  Before turning it on and off
 371:# See if it responds to something it normally would while it's on
 372:
 373:for iRetry in 0...4
 374:    print "Initializing unit\n"
 375: conn_.Send("MVUP\rMVDOWN\r")
 376:    buf = conn_.Recv(200, 1000)
 377:    if( !buf.nil? && !buf.index("MV" ).nil? )
 378:        print "Initialized ok\n"
 379: initok=true
 380: break
 381: else
 382: print "Didn't respond to mv up/down\n"
 383: end
 384:end
 385:
 386:if initok==false
 387: for iRetry in 0...4
 388: print "Initializing unit\n"
 389: conn_.Send("PWON\r")
 390: sleep(3);
 391: conn_.Send("PWSTANDBY\r");
 392: buf = conn_.Recv(200, 4000)
 393: if( !buf.nil? && (!buf.index("ON" ).nil? || !buf.index("STAND" ).nil? || !buf.index("OFF" ).nil?) )
 394: print "Initialized ok from off state\n"
 395: initok=true
 396: break
 397: else
 398: print "Failed to initialize\n"
 399: end
 400: print "Failed to initialize.  Wait 1 secs and try again\n"
 401: sleep(1)
 402: end
 403:end
 404:
 405:if initok==false
 406: DisableDevice( device_.devid_, true )
 407: print "The device wouldn't respond. Disabling it.\n"
 408: return
 409:end
 410:
 411:print "Initialized ok, doing log\n"
 412:
 413:$logFile = File.new("/var/log/pluto/DenonAVC.log", "w")
 414:$SoundLevel = 0
 415:
 416:#buffer for reading from serial
 417:$line=String.new
 418:$lineIndex=0
 419:
 420:$waitTime = 3000      #wait time in comunication
 421:
 422:$eventCode = {
 423:"MS"    =>    "Mode surround",
 424:"PS"    =>    "Parameter settings",
 425:"TF"    =>    "Tone frequency",
 426:"TP"    =>     "Tuner present",
 427:"TM"    =>     "Tuner band",
 428:"PW"    =>     "Power",
 429:"MV"    =>     "Master volume",
 430:"CV"    =>     "Chanel volume",
 431:"MU"    =>     "Mute",
 432:"SI"    =>    "Select Input"
 433:}
 434:
 435:$inputSources = {
 436:"VDP"              =>        176,
 437:"VCR-3"           =>        284,
 438:"VCR-2"           =>        283,
 439:"VCR-1"           =>        282,
 440:"V.AUX"           =>        285,
 441:"TV"                =>       161,
 442:"TUNER"           =>       166,
 443:"PHONO"           =>       163,
 444:"MD/TAPE2"      =>       174,
 445:"DVD"              =>       165,
 446:"DBS/SAT"        =>       281,
 447:"CD"                =>       162,
 448:"CDR/TAPE1"     =>       420
 449:}
 450:
 451:return @returnParamArray
 452:end
 453:#### PRIVATE METHODS ####################################################################
 454:#private  Denon  2006-12-07 17:50:58
 455:
 456:def TestPrivate()
 457:print "In TestPrivate\n"
 458:end
 459:
 460:def log(word)
 461:logTime = Time.now
 462:timeStr = logTime.strftime("%d-%m-%Y  %H:%M:%S  ")
 463:
 464:print( timeStr + " " + word)
 465:if( $logFile.nil? == false ) then
 466: $logFile.print( timeStr + " " + word )
 467: $logFile.flush()
 468:end
 469:end
 470:
 471:def readLine()
 472: $line=String.new
 473: $index=0
 474:
 475: cod=conn_.Recv(1, $waitTime)
 476: $line+=cod
 477:
 478: beforeTime = Time.now
 479:
 480:while (cod[0,1] != "\r")   do
 481: if (conn_ != nil) then
 482: cod=conn_.Recv(1, $waitTime)
 483: $line += cod
 484: else
 485: log( "Can not read from serial " + "\n" )
 486: end
 487:
 488: afterTime = Time.now
 489: diffTime = afterTime - beforeTime
 490: if( diffTime > 5 ) then
 491: log( "Timeout received:" + $line + "\n" )
 492: break
 493: end
 494:
 495: if( $line.size() >2 ) then
 496: log( "Temp received:" + $line + "\n" )
 497: end
 498:end
 499: log( "Final received:" + $line + "\n" )
 500: return $line
 501:end
 502:
 503:#### 420 ####################################################################
 504:def cmd_420(cmd=nil)
 505:@returnParamArray.clear
 506:conn_.Send("SICDR/TAPE1\r")
 507:
 508:return @returnParamArray
 509:end
 510:#### START SETTERS ####################################################################
 511:def initialize()
 512:super
 513:@returnParamArray=Array.new
 514:end
 515:####  END  SETTERS ####################################################################
 516:end

nosilla99

  • Veteran
  • ***
  • Posts: 120
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #3 on: January 07, 2009, 09:54:53 am »
Chris,

The parity setting should be N81 change this value and reload the router, LMCE would not control my AMP until I fixed that setting.

With regards logging I can check mine later today, but you could try changing the log options within LMCE Launch Manager to get more detailed debug info.

I only have three wires connected in my serial cable so can't comment if other pins are causing a problem such as DSR and CTS (hardware handshaking).

NOS


dothedog

  • Veteran
  • ***
  • Posts: 82
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #4 on: January 07, 2009, 05:51:58 pm »
I have an AVR-3808ci and having the same issues. Stupid question, how do you change the 8N1 to N81? I can't seem to change it in the web interface? Is this something that needs to be changed in the bios?

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Denon AVR RS232 protocol users - help!
« Reply #5 on: January 07, 2009, 06:20:16 pm »
I only have three wires connected in my serial cable so can't comment if other pins are causing a problem such as DSR and CTS (hardware handshaking).
good point.

br, Hari
rock your home - http://www.agocontrol.com home automation

nosilla99

  • Veteran
  • ***
  • Posts: 120
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #6 on: January 07, 2009, 08:46:44 pm »
I have an AVR-3808ci and having the same issues. Stupid question, how do you change the 8N1 to N81? I can't seem to change it in the web interface? Is this something that needs to be changed in the bios?

I removed the Denon Amp from generic serial devices, then edited the device template and then re-added the Denon Amp.

I have also now checked my log files and even with minimal logging enabled using my Denon remote causes messages to be logged  in /var/log/pluto/<DeviceId>_Generic_Serial_Device.log

If cables are OK then you should see the Denon reporting status events in the logfile such as PWON PWRSTANDBY etc
   
NOS

   

dothedog

  • Veteran
  • ***
  • Posts: 82
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #7 on: January 07, 2009, 09:45:54 pm »
Nosilla99,
Thanks, It does look like it is wrong in the template because it is defined as Parity/Bit/Stop. I am at work so I can't test it, but I was able to change the serial parameter. I wonder how we get that changed in the distro template?

Thanks,
DoTheDog

nosilla99

  • Veteran
  • ***
  • Posts: 120
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #8 on: January 07, 2009, 10:39:23 pm »
@dothedog

The bug was reported using the tracker although I have not checked it's status for some time, but hopefully it will be resolved at some point in the future although the fix means people can easilly resolve the issue themselves without too much headache.

I think I also changed the baud rate within the template to B9600, although not sure if that was required

Let us know how you get on

NOS

« Last Edit: January 07, 2009, 10:41:02 pm by nosilla99 »

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #9 on: January 07, 2009, 11:19:18 pm »
I changed the template to read N81 and now the device starts without errors. But is it normal to spew out all the code on start? See below:

Code: [Select]
== ATTEMPT FRESH START ==
1 01/07/09 22:14:35 /usr/pluto/bin/Spawn_Device.sh 158 (spawning-device) 11057 Dev: 158; Already Running list: 31,32,34,35,33
,37,36,61,38,62,135,
== FRESH START ==
1 01/07/09 22:14:35 /usr/pluto/bin/Spawn_Device.sh 158 (spawning-device) device: 158 ip: dcerouter cmd_line: Generic_Serial_D
evice
0 01/07/09 22:14:35 158 (spawning-device) Entering 158
========== NEW LOG SECTION ==========
1 01/07/09 22:14:35 158 (spawning-device) Starting... 1
1 01/07/09 22:14:36 158 (spawning-device) Found /usr/pluto/bin/Generic_Serial_Device
RCODE:
   0:require 'Ruby_Generic_Serial_Device'
   1:class Command < Ruby_Generic_Serial_Device::RubyCommandWrapper
   2:end
   3:class Device_158 < Ruby_Generic_Serial_Device::RubySerialIOWrapper
   4:#### 89 ####################################################################
   5:def cmd_89(repeat_command, cmd=nil)
   6:@returnParamArray.clear
   7:conn_.Send("MVUP\r")
   8:
   9:return @returnParamArray
  10:end
  11:#### 90 ####################################################################
  12:def cmd_90(repeat_command, cmd=nil)
  13:@returnParamArray.clear
  14:conn_.Send("MVDOWN\r")
  15:
  16:return @returnParamArray
  17:end
  18:#### 97 ####################################################################
  19:def cmd_97(cmd=nil)
  20:@returnParamArray.clear
  21:if(@mute)
  22:  conn_.Send("MUOFF\r")
  23:
  24:else
  25:  conn_.Send("MUON\r")
  26:
  27:end
  28:@mute=!@mute
  29:return @returnParamArray
  30:end
  31:#### 149 ####################################################################
  32:def cmd_149(cmd=nil)
  33:@returnParamArray.clear
  34:conn_.Send("MSJAZZ CLUB\r")
  35:
  36:return @returnParamArray
  37:end
  38:#### 150 ####################################################################
  39:def cmd_150(cmd=nil)
  40:@returnParamArray.clear
  41:conn_.Send("MSROCK ARENA\r")
  42:
  43:return @returnParamArray
  44:end
  45:#### 153 ####################################################################
  46:def cmd_153(cmd=nil)
  47:@returnParamArray.clear
  48:conn_.Send("MSCLASSIC CONCERT\r")
  49:
  50:return @returnParamArray
  51:end
  52:#### 161 ####################################################################
  53:def cmd_161(cmd=nil)
  54:@returnParamArray.clear
  55:conn_.Send("SITV\r")
  56:
  57:return @returnParamArray
  58:end
  59:#### 162 ####################################################################
  60:def cmd_162(cmd=nil)
  61:@returnParamArray.clear
  62:conn_.Send("SICD\r")
  63:
  64:return @returnParamArray
  65:end
  66:#### 163 ####################################################################
  67:def cmd_163(cmd=nil)
  68:@returnParamArray.clear
  69:conn_.Send("SIPHONO\r")
  70:
  71:return @returnParamArray
  72:end
  73:#### 165 ####################################################################
  74:def cmd_165(cmd=nil)
  75:@returnParamArray.clear
  76:conn_.Send("SIDVD\r")
  77:
  78:return @returnParamArray
  79:end
  80:#### 166 ####################################################################
  81:def cmd_166(cmd=nil)
  82:@returnParamArray.clear
  83:conn_.Send("SITUNER\r")
  84:
  85:return @returnParamArray
  86:end
  87:#### 174 ####################################################################
  88:def cmd_174(cmd=nil)
  89:@returnParamArray.clear
  90:conn_.Send("SIMD/TAPE2\r")
  91:
  92:return @returnParamArray
  93:end
  94:#### 176 ####################################################################
  95:def cmd_176(cmd=nil)
  96:@returnParamArray.clear
  97:conn_.Send("SIVDP\r")
  98:
  99:return @returnParamArray
 100:end
 101:#### 192 ####################################################################
 102:def cmd_192(pk_pipe, pk_device_pipes, cmd=nil)
 103:@returnParamArray.clear
 104:conn_.Send("PWON\r")
 105:
 106:sleep(2)
 107:conn_.Send("MUOFF\r")
 108:
 109:@mute = false
 110:
 111:return @returnParamArray
 112:end
 113:#### 193 ####################################################################
 114:def cmd_193(pk_pipe, cmd=nil)
 115:@returnParamArray.clear
 116:conn_.Send("PWSTANDBY\r")
 117:
 118:return @returnParamArray
 119:end
 120:#### 281 ####################################################################
 121:def cmd_281(cmd=nil)
 122:@returnParamArray.clear
 123:conn_.Send("SIDBS/SAT\r")
 124:
 125:return @returnParamArray
 126:end
 127:#### 282 ####################################################################
 128:def cmd_282(cmd=nil)
 129:@returnParamArray.clear
 130:conn_.Send("SIVCR-1\r")
 131:
 132:return @returnParamArray
 133:end
 134:#### 283 ####################################################################
 135:def cmd_283(cmd=nil)
 136:@returnParamArray.clear
 137:conn_.Send("SIVCR-2\r")
 138:
 139:return @returnParamArray
 140:end
 141:#### 284 ####################################################################
 142:def cmd_284(cmd=nil)
 143:@returnParamArray.clear
 144:conn_.Send("SIVCR-3\r")
 145:
 146:return @returnParamArray
 147:end
 148:#### 285 ####################################################################
 149:def cmd_285(cmd=nil)
 150:@returnParamArray.clear
 151:conn_.Send("SIV.AUX\r")
 152:
 153:return @returnParamArray
 154:end
 155:#### 286 ####################################################################
 156:def cmd_286(cmd=nil)
 157:@returnParamArray.clear
 158:conn_.Send("MSPURE DIRECT\r")
 159:
 160:return @returnParamArray
 161:end
 162:#### 287 ####################################################################
 163:def cmd_287(cmd=nil)
 164:@returnParamArray.clear
 165:conn_.Send("MSMULTI CH IN\r")
 166:
 167:return @returnParamArray
 168:end
 169:#### 288 ####################################################################
 170:def cmd_288(cmd=nil)
 171:@returnParamArray.clear
 172:conn_.Send("MSMULTI CH DIRECT\r")
 173:
 174:return @returnParamArray
 175:end
 176:#### 289 ####################################################################
 177:def cmd_289(cmd=nil)
 178:@returnParamArray.clear
 179:conn_.Send("MSMULTI CH PURE D\r")
 180:
 181:return @returnParamArray
 182:end
 183:#### 290 ####################################################################
 184:def cmd_290(cmd=nil)
 185:@returnParamArray.clear
 186:conn_.Send("MSDOLBY PRO LOGIC\r")
 187:
 188:return @returnParamArray
 189:end
 190:#### 291 ####################################################################
 191:def cmd_291(cmd=nil)
 192:@returnParamArray.clear
 193:conn_.Send("MSDOLBY PL2\r")
 194:
 195:return @returnParamArray
 196:end
 197:#### 292 ####################################################################
 198:def cmd_292(cmd=nil)
 199:@returnParamArray.clear
 200:conn_.Send("MSDOLBY DIGITAL\r")
 201:
 202:return @returnParamArray
 203:end
 204:#### 293 ####################################################################
 205:def cmd_293(cmd=nil)
 206:@returnParamArray.clear
 207:conn_.Send("MSDOLBY D EX\r")
 208:
 209:return @returnParamArray
 210:end
 211:#### 294 ####################################################################
 212:def cmd_294(cmd=nil)
 213:@returnParamArray.clear
 214:conn_.Send("MS6.1 SURROUND\r")
 215:
 216:return @returnParamArray
 217:end
 218:#### 295 ####################################################################
 219:def cmd_295(cmd=nil)
 220:@returnParamArray.clear
 221:conn_.Send("MSDTS NEO:6\r")
 222:
 223:return @returnParamArray
 224:end
 225:#### 296 ####################################################################
 226:def cmd_296(cmd=nil)
 227:@returnParamArray.clear
 228:conn_.Send("MSDTS SURROUND\r")
 229:
 230:return @returnParamArray
 231:end
 232:#### 297 ####################################################################
 233:def cmd_297(cmd=nil)
 234:@returnParamArray.clear
 235:conn_.Send("MSDTS ES DSCRT6.1\r")
 236:
 237:return @returnParamArray
 238:end
 239:#### 298 ####################################################################
 240:def cmd_298(cmd=nil)
 241:@returnParamArray.clear
 242:conn_.Send("MSDTS ES MTRX6.1\r")
 243:
 244:return @returnParamArray
 245:end
 246:#### 299 ####################################################################
 247:def cmd_299(cmd=nil)
 248:@returnParamArray.clear
 249:conn_.Send("MSHOME THX CINEMA\r")
 250:
 251:return @returnParamArray
 252:end
 253:#### 300 ####################################################################
 254:def cmd_300(cmd=nil)
 255:@returnParamArray.clear
 256:conn_.Send("MSTHX5.1\r")
 257:
 258:return @returnParamArray
 259:end
 260:#### 301 ####################################################################
 261:def cmd_301(cmd=nil)
 262:@returnParamArray.clear
 263:conn_.Send("MSTHX U2 CINEMA\r")
 264:
 265:return @returnParamArray
 266:end
 267:#### 302 ####################################################################
 268:def cmd_302(cmd=nil)
 269:@returnParamArray.clear
 270:conn_.Send("MSTHX MUSIC MODE\r")
 271:
 272:return @returnParamArray
 273:end
 274:#### 303 ####################################################################
 275:def cmd_303(cmd=nil)
 276:@returnParamArray.clear
 277:conn_.Send("MSTHX6.1\r")
 278:
 279:return @returnParamArray
 280:end
 281:#### 304 ####################################################################
 282:def cmd_304(cmd=nil)
 283:@returnParamArray.clear
 284:conn_.Send("MSTHX SURROUND EX\r")
 285:
 286:return @returnParamArray
 287:end
 288:#### 305 ####################################################################
 289:def cmd_305(cmd=nil)
 290:@returnParamArray.clear
 291:conn_.Send("MSWIDE SCREEN\r")
 292:
 293:return @returnParamArray
 294:end
 295:#### 306 ####################################################################
 296:def cmd_306(cmd=nil)
 297:@returnParamArray.clear
 298:conn_.Send("MS5CH STEREO\r")
 299:
 300:return @returnParamArray
 301:end
 302:#### 307 ####################################################################
 303:def cmd_307(cmd=nil)
 304:@returnParamArray.clear
 305:conn_.Send("MS7CH STEREO\r")
 306:
 307:return @returnParamArray
 308:end
 309:#### 308 ####################################################################
 310:def cmd_308(cmd=nil)
 311:@returnParamArray.clear
 312:conn_.Send("MSDIRECT\r")
 313:
 314:return @returnParamArray
 315:end
 316:#### 309 ####################################################################
 317:def cmd_309(cmd=nil)
 318:@returnParamArray.clear
 319:conn_.Send("MSMATRIX\r")
 320:
 321:return @returnParamArray
 322:end
 323:#### 310 ####################################################################
 324:def cmd_310(cmd=nil)
 325:@returnParamArray.clear
 326:conn_.Send("MSMONO MOVIE\r")
 327:
 328:return @returnParamArray
 329:end
 330:#### 311 ####################################################################
 331:def cmd_311(cmd=nil)
 332:@returnParamArray.clear
 333:conn_.Send("MSSTEREO\r")
 334:
 335:return @returnParamArray
 336:end
 337:#### 312 ####################################################################
 338:def cmd_312(cmd=nil)
 339:@returnParamArray.clear
 340:conn_.Send("MSSUPER STADIUM\r")
 341:
 342:return @returnParamArray
 343:end
 344:#### 313 ####################################################################
 345:def cmd_313(level, cmd=nil)
 346:@returnParamArray.clear
 347:conn_.Send("MV" + level + "\r")
 348:
 349:SetDeviceDataInDB( device_.devid_, 158, level ) # 158 = DEVICEDATA_Volume_Level_CONST
 350:print "volume and corresponding device data set\n"
 351:
 352:return @returnParamArray
 353:end
 354:#### 350 ####################################################################
 355:def cmd_350(cmd=nil)
 356:@returnParamArray.clear
 357:#event  31 A 06 14:50 Denon AVC
 358:buff = readLine()
 359:print buff,"\n"
 360:return @returnParamArray
 361:end
 362:#### 355 ####################################################################
 363:def cmd_355(cmd=nil)
 364:@returnParamArray.clear
 365:#31-May-06 14:13 init Denon AVC
 366:
 367:initok=false
 368:
 369:
 370:# It doesn't respond to anything but power on when it's off.  Before turning it on and off
 371:# See if it responds to something it normally would while it's on
 372:
 373:for iRetry in 0...4
 374:    print "Initializing unit\n"
 375: conn_.Send("MVUP\rMVDOWN\r")
 376:    buf = conn_.Recv(200, 1000)
 377:    if( !buf.nil? && !buf.index("MV" ).nil? )
 378:        print "Initialized ok\n"
 379: initok=true
 380: break
 381: else
 382: print "Didn't respond to mv up/down\n"
 383: end
 384:end
 385:
 386:if initok==false
 387: for iRetry in 0...4
 388: print "Initializing unit\n"
 389: conn_.Send("PWON\r")
 390: sleep(3);
 391: conn_.Send("PWSTANDBY\r");
 392: buf = conn_.Recv(200, 4000)
 393: if( !buf.nil? && (!buf.index("ON" ).nil? || !buf.index("STAND" ).nil? || !buf.index("OFF" ).nil?) )
 394: print "Initialized ok from off state\n"
 395: initok=true
 396: break
 397: else
 398: print "Failed to initialize\n"
 399: end
 400: print "Failed to initialize.  Wait 1 secs and try again\n"
 401: sleep(1)
 402: end
 403:end
 404:
 405:if initok==false
 406: DisableDevice( device_.devid_, true )
 407: print "The device wouldn't respond. Disabling it.\n"
 408: return
 409:end
 410:
 411:print "Initialized ok, doing log\n"
 412:
 413:$logFile = File.new("/var/log/pluto/DenonAVC.log", "w")
 414:$SoundLevel = 0
 415:
 416:#buffer for reading from serial
 417:$line=String.new
 418:$lineIndex=0
 419:
 420:$waitTime = 3000      #wait time in comunication
 421:
 422:$eventCode = {
 423:"MS"    =>    "Mode surround",
 424:"PS"    =>    "Parameter settings",
 425:"TF"    =>    "Tone frequency",
 426:"TP"    =>     "Tuner present",
 427:"TM"    =>     "Tuner band",
 428:"PW"    =>     "Power",
 429:"MV"    =>     "Master volume",
 430:"CV"    =>     "Chanel volume",
 431:"MU"    =>     "Mute",
 432:"SI"    =>    "Select Input"
 433:}
 434:
 435:$inputSources = {
 436:"VDP"              =>        176,
 437:"VCR-3"           =>        284,
 438:"VCR-2"           =>        283,
 439:"VCR-1"           =>        282,
 440:"V.AUX"           =>        285,
 441:"TV"                =>       161,
 442:"TUNER"           =>       166,
 443:"PHONO"           =>       163,
 444:"MD/TAPE2"      =>       174,
 445:"DVD"              =>       165,
 446:"DBS/SAT"        =>       281,
 447:"CD"                =>       162,
 448:"CDR/TAPE1"     =>       420
 449:}
 450:
 451:return @returnParamArray
 452:end
 453:#### PRIVATE METHODS ####################################################################
 454:#private  Denon  2006-12-07 17:50:58
 455:
 456:def TestPrivate()
 457:print "In TestPrivate\n"
 458:end
 459:
 460:def log(word)
 461:logTime = Time.now
 462:timeStr = logTime.strftime("%d-%m-%Y  %H:%M:%S  ")
 463:
 464:print( timeStr + " " + word)
 465:if( $logFile.nil? == false ) then
 466: $logFile.print( timeStr + " " + word )
 467: $logFile.flush()
 468:end
 469:end
 470:
 471:def readLine()
 472: $line=String.new
 473: $index=0
 474:
 475: cod=conn_.Recv(1, $waitTime)
 476: $line+=cod
 477:
 478: beforeTime = Time.now
 479:
 480:while (cod[0,1] != "\r")   do
 481: if (conn_ != nil) then
 482: cod=conn_.Recv(1, $waitTime)
 483: $line += cod
 484: else
 485: log( "Can not read from serial " + "\n" )
 486: end
 487:
 488: afterTime = Time.now
 489: diffTime = afterTime - beforeTime
 490: if( diffTime > 5 ) then
 491: log( "Timeout received:" + $line + "\n" )
 492: break
 493: end
 494:
 495: if( $line.size() >2 ) then
 496: log( "Temp received:" + $line + "\n" )
 497: end
 498:end
 499: log( "Final received:" + $line + "\n" )
 500: return $line
 501:end
 502:
 503:#### 420 ####################################################################
 504:def cmd_420(cmd=nil)
 505:@returnParamArray.clear
 506:conn_.Send("SICDR/TAPE1\r")
 507:
 508:return @returnParamArray
 509:end
 510:#### START SETTERS ####################################################################
 511:def initialize()
 512:super
 513:@returnParamArray=Array.new
 514:end
 515:####  END  SETTERS ####################################################################
 516:end
518:

Sadly, no state change on the Denon receiver makes anything appear in the logs. Also manually triggering commands from the web admin has no effect upon the log or the device itself.

If I use the same USB to serial adapter and plug it into my laptop I am able to see the status of the receiver using hyperterminal and also control it by typing commands.

I also notice that the Denon AVC receiver autodetection script reports that the attached hardware is not a Denon receiver. Hmmm.

Any ideas? This is very strange.

Thanks,

Chris

nosilla99

  • Veteran
  • ***
  • Posts: 120
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #10 on: January 07, 2009, 11:54:51 pm »
Chris,

I have checked my logs and they also show the ruby code during startup.  At least you have confirmed that the device responds to commands and shows status messages using a laptop.  I guess it could be a problem with the USB->Serial converter and LMCE.

My system didn't detect the receiver as being a Denon either as the script fails with an error related to the serial port for some reason (try running it manually to confirm).  I had to add mine manually and  as stated earlier also all of he ruby code was strangely missing in my device template (710 can't remember release version but was DVD based)

It certainly sounds like a cable/usb interface issue as you should see the status messages if the system was able to communicate natively with the RS232 device.

If you had a crossed cable you could try connecting the MD to a laptop with hyper terminal running and see hat happens when sending messages each way.  If there is no visible output then I would have to say the usb converter is causing the problem (in which case you could try changing the serial port device specified on the MD).

Hopefully someone with experience of USB->Serial converters can throw in some more info here

NOS

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Denon AVR RS232 protocol users - help!
« Reply #11 on: January 08, 2009, 12:15:15 am »
just for the records, esperegu had a (broken?) usb/rs232 adapter that showed up correctly but did not work with the Marantz SR or the LG LCD.

br, Hari
rock your home - http://www.agocontrol.com home automation

chrisbirkinshaw

  • Guru
  • ****
  • Posts: 431
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #12 on: January 08, 2009, 01:08:26 pm »
I actually started using the USB-serial because I could not get it to work with the on-board serial port! :-(

I have tested the cable successfully using Hyperterminal and see commands echoed.

BTW do you all have a nightmare adding GSD? When I add the unit in the AV Devices section then no matter if I change the controlled by setting to my MD it is always started on the core. If I add the device as a child of the MD in the tree then this problem does not occur, however the device does not start after a core restart - a full reboot of the system is needed before the device starts and the device log is created.

I don't see any errors in the log but when sending commands from the web interface I get nothing at all in the log. I would have expected to see attempts to send commands, or alternatively a connection error if there was no attempt to send commands. What should I expect to see?

I will try a different MD tonight and see if that makes any difference, though I'm sceptical as I've tried 2 serial ports on this MD and the motherboard is quite new.

Thanks,

Chris

nosilla99

  • Veteran
  • ***
  • Posts: 120
    • View Profile
Re: Denon AVR RS232 protocol users - help!
« Reply #13 on: January 08, 2009, 05:44:36 pm »
Chris

My Denon is attahed to the core, I think I ended up adding it using the AV wizard from the on screen orbiter (so yes it appears as a child of the  core rather than the hybrid/core md).
When using web admin to send commands I do see the messages in the generic serial device log file an example of sending Vol Up is given below:

Code: [Select]
dcerouter_92762:/var/log/pluto# tail 44_Generic_Serial_Device.log
10      01/08/09 16:36:45.749           Calling method cmd_89 in class " with parameters <0xb5789b90>
10      01/08/09 16:36:45.749           Sending buffer to ttyS0 with size 5: <0x4d 0x56 0x55 0x50 0xd (MVUP\r)>. <0xb5789b90>
10      01/08/09 16:36:45.749           Buffer sent. <0xb5789b90>
10      01/08/09 16:36:45.749           Method call ended. <0xb5789b90>
05      01/08/09 16:36:45.751           GSD-Sleep Post 89 : 0 <0xb778db90>
05      01/08/09 16:36:45.751           _QueueProc Post - 89 : 0 <0xb778db90>
10      01/08/09 16:36:45.786           handleMessage directly <0xb5789b90>
10      01/08/09 16:36:45.786           Command 350 not supported. <0xb5789b90>
10      01/08/09 16:36:45.786           Receiving buffer from ttyS0 with max size 4096 and timeout 100... <0xb5789b90>
10      01/08/09 16:36:45.887           Received buffer from ttyS0: <0x4d 0x56 0x33 0x38 0xd (MV38\r)> <0xb5789b90>

And when using the Denon remote the log file shows status update messages received as below:

Code: [Select]
dcerouter_92762:/var/log/pluto# tail 44_Generic_Serial_Device.log
10      01/08/09 16:48:13.545           Receiving buffer from ttyS0 with max size 4096 and timeout 100... <0xb5789b90>
10      01/08/09 16:48:13.646           Received buffer from ttyS0: <0x4d 0x56 0x34 0x37 0xd (MV47\r)> <0xb5789b90>
10      01/08/09 16:48:14.178           handleMessage directly <0xb5789b90>
10      01/08/09 16:48:14.178           Command 350 not supported. <0xb5789b90>
10      01/08/09 16:48:14.178           Receiving buffer from ttyS0 with max size 4096 and timeout 100... <0xb5789b90>
10      01/08/09 16:48:14.279           Received buffer from ttyS0: <0x4d 0x56 0x34 0x37 0x35 0xd (MV475\r)> <0xb5789b90>
10      01/08/09 16:48:14.679           handleMessage directly <0xb5789b90>
10      01/08/09 16:48:14.679           Command 350 not supported. <0xb5789b90>
10      01/08/09 16:48:14.679           Receiving buffer from ttyS0 with max size 4096 and timeout 100... <0xb5789b90>
10      01/08/09 16:48:14.779           Received buffer from ttyS0: <0x4d 0x56 0x34 0x39 0x35 0xd (MV495\r)> <0xb5789b90>
 

NOS
« Last Edit: January 08, 2009, 05:54:16 pm by nosilla99 »

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Re: Denon AVR RS232 protocol users - help!
« Reply #14 on: January 08, 2009, 05:53:31 pm »
I actually started using the USB-serial because I could not get it to work with the on-board serial port! :-(

I have tested the cable successfully using Hyperterminal and see commands echoed.

BTW do you all have a nightmare adding GSD? When I add the unit in the AV Devices section then no matter if I change the controlled by setting to my MD it is always started on the core. If I add the device as a child of the MD in the tree then this problem does not occur, however the device does not start after a core restart - a full reboot of the system is needed before the device starts and the device log is created.

I don't see any errors in the log but when sending commands from the web interface I get nothing at all in the log. I would have expected to see attempts to send commands, or alternatively a connection error if there was no attempt to send commands. What should I expect to see?

I will try a different MD tonight and see if that makes any difference, though I'm sceptical as I've tried 2 serial ports on this MD and the motherboard is quite new.

Thanks,

Chris


Hi Chris,

We always use USB->serial cable adapters with Denon's we install. Attach the cable to the Denon amp's RS232 connector first. Now connect the USB end to your MD/Core and allow it to be auto-detected. Then just follow the Wizard's through and do a reload.

Thats its...unless your trying to do something non-standard with the control of the Amp.

All the best

Andrew
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk