PDA

View Full Version : Best option for single bit input ???



psg
April 17th, 2006, 10:26 PM
One serial command for my DLP TV that I know works is the Power Toggle ... yep, you heard it right ... just a toggle.

So I've purchased a Xantech CSM-1 "Current Sensing Module" so Girder can know the power state of the TV. Looks lik it has a 9 volt DC, active-high output ... I can drop that down to 5 volts with a string of diodes, if necessary.

Options for interfacing would include connecting this to the parallel port, or to a status line of a serial port. Which way would be cleanest, as far as being able to translate a transition of the signal into a Girder event???

Is there another option ... simple, clean and cheap, that I'm missing?

Paul

Mark F
April 18th, 2006, 08:32 AM
If you are choosing between serial and parallel, choose serial. (one of the modem status lines would work) With the parallel port, software has to POLL to see the event and this uses resources that could be better used elsewhere.

If you don't mind, which DLP TV model/make do you have? I might be able to get the discrete commands for you.

psg
April 18th, 2006, 02:21 PM
Mark,

Thanks for the reply. I've written, or am in the process of writing, three diferent serial drivers, but I have seen no examples of how to deal with the status lines from the serial ports. Can you direct me to any drivers that show how to do that??

It's a Samsung HL-R7178W, but the serial command set is completely disjoint from the IR command set. None of the IR discretes seem to have any analog in the serial part of its world. It is SO effin' lame in that regard that I find it hard to believe they'd be so darned stupid, but it really appears that they were.

It also appears that some of the serial commands that are documented DO NOT WORK, specifically some of the discrete input switching ones, which will mean that I will end up with a hybrid serial/IR lash-up. I sure hope it's just something I've got wrong in the serial driver, but right now I don't think so.

I've emailed their "product specialist", they guy with the direct line to Korea, but after his first reply, sending me a copy of the doc I already had, he's been unresponsive for three weeks. I just got a reply from the marketing manager, who I contacted looking for some help to motivate the engineering department. We'll see where that leads ...

I REALLY, REALLY, REALLY want to do this with a serial connection, rather than IR.

Paul


If you are choosing between serial and parallel, choose serial. (one of the modem status lines would work) With the parallel port, software has to POLL to see the event and this uses resources that could be better used elsewhere.

If you don't mind, which DLP TV model/make do you have? I might be able to get the discrete commands for you.

psg
April 18th, 2006, 03:19 PM
If you are choosing between serial and parallel, choose serial. (one of the modem status lines would work)

How about RI (Ring Indicator)? Any preference for what status line to use as far as making it easy to program catching the transitions?

Paul

Rob H
April 18th, 2006, 05:38 PM
Is this G3.3 or G4?

Do you have a protocol document?

psg
April 18th, 2006, 07:26 PM
Is this G3.3 or G4?

Do you have a protocol document?

G4, and yes, I have the protocol doc. Seems like Samsung's firmware coders may not have had it, when they did their work ... but who knows, maybe I've made a mistake somewhere ...

Rob H
April 19th, 2006, 03:05 AM
well, I'll take a look if you want to post a link to the protocol doc and what you have so far.

psg
April 19th, 2006, 09:42 AM
Rob,

The serial driver is in the Girder4 download section. I just updated it about 20 minutes ago --- look for version 1.1.

I'm attaching the protocol doc.

Some additional information --- here are the bytes I'm sending for the source selection commands, and the results of trying them:
SOURCE COMMAND NOTES
------ ------------------- ---------------------
TV 08 22 0A 00 00 00 00 CC works
AV1 08 22 0A 00 00 00 01 CB apparently works, has no input connected
AV2 08 22 0A 00 00 00 02 CA apparently works, has no input connected
SVID1 08 22 0A 00 00 00 03 C9 apparently works, has no input connected
SVID2 08 22 0A 00 00 00 04 C8 apparently works, has no input connected
COMP1 08 22 0A 00 00 00 05 C7 works
COMP2 08 22 0A 00 00 00 06 C6 no action
PC 08 22 0A 00 00 00 07 C5 no action
HDMI1 08 22 0A 00 00 00 08 C4 works, but only when starting from PC
HDMI2 08 22 0A 00 00 00 09 C3 no action





Paul

Mark F
April 19th, 2006, 12:25 PM
I'll see what I can do WRT getting a better document for the serial protocol that this set supports.

I would stay away from the serial port ring indicator. (I've had bad luck with this) Use the CTS or DTR signal if you can. Many serial ports are 12V tolerant (since that was the old RS-232 standard) but some are not. You may not need to do a voltage translation at all or you may need to generate a negative voltage for 0. YMMV. :)

Rob or MikeC are the guys to talk to about G4 serial stuff so you are in excellent hands. I know a bit ;) about the G3 serial stuff but not G4.

psg
April 19th, 2006, 12:55 PM
Good luck! I really think I have all that they have ... and the critical part now is somehow getting the source switching among PC, HDMI1 and Component1 to work. Right now, if on PC, I can switch to HDMI1 or Component1, but then I can't get back to PC. Also, if on Component1, I can't get back to HDMI1, even though the TV does a success ACK in all cases.

I wonder whether they'll consider it a warranty issue, since the TV does not meet the published specs, and is, at least to a degree, inoperative. No ... I really don't wonder. I'm sure they'll just blow it off.

Shoot ... I got tired of waiting, and just made the cable and installed it. Naturally, I did use RI.

Oh well ... I'll try it and if it causes problems, it's no big deal to remove the pin and shift it to a different hole. It's REACHING it to do that that is the problem <grin>.

