PDA

View Full Version : Baud rate changeable?


beelzerob
11-02-2006, 08:04 AM
Dean, I'm working with the Inline3808 right now, and it has a selectable baud rate. It's factory default is 1200, but you can set it as high as 19.2k. It is set by sending it a message through the RS232 port.

However, when installing the driver, you have to select a baud rate via the manifest file. That's usually set at 9600.

Sooo, here is the potential delimna.... If the default is 1200, then do I have to set the baud rate in the .manifest file to 1200 also? And if I do, and then when I connected, I send a message to the 3808 telling it to go to 19.2, will the port still be set on the PC to 1200? Can I change the baud rate while connected, even if it's different from what the manifest file says? In other words, is something on the PC side "locking" in the baud rate according to what the manifest file indicates?

Dean Roddey
11-02-2006, 09:32 AM
They will have to set it externally and have it ready. I'd just hard wire the drive rto the highest baud and tell them to set it externally before installing the driver. Worst case, provide a trivial external program that can be used to do that.

There isn't anything preventing you from using a different rate from what you get from the manifest file, which is passed in to your driver. But I just don't think it's worth it. What if it's already at 19.2? Seems like you'd have to try every possible baud rate.

beelzerob
11-02-2006, 09:38 AM
There isn't anything preventing you from using a different rate from what you get from the manifest file, which is passed in to your driver.

Oh, ok...I think I get it. The baud rate passed in simply goes to the GetCommResource function, and THAT'S where it's used. So, I can use any baud rate I want in that function, whether the one I passed in, or a different one. But once I get the comm resource, is that comm port locked in at that baud rate?

Dean Roddey
11-02-2006, 10:06 AM
You can close and re-open the com port as desired. You own it and CQCServer doesn't know anything about them. So you could open it in the Connect at one baud rate, get connected, then open it at the rate indicated in the manifest before you return from Connect.

beelzerob
11-02-2006, 10:10 AM
Hmmm....does the opening of the comm port have to specifically happen in GetCommResource()? Or can it happen in Connect()?

Edit: ok, you answered that question...I can open/close ANYWHERE I want.


So if I can do all the port opening/closing in Connect(), then I can....open the port at the lower rate, send it the command to up the rate, close the port, open it AGAIN at the higher rate, finish up with connecting, and return successfully from Connect()? Interesting. I think I'll try that!

Dean Roddey
11-02-2006, 10:27 AM
Yeh, you can do that if you need to.

beelzerob
11-02-2006, 11:32 AM
Well, since it's possible the default baud rate has been changed at some point prior to my driver running.....if the baud rate on the 3808 has been set to something higher than 1200, can I still connect initially at 1200 and then set the device higher?

What I mean is....do the PC and 3808 HAVE to be the same baud rate to communicate at all? Or if the 3808 is set to a higher baud rate, will it still communicate at 1200?

Mark Stega
11-02-2006, 12:09 PM
What I mean is....do the PC and 3808 HAVE to be the same baud rate to communicate at all? Or if the 3808 is set to a higher baud rate, will it still communicate at 1200?
They have to be at the same rate; Some drivers attempt to communicate at each valid rate until they get a meaningful reply (sort of a software driven autobaud detection). You could try that, but what is resetting the baud rate of the device outside of the driver?

beelzerob
11-02-2006, 12:23 PM
Nothing is resetting it, that I know of....but many owners may have no idea if the baud rate was ever set by anyone else (if, for example, they bought their system used). So, instead of forcing driver users to restore factory defaults in order to assure 1200, I think I can try the autodetection thing....it's only like 5 different speeds. Thanks for that info, Mark.

rhamer
11-02-2006, 01:14 PM
Why do you want to move away from 1200?

Remember you don't get anything for nothing, increasing the speed will decrease the maximum cable length and also make the cable choice more critical. If you don't have much data to shift then stick with 1200, it will be the most reliable.

Also be aware that having the driver guess the baud rate is not as easy as it sounds. You will be receiving data back from the device that the driver will try and decode with unpredictable results, particularly if you use one of the helper methods like GetAsciiTermedMsg where it will be waiting for a valid character at the baud rate you have set, to signal the end of the message, it may well miss read one in the middle of another message sent at a different baud rate. It's not like 2 devices set a different baud rates will not communicate at all, they will, it's just that the received message will bear no resembelence to the sent message because it will be clocked in at a different rate.