Any port that's NOT 12 volt "tolerant" isn't RS-232. That still IS the standard. I hear you on the -12v issue though ... I hope I don't have to do that. I have no idea whatever of what the output structure of the CSM-1 looks like, so I guess I'll just try it out and play it by ear.


I'll see what I can do WRT getting a better document for the serial protocol that this set supports.

I would stay away from the serial port ring indicator. (I've had bad luck with this) Use the CTS or DTR signal if you can. Many serial ports are 12V tolerant (since that was the old RS-232 standard) but some are not. You may not need to do a voltage translation at all or you may need to generate a negative voltage for 0. YMMV. :)

Rob or MikeC are the guys to talk to about G4 serial stuff so you are in excellent hands. I know a bit ;) about the G3 serial stuff but not G4.

Rob H
April 19th, 2006, 01:00 PM
A couple of comments

1) In your ReceiveResponse() method you really should ensure that code has the RXCHAR bit set ie



if math.band&#40;code, serial.RXCHAR&#41; then
-- code that processes data
end


You may also want to check for errors such as Incomplete Response and NoResponse.

You would also use math.band() here to check for one of the status lines changing. See the help file for the list of codes.

2) When developing/debugging a serial device you generally want the log level set as low as possible ie LogLevel = 0. To turn it off use LogLevel = nil

It certainly does look like a hideous protocol though :(

psg
April 19th, 2006, 01:53 PM
A couple of comments

1) In your ReceiveResponse() method you really should ensure that code has the RXCHAR bit set ie



if math.band&#40;code, serial.RXCHAR&#41; then
-- code that processes data
end


You may also want to check for errors such as Incomplete Response and NoResponse.

You would also use math.band() here to check for one of the status lines changing. See the help file for the list of codes.

2) When developing/debugging a serial device you generally want the log level set as low as possible ie LogLevel = 0. To turn it off use LogLevel = nil

It certainly does look like a hideous protocol though :(

Thanks ... I'll poke around for more examples of the status bit usage. Does the receive routine get a callback if the status bits change, but there's no data received?

Yes - hideous. Can you believe that there's no discrete on/off codes, and not ANY kind of query, or status return???? As far as I could see, there's no way to tell if the power is on or off ... absolutely no way. Why even bother to put a serial port in the device if you are going to do this? You should see how fancy and complete their protocol is for their plasmas ... wish they had just used the same, or even an abridged version.

This is just LAME. And, as I said, I don't think it even works as advertised.

Paul

Rob H
April 19th, 2006, 02:54 PM
Yes, I believe that ReceiveResponse will be called for a status change e.g. for the Ring indicator you'd test for this using

if math.band&#40;code, serial.RING&#41; > 0 then

Rob H
April 19th, 2006, 02:57 PM
Oh, a couple of messages back I got the condition wrong - to test for valid data it should be :-


if math.band&#40;code, serial.RXCHAR&#41; > 0 then

psg
April 19th, 2006, 07:58 PM
Some more progress, both positive and negative.

First the positive: I can now read the power state of the TV from the DSR serial status bit. I had to add diode, and a resistor to DTR, and set DTR false to get a source of negative voltage. Works like a charm, although the lamp cooling fan keep the current sensor triggered for 90 seconds after the TV is turned off. I can deal with that by either modifying the CSM-1, or some clever programming.

I'm still not getting any *transition* callback, so I "probe" by sending some innocuous command to the TV. I have uploaded a new version, if you'd be so kind as to take a look at it, I'd appreciate it.

Now for the REAL showstopper --- back to the hideous implementation of the hideous protocol: The Power Toggle command will only turn the TV OFF, but not ON.

I dunno ... maybe that's good news, and implies that there's a discrete power-on command somewhere. I may have to try a few hundred codes to see.

And no matter what you send it, if the checksum is OK, the TV cheerfully sends back an ACK.

I'm beginning to get really, really mad. While this thing was a great deal for a 71" 1080p DLP, at a bit over $4K, it wasn't exactly cheap ... and the serial port was truly one of the deciding factors in choosing this model.

Rob H
April 20th, 2006, 04:40 AM
Are you sure that you're reading this protocol document correctly?

My understanding is that you send the arguments first e.g. to set the contrast to 90 as in the given example

P1 is 0 (MODE)
P2 is 1 (Contrast)
P3 is 90 (0x5A) (the contrast value)

So you send


<prefix> <paramnum> 0x00 0x00 0x00 <paramValue> <csum>

ie


0x08 0x01 0x00 0x00 0x00 0x00 0xE6

0x08 0x02 0x00 0x00 0x00 0x01 0xE4

0x08 0x03 0x00 0x00 0x00 0x5A 0x8A

And you need to wait for an acknowledgment of each of those parameters.

This is then followed by the command itself - in this case PICTURE 0x0B


0x04 0x12 0x0B 0xDFAnd wait for the ack again.

Seems like a daft way to do things to me, but that's my reading of the protocol.

psg
April 20th, 2006, 08:39 AM
Are you sure that you're reading this protocol document correctly?


It would have been more useful if I had posted the correct one. This came from the marketing guy, and I didn't even realize it wasn't the same as the printed doc that came with the TV. I'll have to go hunt that down and scan it.

Does raise some interesting questions, though, doesn't it?

But following the contrast example from the printed doc, sending the command as one packet, does work.

Paul

Rob H
April 20th, 2006, 08:46 AM
Ah, okay :)