I think your setting yourself up for a whole lot of grief. :-?

Cheers

Rohan

beelzerob
11-02-2006, 01:22 PM
I'm sorry, Rohan, you must not have gotten the memo.....

Faster is Better!

Just watch ANY commercial and you'll learn this. It's right after the commercial that teaches that drinking beer results in lots of hot girls coming out of nowhere.

An interesting suggestion, Rohan. With 9600 being the typical setting, 1200 seems slower than sending back and forth notes in high school. The length of the messages the 3808 sends and accepts are is fairly low...maybe 20 ASCII chars at max at a time.

This would still result in making the driver user reset his device to factory defaults....but that's probably not too big of a headache, and at least returns it to a known state for me to work with.

Dean Roddey
11-02-2006, 02:49 PM
What kind of device is it anyway? I'm not even sure what it is and what kind of need for speed it might have.

beelzerob
11-02-2006, 03:15 PM
Audio and Video Input/Output switcher. (http://www.inlineinc.com/products/matrix/3808.htm)

rhamer
11-02-2006, 03:28 PM
1200 baud, using rough rule of thumb conversions will give about 120 characters/second (assuming 8 bit characters and a bit of overhead).

So it should be heaps for what you are doing.

Oh, and faster is only better of it comes in red ;-)

Cheers

Rohan

Dean Roddey
11-02-2006, 03:37 PM
What's the protocol like on this device? Anyway, I think that the best thing to do is to let the baud rate be setting during driver install, and just tell the user to set it to what they want and the driver will use what they tell it to use. That's the most flexible in the end and let's them do what they want to do.

beelzerob
11-02-2006, 03:44 PM
Awww, good ol' Dean...putting power back in the hands of the end-user. :)

Sure, I can give 'em a choice for baud, but probably 99% of all users will just choose a default rate.

At 120char/sec, that means about 160ms for a 20 char message. The spec also says to leave a min of 200 msec between messages for processing...so that makes it pretty slow to do a lot. At 9600 baud (using the same rule of thumb), it'd be 20msec for the same message...that's closer to reasonable, I think.

How about if I give them the choice (because it's true, slower baud means longer cable and stability), but default/suggest 9600 since that's a fairly common standard?

Of course, the other issue in this is that the device might have already been set to some OTHER baud rate. I could require that they return the device to factory defaults first, which puts it at 1200, and then I can change it from there. However, they'd have to restore factory defaults every time they uninstalled and reinstalled the driver....that could be a headache, as I know I've uninstalled/installed drivers lots of times for drivers I use, at least until my system stablized somewhat.

Hmph.

rhamer
11-02-2006, 03:58 PM
Let them choose it via the manifest file, and then it's up to them to make sure the machine matches.

If necessary provide them with instruction on how to set/reset it using hyperterminal (if possible).

Worst case they can try a few values by reloading the driver and selecting a different one via the manifest until they find it.

And for what it's worth, in my opinion the user experience gain between 1200 and 9600 will almost undetectable over 20 chars.

Cheers

Rohan

beelzerob
11-02-2006, 03:59 PM
Isn't there any other driver out there that can select a baud rate for the device? How do they handle not knowing what the existing baud rate is, or do they leave that on the device owner to know?

beelzerob
11-02-2006, 04:03 PM
And for what it's worth, in my opinion the user experience gain between 1200 and 9600 will almost undetectable over 20 chars.


I don't know....I sure don't want to be the guy that people start coming to and saying "Man, that's 140 milliseconds of my life I'd like to have back."

Depending on how old you are, that's a noteworthy percentage of your remaining life! :shock:

Ok, for now I'll try setting the default to 1200, and give them the choice of selecting a different one. Messages to and from this device aren't time-critical...it's not passing a media time index or anything.

rhamer
11-02-2006, 04:37 PM
You get it by default when you have this sort of thing in the manifest;


<CQCCfg:ConnCfg CQCCfg:Editable="True">
<CQCCfg:SerialConn CQCCfg:Type="RS232"
CQCCfg:Bits="Bits8"
CQCCfg:Baud="Baud_9600"
CQCCfg:Parity="None"
CQCCfg:StopBits="One"/>
</CQCCfg:ConnCfg>


When you load the manifest there is a settings button that lets you change the defaults.

Cheers

Rohan